]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Do not send next-hop as :: in MP_REACH_NLRI if no link-local exists
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Fri, 6 Sep 2019 09:12:23 +0000 (12:12 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Tue, 29 Oct 2019 13:42:33 +0000 (15:42 +0200)
This is the unusual case when you have global IPv6 address and no link-local
on interface attached. Like here:

eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
 link/ether 08:00:27:65:c6:82 brd ff:ff:ff:ff:ff:ff
 inet6 2a02:4780:face::1/64 scope global
    valid_lft forever preferred_lft forever

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
bgpd/bgp_route.c

index 984fc512abdb1fcb0c8f5ed4581a4ca01115b0a1..ee5f41d165d125e5d8a36a243afc1a8f6da9cea0 100644 (file)
@@ -1708,18 +1708,22 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi,
         * if
         * the peer (group) is configured to receive link-local nexthop
         * unchanged
-        * and it is available in the prefix OR we're not reflecting the route
-        * and
+        * and it is available in the prefix OR we're not reflecting the route,
+        * link-local nexthop address is valid and
         * the peer (group) to whom we're going to announce is on a shared
         * network
         * and this is either a self-originated route or the peer is EBGP.
+        * By checking if nexthop LL address is valid we are sure that
+        * we do not announce LL address as `::`.
         */
        if (NEXTHOP_IS_V6) {
                attr->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
                if ((CHECK_FLAG(peer->af_flags[afi][safi],
                                PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED)
                     && IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_local))
-                   || (!reflect && peer->shared_network
+                   || (!reflect
+                       && IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_local)
+                       && peer->shared_network
                        && (from == bgp->peer_self
                            || peer->sort == BGP_PEER_EBGP))) {
                        attr->mp_nexthop_len =