]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra, bgpd: Exchange L3 interface for VRF's VNI
authorvivek <vivek@cumulusnetworks.com>
Wed, 27 Feb 2019 11:52:34 +0000 (11:52 +0000)
committervivek <vivek@cumulusnetworks.com>
Wed, 27 Feb 2019 11:52:34 +0000 (11:52 +0000)
In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

The implementation currently derives this L3 interface for EVPN tenant
routes using special code that looks at route flags. This patch
exchanges the L3 interface between zebra and bgpd as part of the L3-VNI
exchange in order to eliminate some this special code.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_evpn.c
bgpd/bgp_evpn.h
bgpd/bgp_zebra.c
bgpd/bgpd.h
zebra/zebra_vxlan.c

index 1471bd9829a50719b564d1526113edb78330119d..4a8fe111be6eaed86b02b646abe847981f0fc4ed 100644 (file)
@@ -5396,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 */
@@ -5444,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)
index 5c3d4ce3aa9a1f60a56b1dc99651b43731d9b703..fbf30083e178f92cd7b95dfb07b06e24beea1f93 100644 (file)
@@ -136,7 +136,8 @@ extern int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni,
                                    uint8_t flags, uint32_t seq);
 extern int bgp_evpn_local_l3vni_add(vni_t vni, 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);
 extern int bgp_evpn_local_l3vni_del(vni_t vni, vrf_id_t vrf_id);
 extern int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni);
 extern int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
index 3f18d69a2d6a5333b71f74960148e3be0c45805d..d0c170322aebf28ff34e544cf34c2ba00e6384b4 100644 (file)
@@ -2486,6 +2486,7 @@ static int bgp_zebra_process_local_l3vni(int cmd, struct zclient *zclient,
        struct ethaddr rmac;
        struct in_addr originator_ip;
        struct stream *s;
+       ifindex_t svi_ifindex;
 
        memset(&rmac, 0, sizeof(struct ethaddr));
        memset(&originator_ip, 0, sizeof(struct in_addr));
@@ -2495,20 +2496,24 @@ static int bgp_zebra_process_local_l3vni(int cmd, struct zclient *zclient,
                stream_get(&rmac, s, sizeof(struct ethaddr));
                originator_ip.s_addr = stream_get_ipv4(s);
                stream_get(&filter, s, sizeof(int));
-       }
+               svi_ifindex = stream_getl(s);
 
-       if (BGP_DEBUG(zebra, ZEBRA))
-               zlog_debug("Rx L3-VNI %s VRF %s VNI %u RMAC %s filter %s",
-                          (cmd == ZEBRA_L3VNI_ADD) ? "add" : "del",
-                          vrf_id_to_name(vrf_id), l3vni,
-                          prefix_mac2str(&rmac, buf, sizeof(buf)),
-                          filter ? "prefix-routes-only" : "none");
+               if (BGP_DEBUG(zebra, ZEBRA))
+                       zlog_debug("Rx L3-VNI ADD VRF %s VNI %u RMAC %s filter %s svi-if %u",
+                                  vrf_id_to_name(vrf_id), l3vni,
+                                  prefix_mac2str(&rmac, buf, sizeof(buf)),
+                                  filter ? "prefix-routes-only" : "none",
+                                  svi_ifindex);
 
-       if (cmd == ZEBRA_L3VNI_ADD)
                bgp_evpn_local_l3vni_add(l3vni, vrf_id, &rmac, originator_ip,
-                                        filter);
-       else
+                                        filter, svi_ifindex);
+       } else {
+               if (BGP_DEBUG(zebra, ZEBRA))
+                       zlog_debug("Rx L3-VNI DEL VRF %s VNI %u",
+                                  vrf_id_to_name(vrf_id), l3vni);
+
                bgp_evpn_local_l3vni_del(l3vni, vrf_id);
+       }
 
        return 0;
 }
index dde1501d3062770fff51ec892f87a71da97d2875..c7d137c76c169bc8acddfd781a3293b29ab2f99c 100644 (file)
@@ -517,6 +517,9 @@ struct bgp {
        /* originator ip - to be used as NH for type-5 routes */
        struct in_addr originator_ip;
 
+       /* SVI associated with the L3-VNI corresponding to this vrf */
+       ifindex_t l3vni_svi_ifindex;
+
        /* vrf flags */
        uint32_t vrf_flags;
 #define BGP_VRF_AUTO                        (1 << 0)
index 7d4d5db6b09f92e9a6b5650af3000af3744256c9..6395f2a6e89088b332d3eba3f1bb09f12ee1e4c4 100644 (file)
@@ -4875,6 +4875,7 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni)
        stream_put(s, &rmac, sizeof(struct ethaddr));
        stream_put_in_addr(s, &zl3vni->local_vtep_ip);
        stream_put(s, &zl3vni->filter, sizeof(int));
+       stream_putl(s, zl3vni->svi_if->ifindex);
 
        /* Write packet size. */
        stream_putw_at(s, 0, stream_get_endp(s));