-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bgpd: fix 6vpe nexthop #15368
Merged
Merged
bgpd: fix 6vpe nexthop #15368
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ipv6 route fd00:200::/64 fd00:100::2 | ||
interface eth-pe1 | ||
ipv6 address fd00:100::1/64 | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ipv6 route fd00:100::/64 fd00:200::5 | ||
interface eth-pe2 | ||
ipv6 address fd00:200::6/64 | ||
ipv6 address fd00:201::6/64 | ||
ipv6 address fd00:300::6/64 | ||
ipv6 address fd00:400::6/64 | ||
ipv6 address fd01:200::6/64 | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"ipv6Vpn": { | ||
"routerId": "198.51.100.2", | ||
"as": 65500, | ||
"peers": { | ||
"192.0.2.5": { | ||
"remoteAs": 65501, | ||
"state": "Established", | ||
"peerState": "OK" | ||
} | ||
} | ||
} | ||
} |
116 changes: 116 additions & 0 deletions
116
tests/topotests/bgp_6vpe_ebgp_topo1/pe1/bgp_vrf_ipv6.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"vrfName": "vrf1", | ||
"routerId": "198.51.100.2", | ||
"defaultLocPrf": 100, | ||
"localAS": 65500, | ||
"routes": { | ||
"fd00:100::/64": [ | ||
{ | ||
"valid": true, | ||
"bestpath": true, | ||
"network": "fd00:100::/64", | ||
"metric": 0, | ||
"weight": 32768, | ||
"path": "", | ||
"nexthops": [ | ||
{ | ||
"ip": "::", | ||
"afi": "ipv6", | ||
"scope": "global", | ||
"used": true | ||
} | ||
] | ||
} | ||
], | ||
"fd00:200::/64": [ | ||
{ | ||
"valid": true, | ||
"bestpath": true, | ||
"network": "fd00:200::/64", | ||
"metric": 0, | ||
"weight": 0, | ||
"path": "65501", | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
"afi": "ipv6", | ||
"scope": "global", | ||
"used": true | ||
} | ||
] | ||
} | ||
], | ||
"fd00:201::/64": [ | ||
{ | ||
"valid": true, | ||
"bestpath": true, | ||
"network": "fd00:201::/64", | ||
"metric": 0, | ||
"weight": 0, | ||
"path": "65501", | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
"afi": "ipv6", | ||
"scope": "global", | ||
"used": true | ||
} | ||
] | ||
} | ||
], | ||
"fd00:300::/64": [ | ||
{ | ||
"valid": true, | ||
"bestpath": true, | ||
"network": "fd00:300::/64", | ||
"metric": 0, | ||
"weight": 0, | ||
"path": "65501", | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
"afi": "ipv6", | ||
"scope": "global", | ||
"used": true | ||
} | ||
] | ||
} | ||
], | ||
"fd00:400::/64": [ | ||
{ | ||
"valid": true, | ||
"bestpath": true, | ||
"network": "fd00:400::/64", | ||
"metric": 0, | ||
"weight": 0, | ||
"path": "65501", | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
"afi": "ipv6", | ||
"scope": "global", | ||
"used": true | ||
} | ||
] | ||
} | ||
], | ||
"fd01:200::/64": [ | ||
{ | ||
"valid": true, | ||
"bestpath": true, | ||
"network": "fd01:200::/64", | ||
"metric": 0, | ||
"weight": 0, | ||
"path": "65501", | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
"afi": "ipv6", | ||
"scope": "global", | ||
"used": true | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
! | ||
!debug bgp zebra | ||
router bgp 65500 | ||
bgp router-id 198.51.100.2 | ||
no bgp ebgp-requires-policy | ||
neighbor 192.0.2.5 remote-as 65501 | ||
neighbor 192.0.2.5 capability extended-nexthop | ||
address-family ipv4 unicast | ||
no neighbor 192.0.2.5 activate | ||
exit-address-family | ||
address-family ipv6 vpn | ||
neighbor 192.0.2.5 activate | ||
neighbor 192.0.2.5 route-map rmap in | ||
exit-address-family | ||
exit | ||
router bgp 65500 vrf vrf1 | ||
bgp router-id 198.51.100.2 | ||
address-family ipv6 unicast | ||
redistribute connected | ||
label vpn export 101 | ||
rd vpn export 444:1 | ||
rt vpn both 52:100 | ||
export vpn | ||
import vpn | ||
exit-address-family | ||
! | ||
interface eth-pe2 | ||
mpls bgp forwarding | ||
! | ||
route-map rmap permit 1 | ||
set ipv6 next-hop prefer-global | ||
! |
142 changes: 142 additions & 0 deletions
142
tests/topotests/bgp_6vpe_ebgp_topo1/pe1/ipv6_routes_vrf.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
"fd00:100::/64": [ | ||
{ | ||
"prefix": "fd00:100::/64", | ||
"protocol": "connected", | ||
"vrfName": "vrf1", | ||
"selected": true, | ||
"destSelected": true, | ||
"distance": 0, | ||
"metric": 0, | ||
"installed": true, | ||
"nexthops": [ | ||
{ | ||
"fib": true, | ||
"directlyConnected": true, | ||
"interfaceName": "eth-h1", | ||
"active": true | ||
} | ||
] | ||
} | ||
], | ||
"fd00:200::/64": [ | ||
{ | ||
"prefix": "fd00:200::/64", | ||
"protocol": "bgp", | ||
"vrfName": "vrf1", | ||
"selected": true, | ||
"destSelected": true, | ||
"distance": 20, | ||
"metric": 0, | ||
"installed": true, | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
"afi": "ipv6", | ||
"vrf": "default", | ||
"active": true, | ||
"labels": [ | ||
102 | ||
], | ||
"weight": 1 | ||
} | ||
] | ||
} | ||
], | ||
"fd00:201::/64": [ | ||
{ | ||
"prefix": "fd00:201::/64", | ||
"protocol": "bgp", | ||
"vrfName": "vrf1", | ||
"selected": true, | ||
"destSelected": true, | ||
"distance": 20, | ||
"metric": 0, | ||
"installed": true, | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
"afi": "ipv6", | ||
"vrf": "default", | ||
"active": true, | ||
"labels": [ | ||
102 | ||
], | ||
"weight": 1 | ||
} | ||
] | ||
} | ||
], | ||
"fd00:300::/64": [ | ||
{ | ||
"prefix": "fd00:300::/64", | ||
"protocol": "bgp", | ||
"vrfName": "vrf1", | ||
"selected": true, | ||
"destSelected": true, | ||
"distance": 20, | ||
"metric": 0, | ||
"installed": true, | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
"afi": "ipv6", | ||
"vrf": "default", | ||
"active": true, | ||
"labels": [ | ||
102 | ||
], | ||
"weight": 1 | ||
} | ||
] | ||
} | ||
], | ||
"fd00:400::/64": [ | ||
{ | ||
"prefix": "fd00:400::/64", | ||
"protocol": "bgp", | ||
"vrfName": "vrf1", | ||
"selected": true, | ||
"destSelected": true, | ||
"distance": 20, | ||
"metric": 0, | ||
"installed": true, | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
ton31337 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"afi": "ipv6", | ||
"vrf": "default", | ||
"active": true, | ||
"labels": [ | ||
102 | ||
], | ||
"weight": 1 | ||
} | ||
] | ||
} | ||
], | ||
"fd01:200::/64": [ | ||
{ | ||
"prefix": "fd01:200::/64", | ||
"protocol": "bgp", | ||
"vrfName": "vrf1", | ||
"selected": true, | ||
"destSelected": true, | ||
"distance": 20, | ||
"metric": 0, | ||
"installed": true, | ||
"nexthops": [ | ||
{ | ||
"ip": "::ffff:c000:205", | ||
"afi": "ipv6", | ||
"vrf": "default", | ||
"active": true, | ||
"labels": [ | ||
102 | ||
], | ||
"weight": 1 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
! | ||
interface lo | ||
ip router isis 1 | ||
isis hello-interval 1 | ||
isis hello-multiplier 3 | ||
! | ||
interface eth-pe2 | ||
ip router isis 1 | ||
isis hello-interval 1 | ||
isis hello-multiplier 3 | ||
! | ||
router isis 1 | ||
net 49.0000.0007.e901.2222.00 | ||
is-type level-1 | ||
lsp-gen-interval 1 | ||
mpls-te on | ||
mpls-te router-address 198.51.100.2 | ||
segment-routing on | ||
segment-routing node-msd 8 | ||
segment-routing global-block 1000 10000 local-block 30000 30999 | ||
segment-routing prefix 198.51.100.2/32 index 22 | ||
! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
! | ||
interface eth-h1 | ||
ipv6 address fd00:100::2/64 | ||
! | ||
interface eth-pe2 | ||
ip address 192.0.2.2/24 | ||
ipv6 address ::ffff:192.0.2.2/120 | ||
! | ||
interface lo | ||
ip address 198.51.100.2/32 | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"ipv6Vpn": { | ||
"routerId": "198.51.100.5", | ||
"as": 65501, | ||
"peers": { | ||
"192.0.2.2": { | ||
"remoteAs": 65500, | ||
"state": "Established", | ||
"peerState": "OK" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it only be
(IN6_IS_ADDR_UNSPECIFIED(mod_v6nhg) && (peer->connection->su.sa.sa_family == AF_INET && paf->afi == AFI_IP6)))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it is correct.
When it is an IPv6 prefix over an IPv4 BGP session and the outgoing interface to the peer has a standard IPv6 address,
mod_v6nhg
contains this standard IPv6 address.IN6_IS_ADDR_UNSPECIFIED(mod_v6nhg)
is for the case of an IPv4 prefix over an IPv6 unnumbered BGP session. Seetests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_unnumbered_nbr.py
->def bgp_prefix_received_v4_mapped_v6_nh(router)