summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_evpn.h
diff options
context:
space:
mode:
authorSri Mohana Singamsetty <srimohans@gmail.com>2019-03-15 18:27:13 +0100
committerGitHub <noreply@github.com>2019-03-15 18:27:13 +0100
commitf05d8880492312e5ca79dfd6eb174d066ff07eb9 (patch)
tree9234192dc6b54aaaff10f95f55865f23cf63d15d /bgpd/bgp_evpn.h
parentMerge pull request #3962 from donaldsharp/pim_display (diff)
parentbgpd: Recursively determine if route's source is EVPN (diff)
downloadfrr-f05d8880492312e5ca79dfd6eb174d066ff07eb9.tar.xz
frr-f05d8880492312e5ca79dfd6eb174d066ff07eb9.zip
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.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h
index fbf30083e..22fb0939c 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,