]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_evpn.c
Merge pull request #3892 from vivek-cumulus/evpn_vrf_route_leak
[mirror_frr.git] / bgpd / bgp_evpn.c
index 361df826fa49d980639f14fc86cddf1c7e712119..19cda453f5f2c7d6439d87bfc75702799686a70a 100644 (file)
@@ -184,8 +184,6 @@ static struct vrf_irt_node *vrf_import_rt_new(struct ecommunity_val *rt)
 
        irt = XCALLOC(MTYPE_BGP_EVPN_VRF_IMPORT_RT,
                      sizeof(struct vrf_irt_node));
-       if (!irt)
-               return NULL;
 
        irt->rt = *rt;
        irt->vrfs = list_new();
@@ -296,8 +294,6 @@ static struct irt_node *import_rt_new(struct bgp *bgp,
                return NULL;
 
        irt = XCALLOC(MTYPE_BGP_EVPN_IMPORT_RT, sizeof(struct irt_node));
-       if (!irt)
-               return NULL;
 
        irt->rt = *rt;
        irt->vnis = list_new();
@@ -968,8 +964,6 @@ static struct in_addr *es_vtep_new(struct in_addr vtep)
        struct in_addr *ip;
 
        ip = XCALLOC(MTYPE_BGP_EVPN_ES_VTEP, sizeof(struct in_addr));
-       if (!ip)
-               return NULL;
 
        ip->s_addr = vtep.s_addr;
        return ip;
@@ -3941,7 +3935,7 @@ static int process_type4_route(struct peer *peer, afi_t afi, safi_t safi,
  */
 static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi,
                               struct attr *attr, uint8_t *pfx, int psize,
-                              uint32_t addpath_id, int withdraw)
+                              uint32_t addpath_id)
 {
        struct prefix_rd prd;
        struct prefix_evpn p;
@@ -4027,7 +4021,7 @@ static int process_type5_route(struct peer *peer, afi_t afi, safi_t safi,
         */
 
        /* Process the route. */
-       if (!withdraw)
+       if (attr)
                ret = bgp_update(peer, (struct prefix *)&p, addpath_id, attr,
                                 afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL,
                                 &prd, &label, 1, 0, &evpn);
@@ -4882,8 +4876,9 @@ int bgp_nlri_parse_evpn(struct peer *peer, struct attr *attr,
                        break;
 
                case BGP_EVPN_IP_PREFIX_ROUTE:
-                       if (process_type5_route(peer, afi, safi, attr, pnt,
-                                               psize, addpath_id, withdraw)) {
+                       if (process_type5_route(peer, afi, safi,
+                                               withdraw ? NULL : attr, pnt,
+                                               psize, addpath_id)) {
                                flog_err(
                                        EC_BGP_PKT_PROCESS,
                                        "%u:%s - Error in processing EVPN type-5 NLRI size %d",
@@ -5108,8 +5103,6 @@ struct bgpevpn *bgp_evpn_new(struct bgp *bgp, vni_t vni,
                return NULL;
 
        vpn = XCALLOC(MTYPE_BGP_EVPN, sizeof(struct bgpevpn));
-       if (!vpn)
-               return NULL;
 
        /* Set values - RD and RT set to defaults. */
        vpn->vni = vni;
@@ -5189,8 +5182,6 @@ struct evpnes *bgp_evpn_es_new(struct bgp *bgp,
                return NULL;
 
        es = XCALLOC(MTYPE_BGP_EVPN_ES, sizeof(struct evpnes));
-       if (!es)
-               return NULL;
 
        /* set the ESI and originator_ip */
        memcpy(&es->esi, esi, sizeof(esi_t));
@@ -5405,7 +5396,8 @@ static void link_l2vni_hash_to_l3vni(struct hash_bucket *bucket,
 }
 
 int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac,
-                            struct in_addr originator_ip, int filter)
+                            struct in_addr originator_ip, int filter,
+                            ifindex_t svi_ifindex)
 {
        struct bgp *bgp_vrf = NULL; /* bgp VRF instance */
        struct bgp *bgp_def = NULL; /* default bgp instance */
@@ -5453,14 +5445,11 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac,
                SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_AUTO);
        }
 
-       /* associate with l3vni */
+       /* associate the vrf with l3vni and related parameters */
        bgp_vrf->l3vni = l3vni;
-
-       /* set the router mac - to be used in mac-ip routes for this vrf */
        memcpy(&bgp_vrf->rmac, rmac, sizeof(struct ethaddr));
-
-       /* set the originator ip */
        bgp_vrf->originator_ip = originator_ip;
+       bgp_vrf->l3vni_svi_ifindex = svi_ifindex;
 
        /* set the right filter - are we using l3vni only for prefix routes? */
        if (filter)