summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-03-24 13:38:47 +0100
committerDonatas Abraitis <donatas@opensourcerouting.org>2023-03-24 13:42:38 +0100
commit6cddc4c866fb8fb397112e5a89c74a9ff6359981 (patch)
treeacf74b9c1cb94428595fc8c70eb369c0ad0be499 /bgpd/bgp_route.c
parentbgpd: Allow peering via 127.0.0.0/8 (diff)
downloadfrr-6cddc4c866fb8fb397112e5a89c74a9ff6359981.tar.xz
frr-6cddc4c866fb8fb397112e5a89c74a9ff6359981.zip
bgpd: Allow self next-hop if `bgp allow-martian-nexthop` is enabled
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>
Diffstat (limited to '')
-rw-r--r--bgpd/bgp_route.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 7365d5321..787aea168 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -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.