summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_route.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2021-08-19 04:07:10 +0200
committerRenato Westphal <renato@opensourcerouting.org>2021-08-24 16:53:36 +0200
commit9142948e39f331231d05e68306c94a51db36c820 (patch)
treee933dc5589ecc08aafe604ac7c6ec0862bc0a322 /ospf6d/ospf6_route.c
parentospf6d: remove incorrect debug guard (diff)
downloadfrr-9142948e39f331231d05e68306c94a51db36c820.tar.xz
frr-9142948e39f331231d05e68306c94a51db36c820.zip
ospf6d: fix logging of border router routes
The prefix of routes to border routers consists of two pieces of information embedded in a single struct (prefix.u.lp): struct prefix { uint8_t family; uint16_t prefixlen; union { [snip] struct { struct in_addr id; struct in_addr adv_router; } lp; } u __attribute__((aligned(8))); }; As such, using prefix2str() (or the %pFX format specifier) isn't correct when logging such routes. This commit adds a few special cases here and there to handle OSPF6_DEST_TYPE_ROUTER routes differently. It'd probably be a good idea to add a helper function to handle all cases in a single place, but that can be left for a second moment. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_route.c')
-rw-r--r--ospf6d/ospf6_route.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index cd3139d28..13003b415 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -667,6 +667,9 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
if (route->type == OSPF6_DEST_TYPE_LINKSTATE)
ospf6_linkstate_prefix2str(&route->prefix, buf, sizeof(buf));
+ else if (route->type == OSPF6_DEST_TYPE_ROUTER)
+ inet_ntop(AF_INET, &ADV_ROUTER_IN_PREFIX(&route->prefix), buf,
+ sizeof(buf));
else
prefix2str(&route->prefix, buf, sizeof(buf));
@@ -899,6 +902,9 @@ void ospf6_route_remove(struct ospf6_route *route,
if (route->type == OSPF6_DEST_TYPE_LINKSTATE)
ospf6_linkstate_prefix2str(&route->prefix, buf, sizeof(buf));
+ else if (route->type == OSPF6_DEST_TYPE_ROUTER)
+ inet_ntop(AF_INET, &ADV_ROUTER_IN_PREFIX(&route->prefix), buf,
+ sizeof(buf));
else
prefix2str(&route->prefix, buf, sizeof(buf));