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 <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2023-02-01 16:52:28 +01:00
parent 02a3c6bef7
commit f081a1924c

View File

@ -8666,6 +8666,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) {