Skip to content

Commit 6b72cc2

Browse files
authored
Merge pull request #12332 from FRRouting/mergify/bp/stable/8.4/pr-12309
bgpd: fix invalid ipv4-vpn nexthop for IPv6 peer (backport #12309)
2 parents 43b7aec + 8dff1be commit 6b72cc2

File tree

20 files changed

+346
-7
lines changed

20 files changed

+346
-7
lines changed

bgpd/bgp_attr.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3736,13 +3736,6 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi,
37363736
} break;
37373737
case SAFI_MPLS_VPN: {
37383738
if (attr->mp_nexthop_len
3739-
== BGP_ATTR_NHLEN_IPV6_GLOBAL) {
3740-
stream_putc(s, 24);
3741-
stream_putl(s, 0); /* RD = 0, per RFC */
3742-
stream_putl(s, 0);
3743-
stream_put(s, &attr->mp_nexthop_global,
3744-
IPV6_MAX_BYTELEN);
3745-
} else if (attr->mp_nexthop_len
37463739
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
37473740
stream_putc(s, 48);
37483741
stream_putl(s, 0); /* RD = 0, per RFC */
@@ -3753,6 +3746,12 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi,
37533746
stream_putl(s, 0);
37543747
stream_put(s, &attr->mp_nexthop_local,
37553748
IPV6_MAX_BYTELEN);
3749+
} else {
3750+
stream_putc(s, 24);
3751+
stream_putl(s, 0); /* RD = 0, per RFC */
3752+
stream_putl(s, 0);
3753+
stream_put(s, &attr->mp_nexthop_global,
3754+
IPV6_MAX_BYTELEN);
37563755
}
37573756
} break;
37583757
case SAFI_ENCAP:

tests/topotests/bgp_srv6l3vpn_over_ipv6/c11/bgpd.conf

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
!
2+
ip route 0.0.0.0/0 192.168.1.254
3+
ipv6 route ::/0 2001:1::ffff
4+
!
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
hostname c11
2+
!
3+
interface eth0
4+
ip address 192.168.1.1/24
5+
ipv6 address 2001:1::1/64
6+
!

tests/topotests/bgp_srv6l3vpn_over_ipv6/c12/bgpd.conf

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
!
2+
ip route 0.0.0.0/0 192.168.1.254
3+
ipv6 route ::/0 2001:1::ffff
4+
!
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
hostname c12
2+
!
3+
interface eth0
4+
ip address 192.168.1.1/24
5+
ipv6 address 2001:1::1/64
6+
!

tests/topotests/bgp_srv6l3vpn_over_ipv6/c21/bgpd.conf

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
!
2+
ip route 0.0.0.0/0 192.168.2.254
3+
ipv6 route ::/0 2001:2::ffff
4+
!
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
hostname c21
2+
!
3+
interface eth0
4+
ip address 192.168.2.1/24
5+
ipv6 address 2001:2::1/64
6+
!

0 commit comments

Comments
 (0)