]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: EVPN definitions
authorvivek <vivek@cumulusnetworks.com>
Mon, 15 May 2017 21:27:09 +0000 (14:27 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 12 Jul 2017 16:34:34 +0000 (12:34 -0400)
Define the EVPN (EVI) hash table and objects for mapping route targets to EVIs.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
bgpd/Makefile.am
bgpd/bgp_evpn_private.h [new file with mode: 0644]

index 9a4e5fd6aafd7a1e4cb891b9e60a00ac2794f5cd..0ec5a778bb1d53bc830fc34946d42b9c73135464 100644 (file)
@@ -95,7 +95,7 @@ noinst_HEADERS = \
        bgp_advertise.h bgp_vty.h bgp_mpath.h bgp_nht.h \
        bgp_updgrp.h bgp_bfd.h bgp_encap_tlv.h bgp_encap_types.h \
        $(BGP_VNC_RFAPI_HD) bgp_attr_evpn.h bgp_evpn.h bgp_evpn_vty.h \
-        bgp_vpn.h bgp_label.h bgp_rd.h
+        bgp_vpn.h bgp_label.h bgp_rd.h bgp_evpn_private.h
 
 bgpd_SOURCES = bgp_main.c
 bgpd_LDADD = libbgp.a  $(BGP_VNC_RFP_LIB) ../lib/libfrr.la @LIBCAP@ @LIBM@
diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h
new file mode 100644 (file)
index 0000000..e9e8a75
--- /dev/null
@@ -0,0 +1,97 @@
+/* BGP EVPN internal definitions
+ * Copyright (C) 2017 Cumulus Networks, Inc.
+ *
+ * This file is part of FRR.
+ *
+ * FRR is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * FRR is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FRR; see the file COPYING.  If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _BGP_EVPN_PRIVATE_H
+#define _BGP_EVPN_PRIVATE_H
+
+#include "vxlan.h"
+#include "zebra.h"
+
+#include "bgpd/bgpd.h"
+#include "bgpd/bgp_ecommunity.h"
+
+/* EVPN prefix lengths. */
+#define EVPN_TYPE_2_ROUTE_PREFIXLEN      224
+#define EVPN_TYPE_3_ROUTE_PREFIXLEN      224
+
+/* EVPN route types. */
+typedef enum
+{
+  BGP_EVPN_AD_ROUTE = 1,          /* Ethernet Auto-Discovery (A-D) route */
+  BGP_EVPN_MAC_IP_ROUTE,          /* MAC/IP Advertisement route */
+  BGP_EVPN_IMET_ROUTE,            /* Inclusive Multicast Ethernet Tag route */
+  BGP_EVPN_ES_ROUTE,              /* Ethernet Segment route */
+  BGP_EVPN_IP_PREFIX_ROUTE,       /* IP Prefix route */
+} bgp_evpn_route_type;
+
+/*
+ * Hash table of EVIs. Right now, the only type of EVI supported is with
+ * VxLAN encapsulation, hence each EVI corresponds to a L2 VNI.
+ * The VNIs are not "created" through BGP but through some other interface
+ * on the system. This table stores VNIs that BGP comes to know as present
+ * on the system (through interaction with zebra) as well as pre-configured
+ * VNIs (which need to be defined in the system to become "live").
+ */
+struct bgpevpn
+{
+  vni_t                     vni;
+  u_int32_t                 flags;
+#define VNI_FLAG_CFGD              0x1  /* VNI is user configured */
+#define VNI_FLAG_LIVE              0x2  /* VNI is "live" */
+#define VNI_FLAG_RD_CFGD           0x4  /* RD is user configured. */
+#define VNI_FLAG_IMPRT_CFGD        0x8  /* Import RT is user configured */
+#define VNI_FLAG_EXPRT_CFGD        0x10 /* Export RT is user configured */
+
+  /* Id for deriving the RD automatically for this VNI */
+  u_int16_t                 rd_id;
+
+  /* RD for this VNI. */
+  struct prefix_rd          prd;
+
+  /* Route type 3 field */
+  struct in_addr            originator_ip;
+
+  /* Import and Export RTs. */
+  struct list               *import_rtl;
+  struct list               *export_rtl;
+
+  /* Route table for EVPN routes for this VNI. */
+  struct bgp_table          *route_table;
+
+  QOBJ_FIELDS
+};
+
+DECLARE_QOBJ_TYPE(bgpevpn)
+
+/* Mapping of Import RT to VNIs.
+ * The Import RTs of all VNIs are maintained in a hash table with each
+ * RT linking to all VNIs that will import routes matching this RT.
+ */
+struct irt_node
+{
+  /* RT */
+  struct ecommunity_val rt;
+
+  /* List of VNIs importing routes matching this RT. */
+  struct list *vnis;
+};
+
+#endif /* _BGP_EVPN_PRIVATE_H */