summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_evpn_private.h
diff options
context:
space:
mode:
authormitesh <mitesh@cumulusnetworks.com>2017-10-27 23:15:45 +0200
committerMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>2017-12-14 19:57:07 +0100
commit342dd0c6230a7d637a8dec08a5ca9c7b6eb148be (patch)
tree77e1589ed2e4d81b3cf9b85fafe43eb8c7f9482b /bgpd/bgp_evpn_private.h
parentbgpd: set vrf originator ip to kernels local-ip (diff)
downloadfrr-342dd0c6230a7d637a8dec08a5ca9c7b6eb148be.tar.xz
frr-342dd0c6230a7d637a8dec08a5ca9c7b6eb148be.zip
bgpd: advertise/withdraw type-5 routes upon user config
CLI config for enabling/disabling type-5 routes router bgp <as> vrf <vrf> address-family l2vpn evpn [no] advertise <ipv4|ipv6|both> loop through all the routes in VRF instance and advertise/withdraw all ip routes as type-5 routes in default instance. Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_evpn_private.h')
-rw-r--r--bgpd/bgp_evpn_private.h35
1 files changed, 32 insertions, 3 deletions
diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h
index 26a026079..1cf3f2215 100644
--- a/bgpd/bgp_evpn_private.h
+++ b/bgpd/bgp_evpn_private.h
@@ -33,6 +33,7 @@
/* EVPN prefix lengths. */
#define EVPN_TYPE_2_ROUTE_PREFIXLEN 224
#define EVPN_TYPE_3_ROUTE_PREFIXLEN 224
+#define EVPN_TYPE_5_ROUTE_PREFIXLEN 168
/* EVPN route types. */
typedef enum {
@@ -128,11 +129,14 @@ static inline int bgp_evpn_vrf_rd_matches_existing(struct bgp *bgp_vrf,
static inline int is_evpn_prefix_routes_adv_enabled(struct bgp *bgp_vrf)
{
- if (!bgp_vrf->l3vni ||
- !CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_EVPN_PREFIX_ROUTE))
+ if (!bgp_vrf->l3vni)
return 0;
- return 1;
+ if (CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN) ||
+ CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN))
+ return 1;
+
+ return 0;
}
static inline vni_t bgpevpn_get_l3vni(struct bgpevpn *vpn)
@@ -312,6 +316,31 @@ static inline void build_evpn_type2_prefix(struct prefix_evpn *p,
memcpy(&p->prefix.ip, ip, sizeof(*ip));
}
+static inline void build_type5_prefix_from_ip_prefix(struct prefix_evpn *evp,
+ struct prefix *ip_prefix)
+{
+ struct ipaddr ip;
+
+ memset(&ip, 0, sizeof(struct ipaddr));
+ if (ip_prefix->family == AF_INET) {
+ ip.ipa_type = IPADDR_V4;
+ memcpy(&ip.ipaddr_v4, &ip_prefix->u.prefix4,
+ sizeof(struct in_addr));
+ } else {
+ ip.ipa_type = IPADDR_V6;
+ memcpy(&ip.ipaddr_v6, &ip_prefix->u.prefix6,
+ sizeof(struct in6_addr));
+ }
+
+ memset(evp, 0, sizeof(struct prefix_evpn));
+ evp->family = AF_EVPN;
+ evp->prefixlen = EVPN_TYPE_5_ROUTE_PREFIXLEN;
+ evp->prefix.ip_prefix_length = ip_prefix->prefixlen;
+ evp->prefix.route_type = BGP_EVPN_IP_PREFIX_ROUTE;
+ evp->prefix.ip.ipa_type = ip.ipa_type;
+ memcpy(&evp->prefix.ip, &ip, sizeof(struct ipaddr));
+}
+
static inline void build_evpn_type3_prefix(struct prefix_evpn *p,
struct in_addr originator_ip)
{