From 42f9682c3a1a69b78398571d05daf663d35a629a Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Fri, 26 May 2023 09:24:27 +0200 Subject: [PATCH] bgpd: fix using bgp lu remote label when sending to ibgp peer When redistributing an advertisement from an EBGP peer to an IBGP peer, and the next-hop is kept unchanged, then the remote label should be used. Fix this by checking the 'NEXTHOP_SELF' flag in the ibgp peer. Fixes: cd1964ff38bd ("bgpd: labeled unicast processing") Signed-off-by: Philippe Guibert --- bgpd/bgp_label.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index 30090e0590b7..d719404e7e03 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -94,9 +94,10 @@ mpls_label_t bgp_adv_label(struct bgp_dest *dest, struct bgp_path_info *pi, reflect = ((from->sort == BGP_PEER_IBGP) && (to->sort == BGP_PEER_IBGP)); - if (reflect - && !CHECK_FLAG(to->af_flags[afi][safi], - PEER_FLAG_FORCE_NEXTHOP_SELF)) + if (reflect && + !CHECK_FLAG(to->af_flags[afi][safi], + PEER_FLAG_FORCE_NEXTHOP_SELF) && + !CHECK_FLAG(to->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) return remote_label; if (CHECK_FLAG(to->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))