diff options
author | Louis Scalbert <louis.scalbert@6wind.com> | 2022-05-05 18:46:35 +0200 |
---|---|---|
committer | Louis Scalbert <louis.scalbert@6wind.com> | 2022-07-11 16:08:37 +0200 |
commit | b3e97f087a9a3cb529745d28a928b5c68c7cf076 (patch) | |
tree | d0b495a7459013259f3897a1a88e4dd61e8188d2 /bgpd | |
parent | bgpd: rename "struct bgp" variables in mplsvpn (diff) | |
download | frr-b3e97f087a9a3cb529745d28a928b5c68c7cf076.tar.xz frr-b3e97f087a9a3cb529745d28a928b5c68c7cf076.zip |
bgpd: fix wrong nexthop bgp struct for nexthop validation
The bgp_nexthop must be the source bgp structure. It cannot be the
destination bgp one.
Use bgp_orig source bgp struct by default.
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_mplsvpn.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 0628c7132..52180b3e4 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -772,16 +772,19 @@ static bool leak_update_nexthop_valid(struct bgp *to_bgp, struct bgp_dest *bn, safi_t safi, struct bgp_path_info *source_bpi, struct bgp_path_info *bpi, + struct bgp *bgp_orig, const struct prefix *p, int debug) { struct bgp_path_info *bpi_ultimate; - struct bgp *bgp_nexthop = to_bgp; + struct bgp *bgp_nexthop; bool nh_valid; bpi_ultimate = bgp_get_imported_bpi_ultimate(source_bpi); if (bpi->extra && bpi->extra->bgp_orig) bgp_nexthop = bpi->extra->bgp_orig; + else + bgp_nexthop = bgp_orig; /* * No nexthop tracking for redistributed routes or for @@ -963,7 +966,8 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn, bgp_path_info_set_flag(bn, bpi, BGP_PATH_ANNC_NH_SELF); if (leak_update_nexthop_valid(to_bgp, bn, new_attr, afi, safi, - source_bpi, bpi, p, debug)) + source_bpi, bpi, bgp_orig, p, + debug)) bgp_path_info_set_flag(bn, bpi, BGP_PATH_VALID); else bgp_path_info_unset_flag(bn, bpi, BGP_PATH_VALID); @@ -1034,7 +1038,7 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn, new->extra->nexthop_orig = *nexthop_orig; if (leak_update_nexthop_valid(to_bgp, bn, new_attr, afi, safi, - source_bpi, new, p, debug)) + source_bpi, new, bgp_orig, p, debug)) bgp_path_info_set_flag(bn, new, BGP_PATH_VALID); else bgp_path_info_unset_flag(bn, new, BGP_PATH_VALID); |