]>
Commit | Line | Data |
---|---|---|
18a7a601 | 1 | /* |
2 | * Zebra VxLAN (EVPN) Data structures and definitions | |
3 | * These are "internal" to this function. | |
4 | * Copyright (C) 2016, 2017 Cumulus Networks, Inc. | |
5 | * | |
6 | * This file is part of FRR. | |
7 | * | |
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 | |
11 | * later version. | |
12 | * | |
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. | |
17 | * | |
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 | |
21 | * 02111-1307, USA. | |
22 | */ | |
23 | ||
24 | #ifndef _ZEBRA_VXLAN_PRIVATE_H | |
25 | #define _ZEBRA_VXLAN_PRIVATE_H | |
26 | ||
27 | #include <zebra.h> | |
28 | ||
18a7a601 | 29 | #include "if.h" |
30 | #include "linklist.h" | |
655b04d1 | 31 | #include "zebra_vxlan.h" |
18a7a601 | 32 | |
51e94aa7 EDP |
33 | #ifdef __cplusplus |
34 | extern "C" { | |
35 | #endif | |
36 | ||
b7cfce93 MK |
37 | #define ERR_STR_SZ 256 |
38 | ||
18a7a601 | 39 | /* definitions */ |
40 | typedef struct zebra_vni_t_ zebra_vni_t; | |
41 | typedef struct zebra_vtep_t_ zebra_vtep_t; | |
4122e252 | 42 | typedef struct zebra_mac_t_ zebra_mac_t; |
43 | typedef struct zebra_neigh_t_ zebra_neigh_t; | |
b7cfce93 | 44 | typedef struct zebra_l3vni_t_ zebra_l3vni_t; |
18a7a601 | 45 | |
46 | /* | |
47 | * VTEP info | |
48 | * | |
49 | * Right now, this just has each remote VTEP's IP address. | |
50 | */ | |
d62a17ae | 51 | struct zebra_vtep_t_ { |
52 | /* Remote IP. */ | |
53 | /* NOTE: Can only be IPv4 right now. */ | |
54 | struct in_addr vtep_ip; | |
9718c54e AK |
55 | /* Flood mode (one of enum vxlan_flood_control) based on the PMSI |
56 | * tunnel type advertised by the remote VTEP | |
57 | */ | |
58 | int flood_control; | |
d62a17ae | 59 | |
60 | /* Links. */ | |
61 | struct zebra_vtep_t_ *next; | |
62 | struct zebra_vtep_t_ *prev; | |
18a7a601 | 63 | }; |
64 | ||
ce5160c0 AK |
65 | RB_HEAD(zebra_es_evi_rb_head, zebra_evpn_es_evi); |
66 | RB_PROTOTYPE(zebra_es_evi_rb_head, zebra_evpn_es_evi, rb_node, | |
67 | zebra_es_evi_rb_cmp); | |
18a7a601 | 68 | |
69 | /* | |
70 | * VNI hash table | |
71 | * | |
72 | * Contains information pertaining to a VNI: | |
73 | * - the list of remote VTEPs (with this VNI) | |
74 | */ | |
d62a17ae | 75 | struct zebra_vni_t_ { |
76 | /* VNI - key */ | |
77 | vni_t vni; | |
18a7a601 | 78 | |
ce5160c0 AK |
79 | /* ES flags */ |
80 | uint32_t flags; | |
81 | #define ZVNI_READY_FOR_BGP (1 << 0) /* ready to be sent to BGP */ | |
82 | ||
1a98c087 | 83 | /* Flag for advertising gw macip */ |
d7c0a89a | 84 | uint8_t advertise_gw_macip; |
1a98c087 | 85 | |
278e26de CS |
86 | /* Flag for advertising svi macip */ |
87 | uint8_t advertise_svi_macip; | |
88 | ||
31310b25 | 89 | /* Flag for advertising gw macip */ |
d7c0a89a | 90 | uint8_t advertise_subnet; |
31310b25 | 91 | |
d62a17ae | 92 | /* Corresponding VxLAN interface. */ |
93 | struct interface *vxlan_if; | |
18a7a601 | 94 | |
d62a17ae | 95 | /* List of remote VTEPs */ |
96 | zebra_vtep_t *vteps; | |
18a7a601 | 97 | |
d62a17ae | 98 | /* Local IP */ |
99 | struct in_addr local_vtep_ip; | |
4122e252 | 100 | |
3d434f5c AK |
101 | /* PIM-SM MDT group for BUM flooding */ |
102 | struct in_addr mcast_grp; | |
103 | ||
b7cfce93 MK |
104 | /* tenant VRF, if any */ |
105 | vrf_id_t vrf_id; | |
106 | ||
d62a17ae | 107 | /* List of local or remote MAC */ |
108 | struct hash *mac_table; | |
4122e252 | 109 | |
d62a17ae | 110 | /* List of local or remote neighbors (MAC+IP) */ |
111 | struct hash *neigh_table; | |
ce5160c0 AK |
112 | |
113 | /* RB tree of ES-EVIs */ | |
114 | struct zebra_es_evi_rb_head es_evi_rb_tree; | |
115 | ||
116 | /* List of local ESs */ | |
117 | struct list *local_es_evi_list; | |
4122e252 | 118 | }; |
119 | ||
b7cfce93 MK |
120 | /* L3 VNI hash table */ |
121 | struct zebra_l3vni_t_ { | |
122 | ||
123 | /* VNI key */ | |
124 | vni_t vni; | |
125 | ||
126 | /* vrf_id */ | |
127 | vrf_id_t vrf_id; | |
128 | ||
c48d9f5f MK |
129 | uint32_t filter; |
130 | #define PREFIX_ROUTES_ONLY (1 << 0) /* l3-vni used for prefix routes only */ | |
131 | ||
b67a60d2 | 132 | /* Local IP */ |
133 | struct in_addr local_vtep_ip; | |
134 | ||
b7cfce93 MK |
135 | /* kernel interface for l3vni */ |
136 | struct interface *vxlan_if; | |
137 | ||
138 | /* SVI interface corresponding to the l3vni */ | |
139 | struct interface *svi_if; | |
140 | ||
06d9cde5 CS |
141 | struct interface *mac_vlan_if; |
142 | ||
b7cfce93 MK |
143 | /* list of L2 VNIs associated with the L3 VNI */ |
144 | struct list *l2vnis; | |
145 | ||
146 | /* list of remote router-macs */ | |
147 | struct hash *rmac_table; | |
148 | ||
149 | /* list of remote vtep-ip neigh */ | |
150 | struct hash *nh_table; | |
151 | }; | |
152 | ||
153 | /* get the vx-intf name for l3vni */ | |
154 | static inline const char *zl3vni_vxlan_if_name(zebra_l3vni_t *zl3vni) | |
155 | { | |
156 | return zl3vni->vxlan_if ? zl3vni->vxlan_if->name : "None"; | |
157 | } | |
158 | ||
159 | /* get the svi intf name for l3vni */ | |
160 | static inline const char *zl3vni_svi_if_name(zebra_l3vni_t *zl3vni) | |
161 | { | |
162 | return zl3vni->svi_if ? zl3vni->svi_if->name : "None"; | |
163 | } | |
164 | ||
165 | /* get the vrf name for l3vni */ | |
166 | static inline const char *zl3vni_vrf_name(zebra_l3vni_t *zl3vni) | |
167 | { | |
168 | return vrf_id_to_name(zl3vni->vrf_id); | |
169 | } | |
170 | ||
171 | /* get the rmac string */ | |
172 | static inline const char *zl3vni_rmac2str(zebra_l3vni_t *zl3vni, char *buf, | |
173 | int size) | |
174 | { | |
175 | char *ptr; | |
176 | ||
177 | if (!buf) | |
8264e9b7 | 178 | ptr = XMALLOC(MTYPE_TMP, ETHER_ADDR_STRLEN * sizeof(char)); |
b7cfce93 MK |
179 | else { |
180 | assert(size >= ETHER_ADDR_STRLEN); | |
181 | ptr = buf; | |
182 | } | |
183 | ||
28ad0501 CS |
184 | if (zl3vni->mac_vlan_if) |
185 | snprintf(ptr, (ETHER_ADDR_STRLEN), | |
186 | "%02x:%02x:%02x:%02x:%02x:%02x", | |
187 | (uint8_t)zl3vni->mac_vlan_if->hw_addr[0], | |
188 | (uint8_t)zl3vni->mac_vlan_if->hw_addr[1], | |
189 | (uint8_t)zl3vni->mac_vlan_if->hw_addr[2], | |
190 | (uint8_t)zl3vni->mac_vlan_if->hw_addr[3], | |
191 | (uint8_t)zl3vni->mac_vlan_if->hw_addr[4], | |
192 | (uint8_t)zl3vni->mac_vlan_if->hw_addr[5]); | |
193 | else if (zl3vni->svi_if) | |
194 | snprintf(ptr, (ETHER_ADDR_STRLEN), | |
195 | "%02x:%02x:%02x:%02x:%02x:%02x", | |
196 | (uint8_t)zl3vni->svi_if->hw_addr[0], | |
197 | (uint8_t)zl3vni->svi_if->hw_addr[1], | |
198 | (uint8_t)zl3vni->svi_if->hw_addr[2], | |
199 | (uint8_t)zl3vni->svi_if->hw_addr[3], | |
200 | (uint8_t)zl3vni->svi_if->hw_addr[4], | |
201 | (uint8_t)zl3vni->svi_if->hw_addr[5]); | |
202 | else | |
203 | snprintf(ptr, ETHER_ADDR_STRLEN, "None"); | |
204 | ||
205 | return ptr; | |
206 | } | |
207 | ||
208 | /* get the sys mac string */ | |
209 | static inline const char *zl3vni_sysmac2str(zebra_l3vni_t *zl3vni, char *buf, | |
210 | int size) | |
211 | { | |
212 | char *ptr; | |
213 | ||
214 | if (!buf) | |
8264e9b7 | 215 | ptr = XMALLOC(MTYPE_TMP, ETHER_ADDR_STRLEN * sizeof(char)); |
28ad0501 CS |
216 | else { |
217 | assert(size >= ETHER_ADDR_STRLEN); | |
218 | ptr = buf; | |
219 | } | |
220 | ||
b7cfce93 MK |
221 | if (zl3vni->svi_if) |
222 | snprintf(ptr, (ETHER_ADDR_STRLEN), | |
223 | "%02x:%02x:%02x:%02x:%02x:%02x", | |
224 | (uint8_t)zl3vni->svi_if->hw_addr[0], | |
225 | (uint8_t)zl3vni->svi_if->hw_addr[1], | |
226 | (uint8_t)zl3vni->svi_if->hw_addr[2], | |
227 | (uint8_t)zl3vni->svi_if->hw_addr[3], | |
228 | (uint8_t)zl3vni->svi_if->hw_addr[4], | |
229 | (uint8_t)zl3vni->svi_if->hw_addr[5]); | |
230 | else | |
231 | snprintf(ptr, ETHER_ADDR_STRLEN, "None"); | |
232 | ||
233 | return ptr; | |
234 | } | |
235 | ||
236 | /* | |
237 | * l3-vni is oper up when: | |
655b04d1 | 238 | * 0. if EVPN is enabled (advertise-all-vni cfged) |
b7cfce93 MK |
239 | * 1. it is associated to a vxlan-intf |
240 | * 2. Associated vxlan-intf is oper up | |
241 | * 3. it is associated to an SVI | |
242 | * 4. associated SVI is oper up | |
243 | */ | |
244 | static inline int is_l3vni_oper_up(zebra_l3vni_t *zl3vni) | |
245 | { | |
996c9314 LB |
246 | return (is_evpn_enabled() && zl3vni && (zl3vni->vrf_id != VRF_UNKNOWN) |
247 | && zl3vni->vxlan_if && if_is_operative(zl3vni->vxlan_if) | |
248 | && zl3vni->svi_if && if_is_operative(zl3vni->svi_if)); | |
b7cfce93 MK |
249 | } |
250 | ||
251 | static inline const char *zl3vni_state2str(zebra_l3vni_t *zl3vni) | |
252 | { | |
253 | if (!zl3vni) | |
254 | return NULL; | |
255 | ||
256 | if (is_l3vni_oper_up(zl3vni)) | |
257 | return "Up"; | |
258 | else | |
259 | return "Down"; | |
260 | ||
261 | return NULL; | |
262 | } | |
263 | ||
264 | static inline vrf_id_t zl3vni_vrf_id(zebra_l3vni_t *zl3vni) | |
265 | { | |
266 | return zl3vni->vrf_id; | |
267 | } | |
268 | ||
06d9cde5 CS |
269 | static inline void zl3vni_get_svi_rmac(zebra_l3vni_t *zl3vni, |
270 | struct ethaddr *rmac) | |
b7cfce93 MK |
271 | { |
272 | if (!zl3vni) | |
273 | return; | |
274 | ||
275 | if (!is_l3vni_oper_up(zl3vni)) | |
276 | return; | |
277 | ||
278 | if (zl3vni->svi_if && if_is_operative(zl3vni->svi_if)) | |
279 | memcpy(rmac->octet, zl3vni->svi_if->hw_addr, ETH_ALEN); | |
280 | } | |
281 | ||
5e1b0650 DS |
282 | struct host_rb_entry { |
283 | RB_ENTRY(host_rb_entry) hl_entry; | |
284 | ||
285 | struct prefix p; | |
286 | }; | |
287 | ||
85442b09 DS |
288 | RB_HEAD(host_rb_tree_entry, host_rb_entry); |
289 | RB_PROTOTYPE(host_rb_tree_entry, host_rb_entry, hl_entry, | |
5e1b0650 | 290 | host_rb_entry_compare); |
4122e252 | 291 | /* |
292 | * MAC hash table. | |
293 | * | |
294 | * This table contains the MAC addresses pertaining to this VNI. | |
295 | * This includes local MACs learnt on an attached VLAN that maps | |
296 | * to this VNI as well as remote MACs learnt and installed by BGP. | |
297 | * Local MACs will be known either on a VLAN sub-interface or | |
298 | * on (port, VLAN); however, it is sufficient for zebra to maintain | |
299 | * against the VNI i.e., it does not need to retain the local "port" | |
300 | * information. The correct VNI will be obtained as zebra maintains | |
301 | * the mapping (of VLAN to VNI). | |
302 | */ | |
d62a17ae | 303 | struct zebra_mac_t_ { |
304 | /* MAC address. */ | |
305 | struct ethaddr macaddr; | |
4122e252 | 306 | |
d7c0a89a | 307 | uint32_t flags; |
4122e252 | 308 | #define ZEBRA_MAC_LOCAL 0x01 |
309 | #define ZEBRA_MAC_REMOTE 0x02 | |
310 | #define ZEBRA_MAC_AUTO 0x04 /* Auto created for neighbor. */ | |
c85c03c7 | 311 | #define ZEBRA_MAC_STICKY 0x08 /* Static MAC */ |
b7cfce93 | 312 | #define ZEBRA_MAC_REMOTE_RMAC 0x10 /* remote router mac */ |
ead40654 | 313 | #define ZEBRA_MAC_DEF_GW 0x20 |
51f4dab4 AK |
314 | /* remote VTEP advertised MAC as default GW */ |
315 | #define ZEBRA_MAC_REMOTE_DEF_GW 0x40 | |
e22a946a | 316 | #define ZEBRA_MAC_DUPLICATE 0x80 |
d4d4ec1c | 317 | #define ZEBRA_MAC_FPM_SENT 0x100 /* whether or not this entry was sent. */ |
b169fd6f AK |
318 | /* MAC is locally active on an ethernet segment peer */ |
319 | #define ZEBRA_MAC_ES_PEER_ACTIVE 0x200 | |
320 | /* MAC has been proxy-advertised by peers. This means we need to | |
321 | * keep the entry for forwarding but cannot advertise it | |
322 | */ | |
323 | #define ZEBRA_MAC_ES_PEER_PROXY 0x400 | |
324 | /* We have not been able to independently establish that the host is | |
325 | * local connected but one or more ES peers claims it is. | |
326 | * We will maintain the entry for forwarding purposes and continue | |
327 | * to advertise it as locally attached but with a "proxy" flag | |
328 | */ | |
329 | #define ZEBRA_MAC_LOCAL_INACTIVE 0x800 | |
330 | ||
331 | #define ZEBRA_MAC_ALL_LOCAL_FLAGS (ZEBRA_MAC_LOCAL |\ | |
332 | ZEBRA_MAC_LOCAL_INACTIVE) | |
333 | #define ZEBRA_MAC_ALL_PEER_FLAGS (ZEBRA_MAC_ES_PEER_PROXY |\ | |
334 | ZEBRA_MAC_ES_PEER_ACTIVE) | |
e22a946a CS |
335 | |
336 | /* back pointer to zvni */ | |
337 | zebra_vni_t *zvni; | |
4122e252 | 338 | |
d62a17ae | 339 | /* Local or remote info. */ |
340 | union { | |
341 | struct { | |
342 | ifindex_t ifindex; | |
343 | vlanid_t vid; | |
344 | } local; | |
4122e252 | 345 | |
d62a17ae | 346 | struct in_addr r_vtep_ip; |
347 | } fwd_info; | |
4122e252 | 348 | |
ce5160c0 AK |
349 | /* Local or remote ES */ |
350 | struct zebra_evpn_es *es; | |
b169fd6f AK |
351 | /* memory used to link the mac to the es */ |
352 | struct listnode es_listnode; | |
ce5160c0 | 353 | |
f07e1c99 | 354 | /* Mobility sequence numbers associated with this entry. */ |
355 | uint32_t rem_seq; | |
356 | uint32_t loc_seq; | |
357 | ||
b6938a74 MK |
358 | /* List of neigh associated with this mac */ |
359 | struct list *neigh_list; | |
b7cfce93 | 360 | |
6134fd82 | 361 | /* list of hosts pointing to this remote RMAC */ |
85442b09 | 362 | struct host_rb_tree_entry host_rb; |
e22a946a CS |
363 | |
364 | /* Duplicate mac detection */ | |
365 | uint32_t dad_count; | |
366 | ||
367 | struct thread *dad_mac_auto_recovery_timer; | |
368 | ||
369 | struct timeval detect_start_time; | |
370 | ||
371 | time_t dad_dup_detect_time; | |
b169fd6f AK |
372 | |
373 | /* used for ageing out the PEER_ACTIVE flag */ | |
374 | struct thread *hold_timer; | |
375 | ||
376 | /* number of neigh entries (using this mac) that have | |
377 | * ZEBRA_MAC_ES_PEER_ACTIVE or ZEBRA_NEIGH_ES_PEER_PROXY | |
378 | */ | |
379 | uint32_t sync_neigh_cnt; | |
4122e252 | 380 | }; |
381 | ||
382 | /* | |
383 | * Context for MAC hash walk - used by callbacks. | |
384 | */ | |
d62a17ae | 385 | struct mac_walk_ctx { |
386 | zebra_vni_t *zvni; /* VNI hash */ | |
387 | struct zebra_vrf *zvrf; /* VRF - for client notification. */ | |
388 | int uninstall; /* uninstall from kernel? */ | |
389 | int upd_client; /* uninstall from client? */ | |
390 | ||
d7c0a89a | 391 | uint32_t flags; |
4122e252 | 392 | #define DEL_LOCAL_MAC 0x1 |
393 | #define DEL_REMOTE_MAC 0x2 | |
394 | #define DEL_ALL_MAC (DEL_LOCAL_MAC | DEL_REMOTE_MAC) | |
395 | #define DEL_REMOTE_MAC_FROM_VTEP 0x4 | |
396 | #define SHOW_REMOTE_MAC_FROM_VTEP 0x8 | |
397 | ||
d62a17ae | 398 | struct in_addr r_vtep_ip; /* To walk MACs from specific VTEP */ |
4122e252 | 399 | |
cd233079 | 400 | struct vty *vty; /* Used by VTY handlers */ |
d7c0a89a | 401 | uint32_t count; /* Used by VTY handlers */ |
cd233079 | 402 | struct json_object *json; /* Used for JSON Output */ |
1374d4db | 403 | bool print_dup; /* Used to print dup addr list */ |
4122e252 | 404 | }; |
405 | ||
b7cfce93 MK |
406 | struct rmac_walk_ctx { |
407 | struct vty *vty; | |
408 | struct json_object *json; | |
409 | }; | |
410 | ||
b169fd6f AK |
411 | /* temporary datastruct to pass info between the mac-update and |
412 | * neigh-update while handling mac-ip routes | |
413 | */ | |
414 | struct sync_mac_ip_ctx { | |
415 | bool ignore_macip; | |
416 | bool mac_created; | |
417 | bool mac_inactive; | |
418 | bool mac_dp_update_deferred; | |
419 | zebra_mac_t *mac; | |
420 | }; | |
421 | ||
2c476b72 | 422 | #define IS_ZEBRA_NEIGH_ACTIVE(n) (n->state == ZEBRA_NEIGH_ACTIVE) |
b6938a74 | 423 | |
2c476b72 | 424 | #define IS_ZEBRA_NEIGH_INACTIVE(n) (n->state == ZEBRA_NEIGH_INACTIVE) |
b6938a74 MK |
425 | |
426 | #define ZEBRA_NEIGH_SET_ACTIVE(n) n->state = ZEBRA_NEIGH_ACTIVE | |
427 | ||
428 | #define ZEBRA_NEIGH_SET_INACTIVE(n) n->state = ZEBRA_NEIGH_INACTIVE | |
429 | ||
4122e252 | 430 | /* |
431 | * Neighbor hash table. | |
432 | * | |
433 | * This table contains the neighbors (IP to MAC bindings) pertaining to | |
434 | * this VNI. This includes local neighbors learnt on the attached VLAN | |
435 | * device that maps to this VNI as well as remote neighbors learnt and | |
436 | * installed by BGP. | |
437 | * Local neighbors will be known against the VLAN device (SVI); however, | |
438 | * it is sufficient for zebra to maintain against the VNI. The correct | |
439 | * VNI will be obtained as zebra maintains the mapping (of VLAN to VNI). | |
440 | */ | |
d62a17ae | 441 | struct zebra_neigh_t_ { |
442 | /* IP address. */ | |
443 | struct ipaddr ip; | |
4122e252 | 444 | |
d62a17ae | 445 | /* MAC address. */ |
446 | struct ethaddr emac; | |
4122e252 | 447 | |
ce5160c0 AK |
448 | /* Back pointer to MAC. Only applicable to hosts in a L2-VNI. */ |
449 | zebra_mac_t *mac; | |
450 | ||
d62a17ae | 451 | /* Underlying interface. */ |
452 | ifindex_t ifindex; | |
4122e252 | 453 | |
c80a972c CS |
454 | zebra_vni_t *zvni; |
455 | ||
d7c0a89a | 456 | uint32_t flags; |
b6938a74 MK |
457 | #define ZEBRA_NEIGH_LOCAL 0x01 |
458 | #define ZEBRA_NEIGH_REMOTE 0x02 | |
b7cfce93 | 459 | #define ZEBRA_NEIGH_REMOTE_NH 0x04 /* neigh entry for remote vtep */ |
ead40654 | 460 | #define ZEBRA_NEIGH_DEF_GW 0x08 |
68e33151 | 461 | #define ZEBRA_NEIGH_ROUTER_FLAG 0x10 |
e22a946a | 462 | #define ZEBRA_NEIGH_DUPLICATE 0x20 |
0ca10580 | 463 | #define ZEBRA_NEIGH_SVI_IP 0x40 |
b169fd6f AK |
464 | /* rxed from an ES peer */ |
465 | #define ZEBRA_NEIGH_ES_PEER_ACTIVE 0x80 | |
466 | /* rxed from an ES peer as a proxy advertisement */ | |
467 | #define ZEBRA_NEIGH_ES_PEER_PROXY 0x100 | |
468 | /* We have not been able to independently establish that the host | |
469 | * is local connected | |
470 | */ | |
471 | #define ZEBRA_NEIGH_LOCAL_INACTIVE 0x200 | |
472 | #define ZEBRA_NEIGH_ALL_LOCAL_FLAGS (ZEBRA_NEIGH_LOCAL |\ | |
473 | ZEBRA_NEIGH_LOCAL_INACTIVE) | |
474 | #define ZEBRA_NEIGH_ALL_PEER_FLAGS (ZEBRA_NEIGH_ES_PEER_PROXY |\ | |
475 | ZEBRA_NEIGH_ES_PEER_ACTIVE) | |
b6938a74 MK |
476 | |
477 | enum zebra_neigh_state state; | |
4122e252 | 478 | |
d62a17ae | 479 | /* Remote VTEP IP - applicable only for remote neighbors. */ |
480 | struct in_addr r_vtep_ip; | |
b7cfce93 | 481 | |
f07e1c99 | 482 | /* |
483 | * Mobility sequence numbers associated with this entry. The rem_seq | |
484 | * represents the sequence number from the client (BGP) for the most | |
485 | * recent add or update of this entry while the loc_seq represents | |
486 | * the sequence number informed (or to be informed) by zebra to BGP | |
487 | * for this entry. | |
488 | */ | |
489 | uint32_t rem_seq; | |
490 | uint32_t loc_seq; | |
491 | ||
6134fd82 | 492 | /* list of hosts pointing to this remote NH entry */ |
85442b09 | 493 | struct host_rb_tree_entry host_rb; |
e22a946a CS |
494 | |
495 | /* Duplicate ip detection */ | |
496 | uint32_t dad_count; | |
497 | ||
498 | struct thread *dad_ip_auto_recovery_timer; | |
499 | ||
500 | struct timeval detect_start_time; | |
501 | ||
502 | time_t dad_dup_detect_time; | |
b169fd6f AK |
503 | |
504 | /* used for ageing out the PEER_ACTIVE flag */ | |
505 | struct thread *hold_timer; | |
4122e252 | 506 | }; |
507 | ||
508 | /* | |
509 | * Context for neighbor hash walk - used by callbacks. | |
510 | */ | |
d62a17ae | 511 | struct neigh_walk_ctx { |
512 | zebra_vni_t *zvni; /* VNI hash */ | |
513 | struct zebra_vrf *zvrf; /* VRF - for client notification. */ | |
514 | int uninstall; /* uninstall from kernel? */ | |
515 | int upd_client; /* uninstall from client? */ | |
516 | ||
d7c0a89a | 517 | uint32_t flags; |
4122e252 | 518 | #define DEL_LOCAL_NEIGH 0x1 |
519 | #define DEL_REMOTE_NEIGH 0x2 | |
520 | #define DEL_ALL_NEIGH (DEL_LOCAL_NEIGH | DEL_REMOTE_NEIGH) | |
521 | #define DEL_REMOTE_NEIGH_FROM_VTEP 0x4 | |
522 | #define SHOW_REMOTE_NEIGH_FROM_VTEP 0x8 | |
523 | ||
d62a17ae | 524 | struct in_addr r_vtep_ip; /* To walk neighbors from specific VTEP */ |
4122e252 | 525 | |
cd233079 | 526 | struct vty *vty; /* Used by VTY handlers */ |
d7c0a89a QY |
527 | uint32_t count; /* Used by VTY handlers */ |
528 | uint8_t addr_width; /* Used by VTY handlers */ | |
cd233079 | 529 | struct json_object *json; /* Used for JSON Output */ |
18a7a601 | 530 | }; |
531 | ||
b7cfce93 MK |
532 | /* context for neigh hash walk - update l3vni and rmac */ |
533 | struct neigh_l3info_walk_ctx { | |
534 | ||
535 | zebra_vni_t *zvni; | |
536 | zebra_l3vni_t *zl3vni; | |
537 | int add; | |
538 | }; | |
539 | ||
540 | struct nh_walk_ctx { | |
541 | ||
542 | struct vty *vty; | |
543 | struct json_object *json; | |
544 | }; | |
545 | ||
9d21b7c6 | 546 | extern zebra_l3vni_t *zl3vni_from_vrf(vrf_id_t vrf_id); |
a780a738 AD |
547 | extern struct interface *zl3vni_map_to_vxlan_if(zebra_l3vni_t *zl3vni); |
548 | extern struct interface *zl3vni_map_to_svi_if(zebra_l3vni_t *zl3vni); | |
06d9cde5 | 549 | extern struct interface *zl3vni_map_to_mac_vlan_if(zebra_l3vni_t *zl3vni); |
e2bcfa39 | 550 | extern zebra_l3vni_t *zl3vni_lookup(vni_t vni); |
a780a738 AD |
551 | |
552 | DECLARE_HOOK(zebra_rmac_update, (zebra_mac_t *rmac, zebra_l3vni_t *zl3vni, | |
553 | bool delete, const char *reason), (rmac, zl3vni, delete, reason)) | |
554 | ||
9d21b7c6 | 555 | |
51e94aa7 EDP |
556 | #ifdef __cplusplus |
557 | } | |
558 | #endif | |
559 | ||
8a93734c AK |
560 | /* |
561 | * Multicast hash table. | |
562 | * | |
563 | * This table contains - | |
564 | * 1. The (S, G) entries used for encapsulating and forwarding BUM traffic. | |
565 | * S is the local VTEP-IP and G is a BUM mcast group address. | |
566 | * 2. The (X, G) entries used for terminating a BUM flow. | |
567 | * Multiple L2-VNIs can share the same MDT hence the need to maintain | |
568 | * an aggregated table that pimd can consume without much | |
569 | * re-interpretation. | |
570 | */ | |
571 | typedef struct zebra_vxlan_sg_ { | |
572 | struct zebra_vrf *zvrf; | |
573 | ||
574 | struct prefix_sg sg; | |
575 | char sg_str[PREFIX_SG_STR_LEN]; | |
576 | ||
577 | /* For SG - num of L2 VNIs using this entry for sending BUM traffic */ | |
578 | /* For XG - num of SG using this as parent */ | |
579 | uint32_t ref_cnt; | |
580 | } zebra_vxlan_sg_t; | |
581 | ||
ce5160c0 | 582 | extern zebra_vni_t *zvni_lookup(vni_t vni); |
b169fd6f AK |
583 | extern void zebra_vxlan_sync_mac_dp_install(zebra_mac_t *mac, bool set_inactive, |
584 | bool force_clear_static, const char *caller); | |
ce5160c0 | 585 | |
18a7a601 | 586 | #endif /* _ZEBRA_VXLAN_PRIVATE_H */ |