2 * Zebra VxLAN (EVPN) Data structures and definitions
3 * These are "internal" to this function.
4 * Copyright (C) 2016, 2017 Cumulus Networks, Inc.
6 * This file is part of FRR.
8 * FRR is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * FRR is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with FRR; see the file COPYING. If not, write to the Free
20 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 #ifndef _ZEBRA_VXLAN_PRIVATE_H
25 #define _ZEBRA_VXLAN_PRIVATE_H
35 typedef struct zebra_vni_t_ zebra_vni_t
;
36 typedef struct zebra_vtep_t_ zebra_vtep_t
;
37 typedef struct zebra_mac_t_ zebra_mac_t
;
38 typedef struct zebra_neigh_t_ zebra_neigh_t
;
43 * Right now, this just has each remote VTEP's IP address.
45 struct zebra_vtep_t_
{
47 /* NOTE: Can only be IPv4 right now. */
48 struct in_addr vtep_ip
;
51 struct zebra_vtep_t_
*next
;
52 struct zebra_vtep_t_
*prev
;
59 * Contains information pertaining to a VNI:
60 * - the list of remote VTEPs (with this VNI)
66 /* Flag for advertising gw macip */
67 u_int8_t advertise_gw_macip
;
69 /* Corresponding VxLAN interface. */
70 struct interface
*vxlan_if
;
72 /* List of remote VTEPs */
76 struct in_addr local_vtep_ip
;
78 /* List of local or remote MAC */
79 struct hash
*mac_table
;
81 /* List of local or remote neighbors (MAC+IP) */
82 struct hash
*neigh_table
;
88 * This table contains the MAC addresses pertaining to this VNI.
89 * This includes local MACs learnt on an attached VLAN that maps
90 * to this VNI as well as remote MACs learnt and installed by BGP.
91 * Local MACs will be known either on a VLAN sub-interface or
92 * on (port, VLAN); however, it is sufficient for zebra to maintain
93 * against the VNI i.e., it does not need to retain the local "port"
94 * information. The correct VNI will be obtained as zebra maintains
95 * the mapping (of VLAN to VNI).
99 struct ethaddr macaddr
;
102 #define ZEBRA_MAC_LOCAL 0x01
103 #define ZEBRA_MAC_REMOTE 0x02
104 #define ZEBRA_MAC_AUTO 0x04 /* Auto created for neighbor. */
105 #define ZEBRA_MAC_STICKY 0x08 /* Static MAC */
107 /* Local or remote info. */
114 struct in_addr r_vtep_ip
;
117 u_int32_t neigh_refcnt
;
119 /* List of neigh associated with this mac */
120 struct list
*neigh_list
;
124 * Context for MAC hash walk - used by callbacks.
126 struct mac_walk_ctx
{
127 zebra_vni_t
*zvni
; /* VNI hash */
128 struct zebra_vrf
*zvrf
; /* VRF - for client notification. */
129 int uninstall
; /* uninstall from kernel? */
130 int upd_client
; /* uninstall from client? */
133 #define DEL_LOCAL_MAC 0x1
134 #define DEL_REMOTE_MAC 0x2
135 #define DEL_ALL_MAC (DEL_LOCAL_MAC | DEL_REMOTE_MAC)
136 #define DEL_REMOTE_MAC_FROM_VTEP 0x4
137 #define SHOW_REMOTE_MAC_FROM_VTEP 0x8
139 struct in_addr r_vtep_ip
; /* To walk MACs from specific VTEP */
141 struct vty
*vty
; /* Used by VTY handlers */
142 u_int32_t count
; /* Used by VTY handlers */
143 struct json_object
*json
; /* Used for JSON Output */
146 enum zebra_neigh_state
{ ZEBRA_NEIGH_INACTIVE
= 0, ZEBRA_NEIGH_ACTIVE
= 1 };
148 #define IS_ZEBRA_NEIGH_ACTIVE(n) n->state == ZEBRA_NEIGH_ACTIVE
150 #define IS_ZEBRA_NEIGH_INACTIVE(n) n->state == ZEBRA_NEIGH_INACTIVE
152 #define ZEBRA_NEIGH_SET_ACTIVE(n) n->state = ZEBRA_NEIGH_ACTIVE
154 #define ZEBRA_NEIGH_SET_INACTIVE(n) n->state = ZEBRA_NEIGH_INACTIVE
157 * Neighbor hash table.
159 * This table contains the neighbors (IP to MAC bindings) pertaining to
160 * this VNI. This includes local neighbors learnt on the attached VLAN
161 * device that maps to this VNI as well as remote neighbors learnt and
163 * Local neighbors will be known against the VLAN device (SVI); however,
164 * it is sufficient for zebra to maintain against the VNI. The correct
165 * VNI will be obtained as zebra maintains the mapping (of VLAN to VNI).
167 struct zebra_neigh_t_
{
174 /* Underlying interface. */
178 #define ZEBRA_NEIGH_LOCAL 0x01
179 #define ZEBRA_NEIGH_REMOTE 0x02
181 enum zebra_neigh_state state
;
183 /* Remote VTEP IP - applicable only for remote neighbors. */
184 struct in_addr r_vtep_ip
;
188 * Context for neighbor hash walk - used by callbacks.
190 struct neigh_walk_ctx
{
191 zebra_vni_t
*zvni
; /* VNI hash */
192 struct zebra_vrf
*zvrf
; /* VRF - for client notification. */
193 int uninstall
; /* uninstall from kernel? */
194 int upd_client
; /* uninstall from client? */
197 #define DEL_LOCAL_NEIGH 0x1
198 #define DEL_REMOTE_NEIGH 0x2
199 #define DEL_ALL_NEIGH (DEL_LOCAL_NEIGH | DEL_REMOTE_NEIGH)
200 #define DEL_REMOTE_NEIGH_FROM_VTEP 0x4
201 #define SHOW_REMOTE_NEIGH_FROM_VTEP 0x8
203 struct in_addr r_vtep_ip
; /* To walk neighbors from specific VTEP */
205 struct vty
*vty
; /* Used by VTY handlers */
206 u_int32_t count
; /* Used by VTY handlers */
207 u_char addr_width
; /* Used by VTY handlers */
208 struct json_object
*json
; /* Used for JSON Output */
211 #endif /* _ZEBRA_VXLAN_PRIVATE_H */