Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: Enforce self-next-hop check in next-hop update. #6191

Merged
merged 1 commit into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions bgpd/bgp_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -3226,9 +3226,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 = 0;

Expand Down
3 changes: 3 additions & 0 deletions bgpd/bgp_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */