diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2021-07-27 15:08:01 +0200 |
|---|---|---|
| committer | Adriano Marto Reis <adrianomarto@gmail.com> | 2023-10-10 07:54:39 +1000 |
| commit | 6fdd69ed0755526f1ea0b058770d449b28142cc7 (patch) | |
| tree | 26e71b0a6270e2624bb790aa049aea33c31579bc /ospf6d | |
| parent | 829f3a0bd558d926b53c90142d9ad428aeacc939 (diff) | |
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>
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ospf6_interface.c | 22 | ||||
| -rw-r--r-- | ospf6d/ospf6_route.c | 4 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index a20ddf6c10..c3b9055724 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -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); diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 443032933d..cf3f5c909d 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -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; } |
