ospf6d: advertise local addresses with LA bit

Both for virtual links and correct PtMP operation, advertising local
addresses as Intra-Prefix with LA set is a prerequisite.  Add the
appropriate entries.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2021-07-27 15:08:01 +02:00 committed by Adriano Marto Reis
parent 829f3a0bd5
commit 6fdd69ed07
2 changed files with 25 additions and 1 deletions

View File

@ -397,7 +397,6 @@ void ospf6_interface_state_update(struct interface *ifp)
void ospf6_interface_connected_route_update(struct interface *ifp)
{
struct ospf6_interface *oi;
struct ospf6_route *route;
struct connected *c;
struct listnode *node, *nnode;
struct in6_addr nh_addr;
@ -451,6 +450,27 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
}
}
if (oi->state == OSPF6_INTERFACE_LOOPBACK
|| oi->state == OSPF6_INTERFACE_POINTTOPOINT) {
struct ospf6_route *la_route;
la_route = ospf6_route_create(oi->area->ospf6);
la_route->prefix = *c->address;
la_route->prefix.prefixlen = 128;
la_route->prefix_options |= OSPF6_PREFIX_OPTION_LA;
la_route->type = OSPF6_DEST_TYPE_NETWORK;
la_route->path.area_id = oi->area->area_id;
la_route->path.type = OSPF6_PATH_TYPE_INTRA;
la_route->path.cost = 0;
inet_pton(AF_INET6, "::1", &nh_addr);
ospf6_route_add_nexthop(
la_route, oi->interface->ifindex, &nh_addr);
ospf6_route_add(la_route, oi->route_connected);
}
struct ospf6_route *route;
route = ospf6_route_create(oi->area->ospf6);
memcpy(&route->prefix, c->address, sizeof(struct prefix));
apply_mask(&route->prefix);

View File

@ -540,6 +540,10 @@ int ospf6_route_cmp(struct ospf6_route *ra, struct ospf6_route *rb)
if (ra->path.area_id != rb->path.area_id)
return (ntohl(ra->path.area_id) - ntohl(rb->path.area_id));
if ((ra->prefix_options & OSPF6_PREFIX_OPTION_LA)
!= (rb->prefix_options & OSPF6_PREFIX_OPTION_LA))
return ra->prefix_options & OSPF6_PREFIX_OPTION_LA ? -1 : 1;
return 0;
}