summaryrefslogtreecommitdiff
path: root/zebra/zebra_vxlan_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vxlan_private.h')
-rw-r--r--zebra/zebra_vxlan_private.h264
1 files changed, 8 insertions, 256 deletions
diff --git a/zebra/zebra_vxlan_private.h b/zebra/zebra_vxlan_private.h
index d2b02df2ad..9a88d98b81 100644
--- a/zebra/zebra_vxlan_private.h
+++ b/zebra/zebra_vxlan_private.h
@@ -29,6 +29,8 @@
#include "if.h"
#include "linklist.h"
#include "zebra_vxlan.h"
+#include "zebra_evpn.h"
+#include "zebra_evpn_mac.h"
#ifdef __cplusplus
extern "C" {
@@ -37,72 +39,8 @@ extern "C" {
#define ERR_STR_SZ 256
/* definitions */
-typedef struct zebra_vni_t_ zebra_vni_t;
-typedef struct zebra_vtep_t_ zebra_vtep_t;
-typedef struct zebra_mac_t_ zebra_mac_t;
-typedef struct zebra_neigh_t_ zebra_neigh_t;
typedef struct zebra_l3vni_t_ zebra_l3vni_t;
-/*
- * VTEP info
- *
- * Right now, this just has each remote VTEP's IP address.
- */
-struct zebra_vtep_t_ {
- /* Remote IP. */
- /* NOTE: Can only be IPv4 right now. */
- struct in_addr vtep_ip;
- /* Flood mode (one of enum vxlan_flood_control) based on the PMSI
- * tunnel type advertised by the remote VTEP
- */
- int flood_control;
-
- /* Links. */
- struct zebra_vtep_t_ *next;
- struct zebra_vtep_t_ *prev;
-};
-
-
-/*
- * VNI hash table
- *
- * Contains information pertaining to a VNI:
- * - the list of remote VTEPs (with this VNI)
- */
-struct zebra_vni_t_ {
- /* VNI - key */
- vni_t vni;
-
- /* Flag for advertising gw macip */
- uint8_t advertise_gw_macip;
-
- /* Flag for advertising svi macip */
- uint8_t advertise_svi_macip;
-
- /* Flag for advertising gw macip */
- uint8_t advertise_subnet;
-
- /* Corresponding VxLAN interface. */
- struct interface *vxlan_if;
-
- /* List of remote VTEPs */
- zebra_vtep_t *vteps;
-
- /* Local IP */
- struct in_addr local_vtep_ip;
-
- /* PIM-SM MDT group for BUM flooding */
- struct in_addr mcast_grp;
-
- /* tenant VRF, if any */
- vrf_id_t vrf_id;
-
- /* List of local or remote MAC */
- struct hash *mac_table;
-
- /* List of local or remote neighbors (MAC+IP) */
- struct hash *neigh_table;
-};
/* L3 VNI hash table */
struct zebra_l3vni_t_ {
@@ -266,202 +204,11 @@ static inline void zl3vni_get_svi_rmac(zebra_l3vni_t *zl3vni,
memcpy(rmac->octet, zl3vni->svi_if->hw_addr, ETH_ALEN);
}
-struct host_rb_entry {
- RB_ENTRY(host_rb_entry) hl_entry;
-
- struct prefix p;
-};
-
-RB_HEAD(host_rb_tree_entry, host_rb_entry);
-RB_PROTOTYPE(host_rb_tree_entry, host_rb_entry, hl_entry,
- host_rb_entry_compare);
-/*
- * MAC hash table.
- *
- * This table contains the MAC addresses pertaining to this VNI.
- * This includes local MACs learnt on an attached VLAN that maps
- * to this VNI as well as remote MACs learnt and installed by BGP.
- * Local MACs will be known either on a VLAN sub-interface or
- * on (port, VLAN); however, it is sufficient for zebra to maintain
- * against the VNI i.e., it does not need to retain the local "port"
- * information. The correct VNI will be obtained as zebra maintains
- * the mapping (of VLAN to VNI).
- */
-struct zebra_mac_t_ {
- /* MAC address. */
- struct ethaddr macaddr;
-
- uint32_t flags;
-#define ZEBRA_MAC_LOCAL 0x01
-#define ZEBRA_MAC_REMOTE 0x02
-#define ZEBRA_MAC_AUTO 0x04 /* Auto created for neighbor. */
-#define ZEBRA_MAC_STICKY 0x08 /* Static MAC */
-#define ZEBRA_MAC_REMOTE_RMAC 0x10 /* remote router mac */
-#define ZEBRA_MAC_DEF_GW 0x20
-/* remote VTEP advertised MAC as default GW */
-#define ZEBRA_MAC_REMOTE_DEF_GW 0x40
-#define ZEBRA_MAC_DUPLICATE 0x80
-#define ZEBRA_MAC_FPM_SENT 0x100 /* whether or not this entry was sent. */
-
- /* back pointer to zvni */
- zebra_vni_t *zvni;
-
- /* Local or remote info. */
- union {
- struct {
- ifindex_t ifindex;
- ns_id_t ns_id;
- vlanid_t vid;
- } local;
-
- struct in_addr r_vtep_ip;
- } fwd_info;
-
- /* Mobility sequence numbers associated with this entry. */
- uint32_t rem_seq;
- uint32_t loc_seq;
-
- /* List of neigh associated with this mac */
- struct list *neigh_list;
-
- /* list of hosts pointing to this remote RMAC */
- struct host_rb_tree_entry host_rb;
-
- /* Duplicate mac detection */
- uint32_t dad_count;
-
- struct thread *dad_mac_auto_recovery_timer;
-
- struct timeval detect_start_time;
-
- time_t dad_dup_detect_time;
-};
-
-/*
- * Context for MAC hash walk - used by callbacks.
- */
-struct mac_walk_ctx {
- zebra_vni_t *zvni; /* VNI hash */
- struct zebra_vrf *zvrf; /* VRF - for client notification. */
- int uninstall; /* uninstall from kernel? */
- int upd_client; /* uninstall from client? */
-
- uint32_t flags;
-#define DEL_LOCAL_MAC 0x1
-#define DEL_REMOTE_MAC 0x2
-#define DEL_ALL_MAC (DEL_LOCAL_MAC | DEL_REMOTE_MAC)
-#define DEL_REMOTE_MAC_FROM_VTEP 0x4
-#define SHOW_REMOTE_MAC_FROM_VTEP 0x8
-
- struct in_addr r_vtep_ip; /* To walk MACs from specific VTEP */
-
- struct vty *vty; /* Used by VTY handlers */
- uint32_t count; /* Used by VTY handlers */
- struct json_object *json; /* Used for JSON Output */
- bool print_dup; /* Used to print dup addr list */
-};
-
-struct rmac_walk_ctx {
- struct vty *vty;
- struct json_object *json;
-};
-
-#define IS_ZEBRA_NEIGH_ACTIVE(n) (n->state == ZEBRA_NEIGH_ACTIVE)
-
-#define IS_ZEBRA_NEIGH_INACTIVE(n) (n->state == ZEBRA_NEIGH_INACTIVE)
-
-#define ZEBRA_NEIGH_SET_ACTIVE(n) n->state = ZEBRA_NEIGH_ACTIVE
-
-#define ZEBRA_NEIGH_SET_INACTIVE(n) n->state = ZEBRA_NEIGH_INACTIVE
-
-/*
- * Neighbor hash table.
- *
- * This table contains the neighbors (IP to MAC bindings) pertaining to
- * this VNI. This includes local neighbors learnt on the attached VLAN
- * device that maps to this VNI as well as remote neighbors learnt and
- * installed by BGP.
- * Local neighbors will be known against the VLAN device (SVI); however,
- * it is sufficient for zebra to maintain against the VNI. The correct
- * VNI will be obtained as zebra maintains the mapping (of VLAN to VNI).
- */
-struct zebra_neigh_t_ {
- /* IP address. */
- struct ipaddr ip;
-
- /* MAC address. */
- struct ethaddr emac;
-
- /* Underlying interface. */
- ifindex_t ifindex;
-
- zebra_vni_t *zvni;
-
- uint32_t flags;
-#define ZEBRA_NEIGH_LOCAL 0x01
-#define ZEBRA_NEIGH_REMOTE 0x02
-#define ZEBRA_NEIGH_REMOTE_NH 0x04 /* neigh entry for remote vtep */
-#define ZEBRA_NEIGH_DEF_GW 0x08
-#define ZEBRA_NEIGH_ROUTER_FLAG 0x10
-#define ZEBRA_NEIGH_DUPLICATE 0x20
-#define ZEBRA_NEIGH_SVI_IP 0x40
-
- enum zebra_neigh_state state;
-
- /* Remote VTEP IP - applicable only for remote neighbors. */
- struct in_addr r_vtep_ip;
-
- /*
- * Mobility sequence numbers associated with this entry. The rem_seq
- * represents the sequence number from the client (BGP) for the most
- * recent add or update of this entry while the loc_seq represents
- * the sequence number informed (or to be informed) by zebra to BGP
- * for this entry.
- */
- uint32_t rem_seq;
- uint32_t loc_seq;
-
- /* list of hosts pointing to this remote NH entry */
- struct host_rb_tree_entry host_rb;
-
- /* Duplicate ip detection */
- uint32_t dad_count;
-
- struct thread *dad_ip_auto_recovery_timer;
-
- struct timeval detect_start_time;
-
- time_t dad_dup_detect_time;
-};
-
-/*
- * Context for neighbor hash walk - used by callbacks.
- */
-struct neigh_walk_ctx {
- zebra_vni_t *zvni; /* VNI hash */
- struct zebra_vrf *zvrf; /* VRF - for client notification. */
- int uninstall; /* uninstall from kernel? */
- int upd_client; /* uninstall from client? */
-
- uint32_t flags;
-#define DEL_LOCAL_NEIGH 0x1
-#define DEL_REMOTE_NEIGH 0x2
-#define DEL_ALL_NEIGH (DEL_LOCAL_NEIGH | DEL_REMOTE_NEIGH)
-#define DEL_REMOTE_NEIGH_FROM_VTEP 0x4
-#define SHOW_REMOTE_NEIGH_FROM_VTEP 0x8
-
- struct in_addr r_vtep_ip; /* To walk neighbors from specific VTEP */
-
- struct vty *vty; /* Used by VTY handlers */
- uint32_t count; /* Used by VTY handlers */
- uint8_t addr_width; /* Used by VTY handlers */
- struct json_object *json; /* Used for JSON Output */
-};
/* context for neigh hash walk - update l3vni and rmac */
struct neigh_l3info_walk_ctx {
- zebra_vni_t *zvni;
+ zebra_evpn_t *zevpn;
zebra_l3vni_t *zl3vni;
int add;
};
@@ -476,6 +223,7 @@ extern zebra_l3vni_t *zl3vni_from_vrf(vrf_id_t vrf_id);
extern struct interface *zl3vni_map_to_vxlan_if(zebra_l3vni_t *zl3vni);
extern struct interface *zl3vni_map_to_svi_if(zebra_l3vni_t *zl3vni);
extern struct interface *zl3vni_map_to_mac_vlan_if(zebra_l3vni_t *zl3vni);
+extern zebra_l3vni_t *zl3vni_lookup(vni_t vni);
DECLARE_HOOK(zebra_rmac_update, (zebra_mac_t *rmac, zebra_l3vni_t *zl3vni,
bool delete, const char *reason), (rmac, zl3vni, delete, reason))
@@ -507,4 +255,8 @@ typedef struct zebra_vxlan_sg_ {
uint32_t ref_cnt;
} zebra_vxlan_sg_t;
+extern zebra_evpn_t *zevpn_lookup(vni_t vni);
+extern void zebra_vxlan_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive,
+ bool force_clear_static, const char *caller);
+
#endif /* _ZEBRA_VXLAN_PRIVATE_H */