From 02a82b47b3c74c1ab8d2ff8285723335955bc715 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Tue, 10 Oct 2017 10:00:10 -0400 Subject: [PATCH] bgpd: allow for vpn->vrf imports ignore nexthop checks for RFAPI imported routes (as is self) note: NHT is still updated Signed-off-by: Lou Berger --- bgpd/bgp_route.c | 9 ++++++--- bgpd/bgpd.h | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 6230560997..2753295f47 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2788,7 +2788,8 @@ int bgp_update(struct peer *peer, struct prefix *p, u_int32_t addpath_id, } /* next hop check. */ - if (bgp_update_martian_nexthop(bgp, afi, safi, &new_attr)) { + if (!CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD) && /* allow vpn->vrf import */ + bgp_update_martian_nexthop(bgp, afi, safi, &new_attr)) { reason = "martian or self next-hop;"; bgp_attr_flush(&new_attr); goto filtered; @@ -3031,7 +3032,8 @@ int bgp_update(struct peer *peer, struct prefix *p, u_int32_t addpath_id, connected = 0; if (bgp_find_or_add_nexthop(bgp, afi, ri, NULL, - connected)) + connected) || + CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD)) bgp_info_set_flag(rn, ri, BGP_INFO_VALID); else { if (BGP_DEBUG(nht, NHT)) { @@ -3143,7 +3145,8 @@ int bgp_update(struct peer *peer, struct prefix *p, u_int32_t addpath_id, else connected = 0; - if (bgp_find_or_add_nexthop(bgp, afi, new, NULL, connected)) + if (bgp_find_or_add_nexthop(bgp, afi, new, NULL, connected) || + CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD)) bgp_info_set_flag(rn, new, BGP_INFO_VALID); else { if (BGP_DEBUG(nht, NHT)) { diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 9c38a65b40..2fd1116c3c 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -699,9 +699,8 @@ struct peer { #define PEER_FLAG_DYNAMIC_NEIGHBOR (1 << 12) /* dynamic neighbor */ #define PEER_FLAG_CAPABILITY_ENHE (1 << 13) /* Extended next-hop (rfc 5549)*/ #define PEER_FLAG_IFPEER_V6ONLY (1 << 14) /* if-based peer is v6 only */ -#if ENABLE_BGP_VNC #define PEER_FLAG_IS_RFAPI_HD (1 << 15) /* attached to rfapi HD */ -#endif + /* outgoing message sent in CEASE_ADMIN_SHUTDOWN notify */ char *tx_shutdown_message; -- 2.39.5