diff options
| author | Sri Mohana Singamsetty <srimohans@gmail.com> | 2019-03-15 10:27:13 -0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-15 10:27:13 -0700 | 
| commit | f05d8880492312e5ca79dfd6eb174d066ff07eb9 (patch) | |
| tree | 9234192dc6b54aaaff10f95f55865f23cf63d15d /bgpd/bgp_evpn.h | |
| parent | 89eddabc2db6fa5d8c7610e360751972d11e3d17 (diff) | |
| parent | 08e68f925e274989c09249449c12f8870604ad5d (diff) | |
Merge pull request #3892 from vivek-cumulus/evpn_vrf_route_leak
Leaking of EVPN-based IPv4 and IPv6 routes between VRFs
Diffstat (limited to 'bgpd/bgp_evpn.h')
| -rw-r--r-- | bgpd/bgp_evpn.h | 41 | 
1 files changed, 39 insertions, 2 deletions
diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index fbf30083e1..22fb0939c9 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -88,8 +88,13 @@ static inline int is_route_parent_evpn(struct bgp_path_info *ri)  	    !ri->extra->parent)  		return 0; -	/* See if the parent is of family L2VPN/EVPN */ -	parent_ri = (struct bgp_path_info *)ri->extra->parent; +	/* Determine parent recursively */ +	for (parent_ri = ri->extra->parent; +	     parent_ri->extra && parent_ri->extra->parent; +	     parent_ri = parent_ri->extra->parent) +		; + +	/* See if of family L2VPN/EVPN */  	rn = parent_ri->net;  	if (!rn)  		return 0; @@ -101,6 +106,38 @@ static inline int is_route_parent_evpn(struct bgp_path_info *ri)  	return 0;  } +/* Flag if the route path's family is EVPN. */ +static inline bool is_pi_family_evpn(struct bgp_path_info *pi) +{ +	return is_pi_family_matching(pi, AFI_L2VPN, SAFI_EVPN); +} + +/* Flag if the route is injectable into EVPN. This would be either a + * non-imported route or a non-EVPN imported route. + */ +static inline bool is_route_injectable_into_evpn(struct bgp_path_info *pi) +{ +	struct bgp_path_info *parent_pi; +	struct bgp_table *table; +	struct bgp_node *rn; + +	if (pi->sub_type != BGP_ROUTE_IMPORTED || +	    !pi->extra || +	    !pi->extra->parent) +		return true; + +	parent_pi = (struct bgp_path_info *)pi->extra->parent; +	rn = parent_pi->net; +	if (!rn) +		return true; +	table = bgp_node_table(rn); +	if (table && +	    table->afi == AFI_L2VPN && +	    table->safi == SAFI_EVPN) +		return false; +	return true; +} +  extern void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf,  					   struct prefix *p,  					   struct attr *src_attr, afi_t afi,  | 
