From: Donatas Abraitis Date: Mon, 25 May 2020 14:22:37 +0000 (+0300) Subject: bgpd: Use IPv6 LL address as nexthop if global was set to ::/LL X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=887c806529683f3e4cc36795fca4587af5279baa;p=matthieu%2Ffrr.git bgpd: Use IPv6 LL address as nexthop if global was set to ::/LL This happens between Bird and FRR. Maybe others as well, dunno. Bird sends ::(fe80::1588) and we have a nexthop as :: which is inaccessible: ``` BGP routing table entry for fdff:b87d:f5b0::/48 Paths: (1 available, no best path) Not advertised to any peer 4242421588 4242422547 4242422601 4242423605 :: (inaccessible) from fe80::1588 (172.20.16.140) (fe80::1588) (used) Origin IGP, invalid, external Last update: Mon May 25 14:27:02 2020 ``` bgpd[9554]: fe80::1588 went from OpenConfirm to Established bgpd[9554]: fe80::1588 [FSM] Timer (routeadv timer expire) bgpd[9554]: fe80::1588 rcvd UPDATE w/ attr: , origin i, mp_nexthop ::(fe80::1588) bgpd[9554]: fe80::1588 rcvd UPDATE wlen 0 attrlen 120 alen 0 bgpd[9554]: fe80::1588 rcvd fda9:26a9:1c47:2d42::/64 IPv6 unicast bgpd[9554]: Allocated bnc ::/128(VRF default) peer 0x0 bgpd[9554]: bgp_update(0.0.0.0): NH unresolved bgpd[9554]: fe80::1588 rcvd fda9:26a9:1c47:d42::/64 IPv6 unicast Signed-off-by: Donatas Abraitis --- diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index e9496e47a9..c9619b930d 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -552,7 +552,18 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p) p->u.prefix6 = pi->net->p.u.prefix6; p->prefixlen = pi->net->p.prefixlen; } else { - p->u.prefix6 = pi->attr->mp_nexthop_global; + /* If we receive MP_REACH nexthop with ::(LL) + * or LL(LL), use LL address as nexthop cache. + */ + if (pi->attr->mp_nexthop_len + == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL + && (IN6_IS_ADDR_UNSPECIFIED( + &pi->attr->mp_nexthop_global) + || IN6_IS_ADDR_LINKLOCAL( + &pi->attr->mp_nexthop_global))) + p->u.prefix6 = pi->attr->mp_nexthop_local; + else + p->u.prefix6 = pi->attr->mp_nexthop_global; p->prefixlen = IPV6_MAX_BITLEN; } break;