Skip to content

Commit

Permalink
Merge pull request #2762 from chiragshah6/evpn_dev
Browse files Browse the repository at this point in the history
bgpd: check existing l3vni for any l2vni creation
  • Loading branch information
riw777 committed Aug 22, 2018
2 parents 0a4ecf2 + 7df407e commit 753e2c9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bgpd/bgp_evpn.c
Expand Up @@ -4931,6 +4931,23 @@ void bgp_evpn_derive_auto_rd(struct bgp *bgp, struct bgpevpn *vpn)
UNSET_FLAG(vpn->flags, VNI_FLAG_RD_CFGD);
}

/*
* Lookup L3-VNI
*/
bool bgp_evpn_lookup_l3vni_l2vni_table(vni_t vni)
{
struct list *inst = bm->bgp;
struct listnode *node;
struct bgp *bgp_vrf;

for (ALL_LIST_ELEMENTS_RO(inst, node, bgp_vrf)) {
if (bgp_vrf->l3vni == vni)
return true;
}

return false;
}

/*
* Lookup VNI.
*/
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_evpn_private.h
Expand Up @@ -503,4 +503,5 @@ extern struct evpnes *bgp_evpn_lookup_es(struct bgp *bgp, esi_t *esi);
extern struct evpnes *bgp_evpn_es_new(struct bgp *bgp, esi_t *esi,
struct ipaddr *originator_ip);
extern void bgp_evpn_es_free(struct bgp *bgp, struct evpnes *es);
extern bool bgp_evpn_lookup_l3vni_l2vni_table(vni_t vni);
#endif /* _BGP_EVPN_PRIVATE_H */
8 changes: 8 additions & 0 deletions bgpd/bgp_evpn_vty.c
Expand Up @@ -1888,6 +1888,14 @@ static struct bgpevpn *evpn_create_update_vni(struct bgp *bgp, vni_t vni)

vpn = bgp_evpn_lookup_vni(bgp, vni);
if (!vpn) {
/* Check if this L2VNI is already configured as L3VNI */
if (bgp_evpn_lookup_l3vni_l2vni_table(vni)) {
flog_err(BGP_ERR_VNI,
"%u: Failed to create L2VNI %u, it is configured as L3VNI",
bgp->vrf_id, vni);
return NULL;
}

/* tenant vrf will be updated when we get local_vni_add from
* zebra
*/
Expand Down

0 comments on commit 753e2c9

Please sign in to comment.