]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Allow self next-hop if `bgp allow-martian-nexthop` is enabled
authorDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 24 Mar 2023 12:38:47 +0000 (14:38 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 24 Mar 2023 12:42:38 +0000 (14:42 +0200)
For instance, if we receive the routes from the peer with the next-hop as me,
but those routes shares the same network, we can fake the next-hop.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_route.c

index 7365d53212e0dce001229347331c22c09ea28417..787aea1689462aee49e83fb3eab428392ddf2059 100644 (file)
@@ -3830,6 +3830,12 @@ bool bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi,
                (type == ZEBRA_ROUTE_BGP && stype == BGP_ROUTE_STATIC) ? true
                                                                       : false;
 
+       /* If `bgp allow-martian-nexthop` is turned on, return next-hop
+        * as good.
+        */
+       if (bgp->allow_martian)
+               return false;
+
        /*
         * Only validated for unicast and multicast currently.
         * Also valid for EVPN where the nexthop is an IP address.