summaryrefslogtreecommitdiff
path: root/zebra/interface.h
diff options
context:
space:
mode:
authorvivek <vivek@cumulusnetworks.com>2017-05-14 22:31:08 -0700
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-07-12 12:22:19 -0400
commit6675513d00b8cb59942ecb05f990852d14ef3e41 (patch)
treee16818db2793aefeea3f7f7bcd2559e78f895e9f /zebra/interface.h
parent4c25598b4e5e33915afdf829fb38b8565dd1f2f9 (diff)
zebra: Layer-2 interface handling
Define interface types of interest and recognize the types. Store layer-2 information (VLAN Id, VNI etc.) for interfaces, process bridge interfaces and map bridge members to bridge. Display all the additional information to user (through "show interface"). Note: Only implemented for the netlink interface. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/interface.h')
-rw-r--r--zebra/interface.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/zebra/interface.h b/zebra/interface.h
index b276edc353..f5ca00c4aa 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -28,6 +28,8 @@
#include "zebra/irdp.h"
#endif
+#include "zebra/zebra_l2.h"
+
/* For interface multicast configuration. */
#define IF_ZEBRA_MULTICAST_UNSPEC 0
#define IF_ZEBRA_MULTICAST_ON 1
@@ -180,6 +182,25 @@ struct rtadvconf
#endif /* HAVE_RTADV */
+/* Zebra interface type - ones of interest. */
+typedef enum
+{
+ ZEBRA_IF_VXLAN, /* VxLAN interface */
+ ZEBRA_IF_VRF, /* VRF device */
+ ZEBRA_IF_BRIDGE, /* bridge device */
+ ZEBRA_IF_VLAN, /* VLAN sub-interface */
+ ZEBRA_IF_OTHER, /* Anything else */
+} zebra_iftype_t;
+
+/* Zebra "slave" interface type */
+typedef enum
+{
+ ZEBRA_IF_SLAVE_NONE, /* Not a slave */
+ ZEBRA_IF_SLAVE_VRF, /* Member of a VRF */
+ ZEBRA_IF_SLAVE_BRIDGE, /* Member of a bridge */
+ ZEBRA_IF_SLAVE_OTHER, /* Something else - e.g., bond slave */
+} zebra_slave_iftype_t;
+
/* `zebra' daemon local interface structure. */
struct zebra_if
{
@@ -231,8 +252,53 @@ struct zebra_if
/* ptm enable configuration */
u_char ptm_enable;
+
+ /* Zebra interface and "slave" interface type */
+ zebra_iftype_t zif_type;
+ zebra_slave_iftype_t zif_slave_type;
+
+ /* Additional L2 info, depends on zif_type */
+ union zebra_l2if_info l2info;
+
+ /* For members of a bridge, link to bridge. */
+ /* Note: If additional fields become necessary, this can be modified to
+ * be a pointer to a dynamically allocd struct.
+ */
+ struct zebra_l2info_brslave brslave_info;
+
+ /* Link fields - for sub-interfaces. */
+ ifindex_t link_ifindex;
+ struct interface *link;
};
+static inline void
+zebra_if_set_ziftype (struct interface *ifp, zebra_iftype_t zif_type,
+ zebra_slave_iftype_t zif_slave_type)
+{
+ struct zebra_if *zif;
+
+ zif = (struct zebra_if *)ifp->info;
+ zif->zif_type = zif_type;
+ zif->zif_slave_type = zif_slave_type;
+}
+
+#define IS_ZEBRA_IF_VRF(ifp) \
+ (((struct zebra_if *)(ifp->info))->zif_type == ZEBRA_IF_VRF)
+
+#define IS_ZEBRA_IF_BRIDGE(ifp) \
+ (((struct zebra_if *)(ifp->info))->zif_type == ZEBRA_IF_BRIDGE)
+
+#define IS_ZEBRA_IF_VLAN(ifp) \
+ (((struct zebra_if *)(ifp->info))->zif_type == ZEBRA_IF_VLAN)
+
+#define IS_ZEBRA_IF_VXLAN(ifp) \
+ (((struct zebra_if *)(ifp->info))->zif_type == ZEBRA_IF_VXLAN)
+
+#define IS_ZEBRA_IF_BRIDGE_SLAVE(ifp) \
+ (((struct zebra_if *)(ifp->info))->zif_slave_type == ZEBRA_IF_SLAVE_BRIDGE)
+
+#define IS_ZEBRA_IF_VRF_SLAVE(ifp) \
+ (((struct zebra_if *)(ifp->info))->zif_slave_type == ZEBRA_IF_SLAVE_VRF)
extern struct interface *if_lookup_by_index_per_ns (struct zebra_ns *, u_int32_t);
extern struct interface *if_lookup_by_name_per_ns (struct zebra_ns *, const char *);
@@ -253,6 +319,7 @@ extern int if_subnet_add (struct interface *, struct connected *);
extern int if_subnet_delete (struct interface *, struct connected *);
extern int ipv6_address_configured (struct interface *ifp);
extern void if_handle_vrf_change (struct interface *ifp, vrf_id_t vrf_id);
+extern void zebra_if_update_link (struct interface *ifp, ifindex_t link_ifindex);
extern void vrf_add_update (struct vrf *vrfp);