From 83b50eff9aeae7e3c4ef2aa001ddd310c983f0f0 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Wed, 1 Feb 2023 16:52:28 +0100 Subject: [PATCH] bgpd: remove ATTR_NEXT_HOP for redistributed ipv6 nexthops This commit addresses an issue with an MPLS VPN network redistributing static routes that are exported to the VPN, and where the labels are allocated per next-hop. For that purpose, the nexthop of the static routes is checked against the nexthop tracking. The validation of a valid nexthop will trigger the use of a unique label for all prefixes using that destination. However, the nexthop fails to be validated, with the following message: > evaluate_paths: prefix 172:31::14/128 (vrf vrf1), ignoring path due to > martian or self-next-hop The reason is due to the way the attr is created. By default, the ATTR_NEXTHOP attribute is set for all prefixes, whereas this flag should only be valid for IPv4. In the case there is an IPv6 nexthop, remove the ATTR_NEXTHOP flag. Signed-off-by: Philippe Guibert --- bgpd/bgp_route.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c60b55cf08..2d395538c0 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8676,6 +8676,9 @@ void bgp_redistribute_add(struct bgp *bgp, struct prefix *p, */ assert(attr.aspath); + if (p->family == AF_INET6) + UNSET_FLAG(attr.flag, ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)); + switch (nhtype) { case NEXTHOP_TYPE_IFINDEX: switch (p->family) { -- 2.39.5