summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2022-11-07 14:44:49 +0100
committerDmytro Shytyi <dmytro.shytyi@6wind.com>2024-06-07 12:33:47 +0200
commit449e80ab743fa51ee60f8f7c535fa952f965fc5b (patch)
treee848e4450faf89ad553101f5ae219b08ed024a9e
parenteb10a69766c68cd302f820b8c54988a46da6259e (diff)
bgpd: to select bgp self peer prefix on rr case with bgp-lu
This commit addresses an issue that happens when using bgp labeled unicast peering with a rr client, with a received prefix which is the local ip address of the bgp session. When using bgp ipv4 labeled session, the local prefix is received by a peer, and finds out that the proposed prefix and its next-hop are the same. To avoid a route loop locally, no nexthop entry is referenced for that prefix, and the route will not be selected. As it has been done for ipv4-unicast, apply the following fix for labeled address families: when the received peer is a route reflector, the prefix has to be selected, even if the route can not be installed locally. Fixes: f874552557cf ("bgpd: authorise to select bgp self peer prefix on rr case") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
-rw-r--r--bgpd/bgp_route.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 94c21e1861..e1cc62ef00 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -4638,7 +4638,22 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (aspath_get_last_as(attr->aspath) == bgp->as)
do_loop_check = 0;
- if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
+ /* When using bgp ipv4 labeled session, the local prefix is
+ * received by a peer, and finds out that the proposed prefix
+ * and its next-hop are the same. To avoid a route loop locally,
+ * no nexthop entry is referenced for that prefix, and the route
+ * will not be selected.
+ *
+ * As it has been done for ipv4-unicast, apply the following fix
+ * for labeled address families: when the received peer is
+ * a route reflector, the prefix has to be selected, even if the
+ * route can not be installed locally.
+ */
+ if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT) ||
+ (safi == SAFI_UNICAST && !peer->afc[afi][safi] &&
+ peer->afc[afi][SAFI_LABELED_UNICAST] &&
+ CHECK_FLAG(peer->af_flags[afi][SAFI_LABELED_UNICAST],
+ PEER_FLAG_REFLECTOR_CLIENT)))
bgp_nht_param_prefix = NULL;
else
bgp_nht_param_prefix = p;