diff options
Diffstat (limited to 'zebra/interface.h')
-rw-r--r-- | zebra/interface.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/zebra/interface.h b/zebra/interface.h index b276edc35..f5ca00c4a 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); |