From 322b87a6e1aac0914cc570977840d827dfe01e40 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 30090e0590b7..bc1b3f71d6df 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 && to->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;