]> git.puffer.fish Git - mirror/frr.git/commit
bgpd: fix 6vpe nexthop 15368/head
authorLouis Scalbert <louis.scalbert@6wind.com>
Thu, 15 Feb 2024 12:28:02 +0000 (13:28 +0100)
committerLouis Scalbert <louis.scalbert@6wind.com>
Mon, 26 Feb 2024 09:17:08 +0000 (10:17 +0100)
commit0325116a27258e1df773a046e8668a029bead60c
treeadb753bfaf95d7ff0aca573cd9be4c3438bcf8e0
parent4d7df91752d7414d9719a361a2fd4cc30943dc96
bgpd: fix 6vpe nexthop

6vPE enables the announcement of IPv6 VPN prefixes through an IPv4 BGP
session. In this scenario, the next hop addresses for these prefixes are
represented in an IPv4-mapped IPv6 format, noted as ::ffff:[IPv4]. This
format indicates to the peer that it should route these IPv6 addresses
using information from the IPv4 nexthop. For example:

> Path Attribute - MP_REACH_NLRI
> [...]
>     Address family identifier (AFI): IPv6 (2)
>     Subsequent address family identifier (SAFI): Labeled VPN Unicast (128)
>     Next hop:  RD=0:0 IPv6=::ffff:192.0.2.5 RD=0:0 Link-local=fe80::501d:42ff:feef:b021
>     Number of Subnetwork points of attachment (SNPA): 0

This rule is set out in RFC4798:

> The IPv4 address of the egress 6PE router MUST be encoded as an
> IPv4-mapped IPv6 address in the BGP Next Hop field.

However, in some situations, bgpd sends a standard nexthop IPv6 address
instead of an IPv4-mapped IPv6 address because the outgoing interface for
the BGP session has a valid IPv6 address. This is problematic because
the peer router may not be able to route the nexthop IPv6 address (ie.
if the outgoing interface has not IPv6).

Fix the issue by always sending a IPv4-mapped IPv6 address as nexthop
when the BGP session is on IPv4 and address family IPv6.

Link: https://datatracker.ietf.org/doc/html/rfc4798#section-2
Fixes: 92d6f76 ("lib,zebra,bgpd: Fix for nexthop as IPv4 mapped IPv6 address")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
bgpd/bgp_updgrp_packet.c