summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_zebra.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2023-03-02 20:20:39 -0300
committerRenato Westphal <renato@opensourcerouting.org>2023-03-02 19:38:03 -0300
commit6861a5e4628bf8b480b15ec77cf6a43b5d3aae0d (patch)
tree9d4f6e88b06fa5ff8debcc7f18ccf3b26723f83b /ospf6d/ospf6_zebra.c
parent73d9d322fe22c9e357fcc801562ab118f23c1969 (diff)
ospf6d: handle redistributed routes without nexthop addresses
Do not assume that all redistributed routes have a nexthop address, otherwise blackhole nexthops can be misinterpreted as IPv6 addresses, leading to inconsistencies. Also, change the signature of a few functions to allow const nexthop addresses, such that in6addr_any can be used without type casts. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_zebra.c')
-rw-r--r--ospf6d/ospf6_zebra.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index 6fe0a24926..0ccbb4d65d 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -252,7 +252,7 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS)
{
struct zapi_route api;
unsigned long ifindex;
- struct in6_addr *nexthop;
+ const struct in6_addr *nexthop = &in6addr_any;
struct ospf6 *ospf6;
struct prefix_ipv6 p;
@@ -272,7 +272,9 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS)
return 0;
ifindex = api.nexthops[0].ifindex;
- nexthop = &api.nexthops[0].gate.ipv6;
+ if (api.nexthops[0].type == NEXTHOP_TYPE_IPV6
+ || api.nexthops[0].type == NEXTHOP_TYPE_IPV6_IFINDEX)
+ nexthop = &api.nexthops[0].gate.ipv6;
if (IS_OSPF6_DEBUG_ZEBRA(RECV))
zlog_debug(