diff options
| author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2020-04-21 23:16:03 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-21 23:16:03 +0300 |
| commit | 4c60e50f7f22874ab994cda3edc9b09b46948ce4 (patch) | |
| tree | a8ba75449de5e0cb0550168a130648f5c67fb007 | |
| parent | bda96cdd33efe766703d7428a08ecf15e619996f (diff) | |
| parent | e7cbe5e5997994d071e00e96d3cb858a4244d63a (diff) | |
Merge pull request #6191 from NaveenThanikachalam/ibgp_connected
bgpd: Enforce self-next-hop check in next-hop update.
| -rw-r--r-- | bgpd/bgp_nht.c | 12 | ||||
| -rw-r--r-- | bgpd/bgp_route.c | 6 | ||||
| -rw-r--r-- | bgpd/bgp_route.h | 3 |
3 files changed, 16 insertions, 5 deletions
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 0531542a38..1af9be46f1 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -745,8 +745,16 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc) bnc_is_valid_nexthop = bgp_isvalid_labeled_nexthop(bnc) ? 1 : 0; } else { - bnc_is_valid_nexthop = - bgp_isvalid_nexthop(bnc) ? 1 : 0; + if (bgp_update_martian_nexthop( + bnc->bgp, afi, safi, path->type, + path->sub_type, path->attr, rn)) { + if (BGP_DEBUG(nht, NHT)) + zlog_debug( + "%s: prefix %pRN (vrf %s), ignoring path due to martian or self-next-hop", + __func__, rn, bgp_path->name); + } else + bnc_is_valid_nexthop = + bgp_isvalid_nexthop(bnc) ? 1 : 0; } if (BGP_DEBUG(nht, NHT)) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 09eb6fcf82..18343231b5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3234,9 +3234,9 @@ static bool overlay_index_equal(afi_t afi, struct bgp_path_info *path, } /* Check if received nexthop is valid or not. */ -static bool bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, - uint8_t type, uint8_t stype, - struct attr *attr, struct bgp_node *rn) +bool bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, + uint8_t type, uint8_t stype, struct attr *attr, + struct bgp_node *rn) { bool ret = false; diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index ad08bbf440..7532dc123a 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -677,4 +677,7 @@ extern int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi, enum bgp_show_type type, void *output_arg, bool use_json); extern int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi); +extern bool bgp_update_martian_nexthop(struct bgp *bgp, afi_t afi, safi_t safi, + uint8_t type, uint8_t stype, + struct attr *attr, struct bgp_node *rn); #endif /* _QUAGGA_BGP_ROUTE_H */ |
