[quagga-users 14807] Re: IPv6 BGP routes from a directly connected peer are not accepted in the routing table
Matthias Ferdinand <mf-5+/[email protected]> Thu, 14 Sep 2017 23:03:07 +0200
| Newsgroups | gmane.network.quagga.user |
|---|---|
| Message-ID | <20170914210307.GW28721@xoff> |
> Hi! > > > ???I've got exactly the same problem (Quagga 1.2.1 on FreeBSD > > 11.1-BETA2): > > > > R2# sh bgp neighbors 2001:db8:23::3 received-routes > > BGP table version is 0, local router ID is 192.168.56.12 > > Status codes: s suppressed, d damped, h history, * valid, > best, = > > multipath, > > i internal, r RIB-failure, S Stale, R Removed > > Origin codes: i - IGP, e - EGP, ? - incomplete > > > > Network Next Hop Metric LocPrf Weight Path > > *> 2001:db8:3::/64 2001:db8:23::3 0 100 0 i > > *> 2001:db8:34::/64 2001:db8:23::3 0 100 0 i > > > > Total number of prefixes 2 > > R2# sh ipv6 bgp 2001:db8:34::/64 > > BGP routing table entry for 2001:db8:34::/64 > > Paths: (1 available, no best path) > > Not advertised to any peer > > Local > > 2001:db8:23::3 (inaccessible) from 2001:db8:23::3 (10.0.3.3) > > (fe80::5a9c:fcff:fe02:303) > > Origin IGP, metric 0, localpref 100, invalid, internal > > Last update: Fri Jun 23 17:55:43 2017 > > Please check, there's this well-known bug: > > https://bugzilla.quagga.net/show_bug.cgi?id=870 > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214481 Hi, not sure if this is the same as quagga bz#870 - I haven't (yet) seen OutQ stuck at >0. But I have encountered the same "inaccessible" ipv6 nexthops problem as above, but on Linux. Suspect log entries: 2017/09/14 21:06:28 [10070] BGP: bgp_ensure_nexthop: NHT could not ensure, failed to get rn! 2017/09/14 21:06:28 [10070] BGP: bgp_update_main(0.0.0.0): NH unresolved I could resolve that by comparing the bgp_ensure_nexthop() function in bgp/bgp_nht.c to the counterpart bgp_find_or_add_nexthop() function from FRR, and then cherrypicking something that seemed related to ipv6 link local nexthops. I don't claim to fully understand the code, and I hope I am not infringing on the copyright of the author of that code. Patch is attached. Regards Matthias _______________________________________________ Quagga-users mailing list Quagga-users-UOy77sIEA+cAd7ICUelF/[email protected] https://lists.quagga.net/mailman/listinfo/quagga-users
patch-bgpd-bgp_nth.c-quagga-1.2.1-bgp-ipv6-linklocal-nexthop
(text/plain, 1.4 KB)
--- a/bgpd/bgp_nht.c 2017-03-10 13:55:06.000000000 +0100
+++ b/bgpd/bgp_nht.c 2017-09-14 22:23:27.310570973 +0200
@@ -192,12 +192,44 @@ bgp_unlink_nexthop_by_peer (struct peer
bgp_unlink_nexthop_check (bnc);
}
+
+#define BGP_ATTR_NEXTHOP_AFI_IP6(attr) \
+ (! CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP)) && \
+ (attr)->extra && ((attr)->extra->mp_nexthop_len == 16 || \
+ (attr)->extra->mp_nexthop_len == 32))
+
int
bgp_ensure_nexthop (struct bgp_info *ri, struct peer *peer,
int connected)
{
struct bgp_node *rn;
struct bgp_nexthop_cache *bnc;
+ struct prefix p;
+ int is_bgp_static_route = 0;
+
+ afi_t afi = 0;
+
+ if (ri)
+ {
+ is_bgp_static_route = ((ri->type == ZEBRA_ROUTE_BGP) &&
+ (ri->sub_type == BGP_ROUTE_STATIC)) ? 1 : 0;
+
+ /* Since Extended Next-hop Encoding (RFC5549) support, we want to derive
+ address-family from the next-hop. */
+ if (!is_bgp_static_route)
+ afi = BGP_ATTR_NEXTHOP_AFI_IP6(ri->attr) ? AFI_IP6 : AFI_IP;
+
+ /* This will return TRUE if the global IPv6 NH is a link local addr */
+ if (make_prefix(afi, ri, &p) < 0)
+ return 1;
+ }
+ else if (peer)
+ {
+ /* Don't register link local NH */
+ if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&peer->su.sin6.sin6_addr))
+ return 1;
+ }
+
rn = bgp_get_nexthop_rn (ri, peer);