diff options
| author | Trey Aspelund <taspelund@nvidia.com> | 2023-01-25 13:07:43 -0500 | 
|---|---|---|
| committer | Trey Aspelund <taspelund@nvidia.com> | 2023-01-27 11:11:44 -0500 | 
| commit | 826c3f6db358e9bbc48848c5eadaab7916f5c3f9 (patch) | |
| tree | 44a84dc46bb249727abf87045366f15e2d84a1eb /bgpd/bgp_evpn.c | |
| parent | 2d5928355c89130713660493e23430994b79a8ef (diff) | |
bgpd: only unimport routes if tunnel-ip changes
When processing a new local VNI, we were always walking the global EVPN
table to look for routes that needed to be removed due to a martian
nexthop change (specifically a tunnel-ip change).
Since the martian TIP table is global (all VNIs) + the walk is also in
the global table (all VNIs), we can trust that any new TIP from any VNI
would result in routes getting removed from the global table and
unimported from all live (L2)VNIs.
i.e.
The only time this update is actionable is if we are adding/removing an
IP from the martian TIP table, and we do not need to walk the table for
normal refcount adjustments.
Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
Diffstat (limited to 'bgpd/bgp_evpn.c')
| -rw-r--r-- | bgpd/bgp_evpn.c | 22 | 
1 files changed, 14 insertions, 8 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index c9e935668e..dbd8bebe5a 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -2749,10 +2749,13 @@ static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn,  	/* Update the tunnel-ip hash */  	bgp_tip_del(bgp, &vpn->originator_ip); -	bgp_tip_add(bgp, &originator_ip); - -	/* filter routes as martian nexthop db has changed */ -	bgp_filter_evpn_routes_upon_martian_nh_change(bgp); +	if (bgp_tip_add(bgp, &originator_ip)) +		/* The originator_ip was not already present in the +		 * bgp martian next-hop table as a tunnel-ip, so we +		 * need to go back and filter routes matching the new +		 * martian next-hop. +		 */ +		bgp_filter_evpn_routes_upon_martian_nh_change(bgp);  	/* Need to withdraw type-3 route as the originator IP is part  	 * of the key. @@ -6567,10 +6570,13 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,  	SET_FLAG(vpn->flags, VNI_FLAG_LIVE);  	/* tunnel is now active, add tunnel-ip to db */ -	bgp_tip_add(bgp, &originator_ip); - -	/* filter routes as nexthop database has changed */ -	bgp_filter_evpn_routes_upon_martian_nh_change(bgp); +	if (bgp_tip_add(bgp, &originator_ip)) +		/* The originator_ip was not already present in the +		 * bgp martian next-hop table as a tunnel-ip, so we +		 * need to go back and filter routes matching the new +		 * martian next-hop. +		 */ +		bgp_filter_evpn_routes_upon_martian_nh_change(bgp);  	/*  	 * Create EVPN type-3 route and schedule for processing.  | 
