-
Notifications
You must be signed in to change notification settings - Fork 1.5k
SRv6 BGP SID reachability #14810
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
Merged
riw777
merged 4 commits into
FRRouting:master
from
dmytroshytyi:srv6_bgp_sid_reachability
Feb 27, 2024
Merged
SRv6 BGP SID reachability #14810
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f49fc76
doc: bgp ipv4 l3vpn sid reachability
dmytroshytyi 26c747e
bgpd: extend make_prefix to form srv6-based prefix
dmytroshytyi b3ac502
bgpd: srv6 sid reachability verification
dmytroshytyi 5101463
tests: an srv6 sid reachability use-case
dmytroshytyi 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 hidden or 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 |
|---|---|---|
|
|
@@ -116,24 +116,36 @@ static int bgp_isvalid_nexthop_for_mplsovergre(struct bgp_nexthop_cache *bnc, | |
| static int bgp_isvalid_nexthop_for_mpls(struct bgp_nexthop_cache *bnc, | ||
| struct bgp_path_info *path) | ||
| { | ||
| return (bnc && (bnc->nexthop_num > 0 && | ||
| (CHECK_FLAG(path->flags, BGP_PATH_ACCEPT_OWN) || | ||
| CHECK_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID) || | ||
| bgp_isvalid_nexthop_for_ebgp(bnc, path) || | ||
| bgp_isvalid_nexthop_for_mplsovergre(bnc, path)))); | ||
| } | ||
|
|
||
| static bool bgp_isvalid_nexthop_for_l3vpn(struct bgp_nexthop_cache *bnc, | ||
| struct bgp_path_info *path) | ||
| { | ||
| if (bgp_zebra_num_connects() == 0) | ||
| return 1; | ||
|
|
||
| if (path->attr->srv6_l3vpn || path->attr->srv6_vpn) { | ||
| /* In the case of SRv6-VPN, we need to track the reachability to the | ||
| * SID (in other words, IPv6 address). We check that the SID is | ||
| * available in the BGP update; then if it is available, we check | ||
| * for the nexthop reachability. | ||
| */ | ||
| if (bnc && (bnc->nexthop_num > 0 && bgp_isvalid_nexthop(bnc))) | ||
| return 1; | ||
| return 0; | ||
| } | ||
| /* | ||
| * - In the case of MPLS-VPN, the label is learned from LDP or other | ||
| * In the case of MPLS-VPN, the label is learned from LDP or other | ||
| * protocols, and nexthop tracking is enabled for the label. | ||
| * The value is recorded as BGP_NEXTHOP_LABELED_VALID. | ||
| * - In the case of SRv6-VPN, we need to track the reachability to the | ||
| * SID (in other words, IPv6 address). As in MPLS, we need to record | ||
| * the value as BGP_NEXTHOP_SID_VALID. However, this function is | ||
| * currently not implemented, and this function assumes that all | ||
| * Transit routes for SRv6-VPN are valid. | ||
| * - Otherwise check for mpls-gre acceptance | ||
| */ | ||
| return (bgp_zebra_num_connects() == 0 || | ||
| (bnc && (bnc->nexthop_num > 0 && | ||
| (CHECK_FLAG(path->flags, BGP_PATH_ACCEPT_OWN) || | ||
| CHECK_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID) || | ||
| bnc->bgp->srv6_enabled || | ||
| bgp_isvalid_nexthop_for_ebgp(bnc, path) || | ||
| bgp_isvalid_nexthop_for_mplsovergre(bnc, path))))); | ||
| return bgp_isvalid_nexthop_for_mpls(bnc, path); | ||
| } | ||
|
|
||
| static void bgp_unlink_nexthop_check(struct bgp_nexthop_cache *bnc) | ||
|
|
@@ -496,7 +508,7 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop, | |
| else if (safi == SAFI_UNICAST && pi && | ||
| pi->sub_type == BGP_ROUTE_IMPORTED && pi->extra && | ||
| pi->extra->num_labels && !bnc->is_evpn_gwip_nexthop) | ||
| return bgp_isvalid_nexthop_for_mpls(bnc, pi); | ||
| return bgp_isvalid_nexthop_for_l3vpn(bnc, pi); | ||
| else if (safi == SAFI_MPLS_VPN && pi && | ||
| pi->sub_type != BGP_ROUTE_IMPORTED) | ||
| /* avoid not redistributing mpls vpn routes */ | ||
|
|
@@ -1045,8 +1057,11 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p) | |
| break; | ||
| case AFI_IP6: | ||
| p->family = AF_INET6; | ||
|
|
||
| if (is_bgp_static) { | ||
| if (pi->attr && pi->attr->srv6_l3vpn) { | ||
| IPV6_ADDR_COPY(&(p->u.prefix6), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to check for pi != NULL. it is alread done above.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks fixed. |
||
| &(pi->attr->srv6_l3vpn->sid)); | ||
| p->prefixlen = IPV6_MAX_BITLEN; | ||
| } else if (is_bgp_static) { | ||
| p->u.prefix6 = p_orig->u.prefix6; | ||
| p->prefixlen = p_orig->prefixlen; | ||
| } else { | ||
|
|
@@ -1294,8 +1309,9 @@ void evaluate_paths(struct bgp_nexthop_cache *bnc) | |
| && (path->attr->evpn_overlay.type | ||
| != OVERLAY_INDEX_GATEWAY_IP)) { | ||
| bnc_is_valid_nexthop = | ||
| bgp_isvalid_nexthop_for_mpls(bnc, path) ? true | ||
| : false; | ||
| bgp_isvalid_nexthop_for_l3vpn(bnc, path) | ||
| ? true | ||
| : false; | ||
| } else if (safi == SAFI_MPLS_VPN && | ||
| path->sub_type != BGP_ROUTE_IMPORTED) { | ||
| /* avoid not redistributing mpls vpn routes */ | ||
|
|
||
This file contains hidden or 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 hidden or 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 @@ | ||
| ! | ||
| ip route 0.0.0.0/0 192.168.1.254 | ||
| ipv6 route ::/0 2001:1::ffff | ||
| ! |
This file contains hidden or 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,6 @@ | ||
| hostname c11 | ||
| ! | ||
| interface eth0 | ||
| ip address 192.168.1.1/24 | ||
| ipv6 address 2001:1::1/64 | ||
| ! |
Empty file.
This file contains hidden or 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 @@ | ||
| ! | ||
| ip route 0.0.0.0/0 192.168.1.254 | ||
| ipv6 route ::/0 2001:1::ffff | ||
| ! |
This file contains hidden or 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,6 @@ | ||
| hostname c12 | ||
| ! | ||
| interface eth0 | ||
| ip address 192.168.1.1/24 | ||
| ipv6 address 2001:1::1/64 | ||
| ! |
Empty file.
This file contains hidden or 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 @@ | ||
| ! | ||
| ip route 0.0.0.0/0 192.168.2.254 | ||
| ipv6 route ::/0 2001:2::ffff | ||
| ! |
This file contains hidden or 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,6 @@ | ||
| hostname c21 | ||
| ! | ||
| interface eth0 | ||
| ip address 192.168.2.1/24 | ||
| ipv6 address 2001:2::1/64 | ||
| ! |
Empty file.
This file contains hidden or 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,5 @@ | ||
|
|
||
| ! | ||
| ip route 0.0.0.0/0 192.168.2.254 | ||
| ipv6 route ::/0 2001:2::ffff | ||
| ! |
This file contains hidden or 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,9 @@ | ||
| hostname c22 | ||
| ! | ||
| interface eth0 | ||
| ip address 192.168.2.1/24 | ||
| ipv6 address 2001:2::1/64 | ||
| ! | ||
| ip route 0.0.0.0/0 192.168.2.254 | ||
| ipv6 route ::/0 2001:2::ffff | ||
| ! |
Empty file.
This file contains hidden or 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 @@ | ||
| ! | ||
| ip route 0.0.0.0/0 192.168.3.254 | ||
| ipv6 route ::/0 2001:3::ffff | ||
| ! |
This file contains hidden or 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,6 @@ | ||
| hostname c31 | ||
| ! | ||
| interface eth0 | ||
| ip address 192.168.3.1/24 | ||
| ipv6 address 2001:3::1/64 | ||
| ! |
Empty file.
This file contains hidden or 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 @@ | ||
| ! | ||
| ip route 0.0.0.0/0 192.168.3.254 | ||
| ipv6 route ::/0 2001:3::ffff | ||
| ! |
This file contains hidden or 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,6 @@ | ||
| hostname c32 | ||
| ! | ||
| interface eth0 | ||
| ip address 192.168.3.1/24 | ||
| ipv6 address 2001:3::1/64 | ||
| ! |
This file contains hidden or 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,61 @@ | ||
| frr defaults traditional | ||
| ! | ||
| hostname r1 | ||
| password zebra | ||
| ! | ||
| log commands | ||
| ! | ||
| router bgp 65001 | ||
| bgp router-id 192.0.2.1 | ||
| no bgp ebgp-requires-policy | ||
| no bgp default ipv4-unicast | ||
| neighbor 2001:db8:12::2 remote-as 65002 | ||
| neighbor 2001:db8:12::2 timers 3 10 | ||
| neighbor 2001:db8:12::2 timers connect 1 | ||
| neighbor 2001:db8:12::2 capability extended-nexthop | ||
| neighbor 2001:db8:13::3 remote-as 65001 | ||
| neighbor 2001:db8:13::3 timers 3 10 | ||
| neighbor 2001:db8:13::3 timers connect 1 | ||
| neighbor 2001:db8:13::3 capability extended-nexthop | ||
| ! | ||
| segment-routing srv6 | ||
| locator default | ||
| ! | ||
| address-family ipv4 vpn | ||
| neighbor 2001:db8:12::2 activate | ||
| neighbor 2001:db8:13::3 activate | ||
| exit-address-family | ||
| ! | ||
| ! | ||
| router bgp 65001 vrf vrf10 | ||
| bgp router-id 192.0.2.1 | ||
| ! | ||
| address-family ipv4 unicast | ||
| redistribute connected | ||
| sid vpn export 1 | ||
| rd vpn export 65001:10 | ||
| rt vpn both 0:10 | ||
| import vpn | ||
| export vpn | ||
| exit-address-family | ||
| ! | ||
| ! | ||
| router bgp 65001 vrf vrf20 | ||
| bgp router-id 192.0.2.1 | ||
| ! | ||
| address-family ipv4 unicast | ||
| redistribute connected | ||
| sid vpn export 2 | ||
| rd vpn export 65001:20 | ||
| rt vpn both 0:20 | ||
| import vpn | ||
| export vpn | ||
| exit-address-family | ||
| ! | ||
| ! | ||
| interface eth0 | ||
| mpls bgp forwarding | ||
| ! | ||
| interface eth1 | ||
| mpls bgp forwarding | ||
| ! |
This file contains hidden or 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 2001:db8:2:2::/64 2001:db8:12::2 | ||
| ipv6 route 2001:db8:3:3::/64 2001:db8:13::3 | ||
| ! |
This file contains hidden or 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 @@ | ||
| log file zebra.log | ||
| ! | ||
| hostname r1 | ||
| ! | ||
| interface lo | ||
| ipv6 address 2001:db8:1:1::1/128 | ||
| ! | ||
| interface eth0 | ||
| ipv6 address 2001:db8:12::1/64 | ||
| ! | ||
| interface eth1 | ||
| ipv6 address 2001:db8:13::1/64 | ||
| ! | ||
| interface eth2 vrf vrf10 | ||
| ip address 192.168.1.254/24 | ||
| ! | ||
| interface eth3 vrf vrf20 | ||
| ip address 192.168.1.254/24 | ||
| ! | ||
| segment-routing | ||
| srv6 | ||
| locators | ||
| locator default | ||
| prefix 2001:db8:1:1::/64 | ||
| ! | ||
| ! | ||
| ! | ||
| ip forwarding | ||
| ipv6 forwarding | ||
| ! | ||
| line vty | ||
| ! |
This file contains hidden or 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,50 @@ | ||
| frr defaults traditional | ||
| ! | ||
| hostname r2 | ||
| password zebra | ||
| ! | ||
| log commands | ||
| ! | ||
| router bgp 65002 | ||
| bgp router-id 192.0.2.2 | ||
| no bgp ebgp-requires-policy | ||
| no bgp default ipv4-unicast | ||
| neighbor 2001:db8:12::1 remote-as 65001 | ||
| neighbor 2001:db8:12::1 timers 3 10 | ||
| neighbor 2001:db8:12::1 timers connect 1 | ||
| neighbor 2001:db8:12::1 capability extended-nexthop | ||
| ! | ||
| segment-routing srv6 | ||
| locator default | ||
| ! | ||
| address-family ipv4 vpn | ||
| neighbor 2001:db8:12::1 activate | ||
| exit-address-family | ||
| ! | ||
| ! | ||
| router bgp 65002 vrf vrf10 | ||
| bgp router-id 192.0.2.2 | ||
| ! | ||
| address-family ipv4 unicast | ||
| redistribute connected | ||
| sid vpn export 1 | ||
| rd vpn export 65002:10 | ||
| rt vpn both 0:10 | ||
| import vpn | ||
| export vpn | ||
| exit-address-family | ||
| ! | ||
| ! | ||
| router bgp 65002 vrf vrf20 | ||
| bgp router-id 192.0.2.2 | ||
| ! | ||
| address-family ipv4 unicast | ||
| redistribute connected | ||
| sid vpn export 2 | ||
| rd vpn export 65002:20 | ||
| rt vpn both 0:20 | ||
| import vpn | ||
| export vpn | ||
| exit-address-family | ||
| ! | ||
| ! |
This file contains hidden or 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 2001:db8:1:1::/64 2001:db8:12::1 | ||
| ipv6 route 2001:db8:3:3::/64 2001:db8:12::1 | ||
| ! |
This file contains hidden or 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,29 @@ | ||
| log file zebra.log | ||
| ! | ||
| hostname r2 | ||
| ! | ||
| interface lo | ||
| ipv6 address 2001:db8:2:2::1/128 | ||
| ! | ||
| interface eth0 | ||
| ipv6 address 2001:db8:12::2/64 | ||
| ! | ||
| interface eth1 vrf vrf10 | ||
| ip address 192.168.2.254/24 | ||
| ! | ||
| interface eth2 vrf vrf20 | ||
| ip address 192.168.2.254/24 | ||
| ! | ||
| segment-routing | ||
| srv6 | ||
| locators | ||
| locator default | ||
| prefix 2001:db8:2:2::/64 | ||
| ! | ||
| ! | ||
| ! | ||
| ip forwarding | ||
| ipv6 forwarding | ||
| ! | ||
| line vty | ||
| ! |
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.
Uh oh!
There was an error while loading. Please reload this page.