]> git.puffer.fish Git - mirror/frr.git/commitdiff
nhrpd: Set correct prefix length in nhrp registration
authorAmol Lad <amol.lad@4rf.com>
Sat, 17 Oct 2020 05:32:19 +0000 (11:02 +0530)
committerReuben Dowle <reuben.dowle@4rf.com>
Wed, 16 Dec 2020 21:03:14 +0000 (10:03 +1300)
RFC2332 section 5.2.1 states (regarding the uniqueness bit) that:

       Note that when this bit is set in an NHRP Registration Request, only a
       single CIE may be specified in the NHRP Registration Request and that
       CIE must have the Prefix Length field set to 0xFF. the prefix length is
       the widest acceptable destination protocol address prefix. However, if
       "Uniqueness" bit is set  then it must be 255

This patch implements this requirement, which fixes interoperability with Cisco
NHRP hub routers.

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
nhrpd/nhrp_nhs.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 085cab3..3b60459
@@ -197,7 +197,8 @@ static int nhrp_reg_send_req(struct thread *t)
 
        /* FIXME: push CIE for each local protocol address */
        cie = nhrp_cie_push(zb, NHRP_CODE_SUCCESS, NULL, NULL);
-       cie->prefix_length = 0xff;
+       /* RFC2332 5.2.1 if unique is set then prefix length must be 0xff */
+       cie->prefix_length = (if_ad->flags & NHRP_IFF_REG_NO_UNIQUE) ? 8 * sockunion_get_addrlen(dst_proto) : 0xff;
        cie->holding_time = htons(if_ad->holdtime);
        cie->mtu = htons(if_ad->mtu);