From 1fe560a0477ebd29097647c8dd4fea88bf1886ca 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index 0f3faeb29759..6835ad9d25c9 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -99,6 +99,10 @@ mpls_label_t bgp_adv_label(struct bgp_dest *dest, struct bgp_path_info *pi, PEER_FLAG_FORCE_NEXTHOP_SELF)) return remote_label; + if (from->sort == BGP_PEER_IBGP && + !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)) return remote_label;