From af37568a48e0bd396db634a63999b9624a1b793c Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Fri, 6 Jan 2017 13:35:40 +0100 Subject: [PATCH] bgpd: fix nexthop comparison for nexthop vpnv6 attribute As nexthop attribute for vpnv6 also contains a blank RD and a blank tag, the IPv6 address length increases from 16 to 24 bytes. The same was observed for vpnv4 nexthop, but was missing for VPNv6. The same is done for martian nexthop debugging. Signed-off-by: Philippe Guibert --- bgpd/bgp_mpath.c | 2 +- bgpd/bgp_route.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index c9af8419f2..dc8904ced2 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -113,7 +113,6 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2) ae2 = bi2->attr->extra; compare = IPV4_ADDR_CMP (&bi1->attr->nexthop, &bi2->attr->nexthop); - if (!compare && ae1 && ae2) { if (ae1->mp_nexthop_len == ae2->mp_nexthop_len) @@ -127,6 +126,7 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2) break; #ifdef HAVE_IPV6 case BGP_ATTR_NHLEN_IPV6_GLOBAL: + case BGP_ATTR_NHLEN_VPNV6_GLOBAL: compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_global, &ae2->mp_nexthop_global); break; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 0d4b1ae3ff..ae448d6ec5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2323,6 +2323,7 @@ bgp_update_martian_nexthop (struct bgp *bgp, afi_t afi, safi_t safi, struct attr #ifdef HAVE_IPV6 case BGP_ATTR_NHLEN_IPV6_GLOBAL: case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL: + case BGP_ATTR_NHLEN_VPNV6_GLOBAL: ret = (IN6_IS_ADDR_UNSPECIFIED(&attre->mp_nexthop_global) || IN6_IS_ADDR_LOOPBACK(&attre->mp_nexthop_global) || IN6_IS_ADDR_MULTICAST(&attre->mp_nexthop_global)); -- 2.39.5