From: Tuetuopay Date: Wed, 6 Mar 2019 18:30:00 +0000 (+0100) Subject: bgpd/evpn: Associate L2VNIs to L3VNI in EVPN VRF X-Git-Tag: 7.1_pulled~111^2~8 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=3621ebc54be4f69d635a39f53d8962f25f763f21;p=matthieu%2Ffrr.git bgpd/evpn: Associate L2VNIs to L3VNI in EVPN VRF This change stores the mapping in the hash table of the EVPN VRF rather than the one of the default VRF. Signed-off-by: Tuetuopay Sponsored-by: Scaleway --- diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 6c1da4f924..5e957e26cd 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -5379,7 +5379,7 @@ static void link_l2vni_hash_to_l3vni(struct hash_bucket *bucket, struct bgpevpn *vpn = (struct bgpevpn *)bucket->data; struct bgp *bgp_def = NULL; - bgp_def = bgp_get_default(); + bgp_def = bgp_get_evpn(); assert(bgp_def); if (vpn->tenant_vrf_id == bgp_vrf->vrf_id) @@ -5396,27 +5396,28 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac, struct bgpevpn *vpn = NULL; as_t as = 0; - /* get the default instance - required to get the AS number for VRF + /* get the EVPN instance - required to get the AS number for VRF * auto-creatio */ - bgp_def = bgp_get_default(); + bgp_def = bgp_get_evpn(); if (!bgp_def) { flog_err( EC_BGP_NO_DFLT, - "Cannot process L3VNI %u ADD - default BGP instance not yet created", + "Cannot process L3VNI %u ADD - EVPN BGP instance not yet created", l3vni); return -1; } as = bgp_def->as; /* if the BGP vrf instance doesn't exist - create one */ - bgp_vrf = bgp_lookup_by_name(vrf_id_to_name(vrf_id)); + bgp_vrf = bgp_lookup_by_vrf_id(vrf_id); if (!bgp_vrf) { int ret = 0; ret = bgp_get(&bgp_vrf, &as, vrf_id_to_name(vrf_id), - BGP_INSTANCE_TYPE_VRF); + vrf_id == VRF_DEFAULT ? BGP_INSTANCE_TYPE_DEFAULT + : BGP_INSTANCE_TYPE_VRF); switch (ret) { case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: flog_err(EC_BGP_MULTI_INSTANCE, @@ -5498,11 +5499,11 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id) return -1; } - bgp_def = bgp_get_default(); + bgp_def = bgp_get_evpn(); if (!bgp_def) { flog_err( EC_BGP_NO_DFLT, - "Cannot process L3VNI %u Del - Could not find default BGP instance", + "Cannot process L3VNI %u Del - Could not find EVPN BGP instance", l3vni); return -1; }