]>
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 | ||
29 | #include <zebra.h> | |
30 | ||
31 | #include "if.h" | |
32 | #include "linklist.h" | |
33 | ||
34 | /* definitions */ | |
35 | typedef struct zebra_vni_t_ zebra_vni_t; | |
36 | typedef struct zebra_vtep_t_ zebra_vtep_t; | |
4122e252 | 37 | typedef struct zebra_mac_t_ zebra_mac_t; |
38 | typedef struct zebra_neigh_t_ zebra_neigh_t; | |
18a7a601 | 39 | |
40 | /* | |
41 | * VTEP info | |
42 | * | |
43 | * Right now, this just has each remote VTEP's IP address. | |
44 | */ | |
45 | struct zebra_vtep_t_ | |
46 | { | |
47 | /* Remote IP. */ | |
48 | /* NOTE: Can only be IPv4 right now. */ | |
49 | struct in_addr vtep_ip; | |
50 | ||
51 | /* Links. */ | |
52 | struct zebra_vtep_t_ *next; | |
53 | struct zebra_vtep_t_ *prev; | |
54 | }; | |
55 | ||
56 | ||
57 | /* | |
58 | * VNI hash table | |
59 | * | |
60 | * Contains information pertaining to a VNI: | |
61 | * - the list of remote VTEPs (with this VNI) | |
62 | */ | |
63 | struct zebra_vni_t_ | |
64 | { | |
65 | /* VNI - key */ | |
66 | vni_t vni; | |
67 | ||
68 | /* Corresponding VxLAN interface. */ | |
69 | struct interface *vxlan_if; | |
70 | ||
71 | /* List of remote VTEPs */ | |
72 | zebra_vtep_t *vteps; | |
73 | ||
74 | /* Local IP */ | |
75 | struct in_addr local_vtep_ip; | |
4122e252 | 76 | |
77 | /* List of local or remote MAC */ | |
78 | struct hash *mac_table; | |
79 | ||
80 | /* List of local or remote neighbors (MAC+IP) */ | |
81 | struct hash *neigh_table; | |
82 | }; | |
83 | ||
84 | /* | |
85 | * MAC hash table. | |
86 | * | |
87 | * This table contains the MAC addresses pertaining to this VNI. | |
88 | * This includes local MACs learnt on an attached VLAN that maps | |
89 | * to this VNI as well as remote MACs learnt and installed by BGP. | |
90 | * Local MACs will be known either on a VLAN sub-interface or | |
91 | * on (port, VLAN); however, it is sufficient for zebra to maintain | |
92 | * against the VNI i.e., it does not need to retain the local "port" | |
93 | * information. The correct VNI will be obtained as zebra maintains | |
94 | * the mapping (of VLAN to VNI). | |
95 | */ | |
96 | struct zebra_mac_t_ | |
97 | { | |
98 | /* MAC address. */ | |
99 | struct ethaddr macaddr; | |
100 | ||
101 | u_int32_t flags; | |
102 | #define ZEBRA_MAC_LOCAL 0x01 | |
103 | #define ZEBRA_MAC_REMOTE 0x02 | |
104 | #define ZEBRA_MAC_AUTO 0x04 /* Auto created for neighbor. */ | |
105 | ||
106 | /* Local or remote info. */ | |
107 | union | |
108 | { | |
109 | struct | |
110 | { | |
111 | ifindex_t ifindex; | |
112 | vlanid_t vid; | |
113 | } local; | |
114 | ||
115 | struct in_addr r_vtep_ip; | |
116 | } fwd_info; | |
117 | ||
118 | u_int32_t neigh_refcnt; | |
119 | }; | |
120 | ||
121 | /* | |
122 | * Context for MAC hash walk - used by callbacks. | |
123 | */ | |
124 | struct mac_walk_ctx | |
125 | { | |
126 | zebra_vni_t *zvni; /* VNI hash */ | |
127 | struct zebra_vrf *zvrf; /* VRF - for client notification. */ | |
128 | int uninstall; /* uninstall from kernel? */ | |
129 | int upd_client; /* uninstall from client? */ | |
130 | ||
131 | u_int32_t flags; | |
132 | #define DEL_LOCAL_MAC 0x1 | |
133 | #define DEL_REMOTE_MAC 0x2 | |
134 | #define DEL_ALL_MAC (DEL_LOCAL_MAC | DEL_REMOTE_MAC) | |
135 | #define DEL_REMOTE_MAC_FROM_VTEP 0x4 | |
136 | #define SHOW_REMOTE_MAC_FROM_VTEP 0x8 | |
137 | ||
138 | struct in_addr r_vtep_ip; /* To walk MACs from specific VTEP */ | |
139 | ||
140 | struct vty *vty; /* Used by VTY handlers */ | |
141 | u_int32_t count; /* Used by VTY handlers */ | |
142 | }; | |
143 | ||
144 | /* | |
145 | * Neighbor hash table. | |
146 | * | |
147 | * This table contains the neighbors (IP to MAC bindings) pertaining to | |
148 | * this VNI. This includes local neighbors learnt on the attached VLAN | |
149 | * device that maps to this VNI as well as remote neighbors learnt and | |
150 | * installed by BGP. | |
151 | * Local neighbors will be known against the VLAN device (SVI); however, | |
152 | * it is sufficient for zebra to maintain against the VNI. The correct | |
153 | * VNI will be obtained as zebra maintains the mapping (of VLAN to VNI). | |
154 | */ | |
155 | struct zebra_neigh_t_ | |
156 | { | |
157 | /* IP address. */ | |
158 | struct ipaddr ip; | |
159 | ||
160 | /* MAC address. */ | |
161 | struct ethaddr emac; | |
162 | ||
163 | /* Underlying interface. */ | |
164 | ifindex_t ifindex; | |
165 | ||
166 | u_int32_t flags; | |
167 | #define ZEBRA_NEIGH_LOCAL 0x01 | |
168 | #define ZEBRA_NEIGH_REMOTE 0x02 | |
169 | ||
170 | /* Remote VTEP IP - applicable only for remote neighbors. */ | |
171 | struct in_addr r_vtep_ip; | |
172 | }; | |
173 | ||
174 | /* | |
175 | * Context for neighbor hash walk - used by callbacks. | |
176 | */ | |
177 | struct neigh_walk_ctx | |
178 | { | |
179 | zebra_vni_t *zvni; /* VNI hash */ | |
180 | struct zebra_vrf *zvrf; /* VRF - for client notification. */ | |
181 | int uninstall; /* uninstall from kernel? */ | |
182 | int upd_client; /* uninstall from client? */ | |
183 | ||
184 | u_int32_t flags; | |
185 | #define DEL_LOCAL_NEIGH 0x1 | |
186 | #define DEL_REMOTE_NEIGH 0x2 | |
187 | #define DEL_ALL_NEIGH (DEL_LOCAL_NEIGH | DEL_REMOTE_NEIGH) | |
188 | #define DEL_REMOTE_NEIGH_FROM_VTEP 0x4 | |
189 | #define SHOW_REMOTE_NEIGH_FROM_VTEP 0x8 | |
190 | ||
191 | struct in_addr r_vtep_ip; /* To walk neighbors from specific VTEP */ | |
192 | ||
193 | struct vty *vty; /* Used by VTY handlers */ | |
194 | u_int32_t count; /* Used by VTY handlers */ | |
195 | u_char addr_width; /* Used by VTY handlers */ | |
18a7a601 | 196 | }; |
197 | ||
198 | #endif /* _ZEBRA_VXLAN_PRIVATE_H */ |