]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: encode properly vpnv6 nexthop
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 23 Jan 2023 15:27:45 +0000 (16:27 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 23 Jan 2023 15:43:51 +0000 (16:43 +0100)
This change updates the nexthop attribute length
accordingly to the safi used. Actually, with the
previous commit, the length calculated was not
aligned with the real nexthop length. Such packet
received by remote peer was malformed, and this
was resulting in breaking vpnv6 peering.

Fix this by updating appropriately the real
nexthop length.

Fixes: 35ac9b53f2e2 ("bgpd: fix vpnv6 nexthop encoding")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_route.c

index 59d854495345285c479c9156580e563dabf4798a..3f07e53bb68684b928e873c0e1d6d8c3a60cd119 100644 (file)
@@ -2273,8 +2273,12 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
                        && peer->shared_network
                        && (from == bgp->peer_self
                            || peer->sort == BGP_PEER_EBGP))) {
-                       attr->mp_nexthop_len =
-                               BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
+                       if (safi == SAFI_MPLS_VPN)
+                               attr->mp_nexthop_len =
+                                       BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL;
+                       else
+                               attr->mp_nexthop_len =
+                                       BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
                }
 
                /* Clear off link-local nexthop in source, whenever it is not