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: f874552557 ("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>
This commit is contained in:
Philippe Guibert 2022-11-07 14:44:49 +01:00 committed by Dmytro Shytyi
parent eb10a69766
commit 449e80ab74

View File

@ -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;