From a581473fbde8e790e74ce64ec2c39d37190113c8 Mon Sep 17 00:00:00 2001 From: ckishimo Date: Tue, 9 Nov 2021 00:25:06 +0100 Subject: [PATCH] ospf6d: check N-bit set in Hello packet RFC 3101 states both E-bit and N-bit need to be checked when receiving a Hello packet. "To support the NSSA option an additional check must be made in the function that handles the receiving of the Hello packet to verify that both the N-bit and the E-bit found in the Hello packet's option field match the area type and ExternalRoutingCapability of the area of the receiving interface." This PR adds the check for the N-bit Signed-off-by: ckishimo --- ospf6d/ospf6_message.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 9238b81c5f..352cb137ed 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -431,6 +431,14 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst, return; } + /* N-bit check */ + if (OSPF6_OPT_ISSET(hello->options, OSPF6_OPT_N) + != OSPF6_OPT_ISSET(oi->area->options, OSPF6_OPT_N)) { + zlog_warn("VRF %s: IF %s N-bit mismatch", + oi->interface->vrf->name, oi->interface->name); + return; + } + /* Find neighbor, create if not exist */ on = ospf6_neighbor_lookup(oh->router_id, oi); if (on == NULL) { -- 2.39.5