Skip to content
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 withdraw stale routes #13647

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -6218,8 +6218,7 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi)
* If this is VRF leaked route
* process for withdraw.
*/
if (pi->sub_type ==
BGP_ROUTE_IMPORTED &&
if (safi == SAFI_MPLS_VPN &&
peer->bgp->inst_type ==
BGP_INSTANCE_TYPE_DEFAULT)
vpn_leak_to_vrf_withdraw(pi);
Expand Down
37 changes: 37 additions & 0 deletions tests/topotests/bgp_vpnv4_gr/r1/bgp_ipv4_routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"vrfName": "vrf1",
"localAS": 65500,
"routes":
{
"172.31.0.10/32": [
{
"prefix": "172.31.0.10",
"prefixLen": 32,
"network": "172.31.0.10\/32",
"nhVrfName": "default",
"nexthops": [
{
"ip": "192.168.0.2",
"afi": "ipv4",
"used": true
}
]
}
],
"172.31.1.10/32": [
{
"prefix": "172.31.1.10",
"prefixLen": 32,
"network": "172.31.1.10\/32",
"nhVrfName": "default",
"nexthops": [
{
"ip": "192.168.0.2",
"afi": "ipv4",
"used": true
}
]
}
]
}
}
52 changes: 52 additions & 0 deletions tests/topotests/bgp_vpnv4_gr/r1/bgp_vpnv4_routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"vrfName":"default",
"routerId":"192.0.2.1",
"defaultLocPrf":100,
"localAS":65500,
"routes":{
"routeDistinguishers":{
"444:2":{
"172.31.0.10/32":[
{
"valid":true,
"bestpath":true,
"selectionReason":"First path received",
"pathFrom":"external",
"prefix":"172.31.0.10",
"prefixLen":32,
"network":"172.31.0.10\/32",
"peerId":"192.168.0.2",
"nexthops":[
{
"ip":"192.168.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
},
"444:2":{
"172.31.1.10/32":[
{
"valid":true,
"bestpath":true,
"selectionReason":"First path received",
"pathFrom":"external",
"prefix":"172.31.1.10",
"prefixLen":32,
"network":"172.31.1.10\/32",
"peerId":"192.168.0.2",
"nexthops":[
{
"ip":"192.168.0.2",
"afi":"ipv4",
"used":true
}
]
}
]
}
}
}
}
25 changes: 25 additions & 0 deletions tests/topotests/bgp_vpnv4_gr/r1/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
router bgp 65500
bgp router-id 192.0.2.1
no bgp ebgp-requires-policy
neighbor 192.168.0.2 remote-as 65501
neighbor 192.168.0.2 timers 10 30
address-family ipv4 unicast
no neighbor 192.168.0.2 activate
exit-address-family
address-family ipv4 vpn
neighbor 192.168.0.2 activate
exit-address-family
!
router bgp 65500 vrf vrf1
bgp router-id 192.0.2.1
address-family ipv4 unicast
label vpn export 101
rd vpn export 444:1
rt vpn both 52:100
export vpn
import vpn
exit-address-family
!
interface r1-eth0
mpls bgp forwarding
!
7 changes: 7 additions & 0 deletions tests/topotests/bgp_vpnv4_gr/r1/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
log stdout
interface r1-eth1 vrf vrf1
ip address 172.31.0.1/32
!
interface r1-eth0
ip address 192.168.0.1/24
!
29 changes: 29 additions & 0 deletions tests/topotests/bgp_vpnv4_gr/r2/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
router bgp 65501
bgp router-id 192.0.2.2
bgp graceful-restart restart-time 15
bgp graceful-restart
no bgp ebgp-requires-policy
neighbor 192.168.0.1 remote-as 65500
neighbor 192.168.0.1 timers 10 30
neighbor 192.168.0.1 timers connect 5
address-family ipv4 unicast
no neighbor 192.168.0.1 activate
exit-address-family
address-family ipv4 vpn
neighbor 192.168.0.1 activate
exit-address-family
!
router bgp 65501 vrf vrf1
bgp router-id 192.0.2.2
address-family ipv4 unicast
redistribute connected
label vpn export 102
rd vpn export 444:2
rt vpn both 52:100
export vpn
import vpn
exit-address-family
!
interface r2-eth0
ton31337 marked this conversation as resolved.
Show resolved Hide resolved
mpls bgp forwarding
!
10 changes: 10 additions & 0 deletions tests/topotests/bgp_vpnv4_gr/r2/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
log stdout
interface r2-eth2 vrf vrf1
ip address 172.31.1.10/32
!
interface r2-eth1 vrf vrf1
ip address 172.31.0.10/32
!
interface r2-eth0
ip address 192.168.0.2/24
!
Loading
Loading