Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-zebra.c
blob06a71c05b3d287a53e24f7aa85f05fccbb316009
1 /* packet-zebra.c
2 * Routines for zebra packet disassembly
4 * Jochen Friedrich <jochen@scram.de>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
14 * The Zebra Protocol is the protocol used between the Zebra routing daemon and
15 * other protocol daemons (ones for BGP, OSPF, etc.) within the Zebra, Quagga,
16 * and FRRouting open-source routing suites.
17 * Zebra itself (https://www.gnu.org/software/zebra) is discontinued,
18 * and its successor is Quagga (http://www.nongnu.org/quagga).
19 * The successor to Quagga is FRRouting (https://frrouting.org/).
21 * All three use the "Zebra Protocol" (or ZAPI), but starting with Quagga v0.99
22 * there are different versions, with different header formats and more
23 * commands/types.
25 * http://www.nongnu.org/quagga/docs/docs-info.html#Zebra-Protocol
26 * http://docs.frrouting.org/projects/dev-guide/en/latest/zebra.html
28 * Version 0 (implicit): Zebra, Quagga up to version 0.98
29 * Version 1: Quagga 0.99.3 through 0.99.20
30 * Version 2: Quagga 0.99.21 though 0.99.23
31 * Version 3: Quagga 0.99.24 and later
32 * Version 4: FRRouting 2.0 through 3.0.3
33 * Version 5: FRRouting 4.0 though 5.0.1
34 * Version 6: FRRouting 6.0 and later
36 * FRRouting versions 4 and 5 have partially incompatible commands.
37 * This dissector uses the commands of FRRRouting version 5.
38 * FRRouting versions 6 and 7 have partially incompatible commands.
39 * This dissector uses the commands of FRRRouting version 7.
42 #include "config.h"
44 #include <wsutil/array.h>
45 #include <epan/packet.h>
47 /* Function declarations */
48 void proto_reg_handoff_zebra(void);
49 void proto_register_zebra(void);
51 static dissector_handle_t zebra_handle;
53 static int proto_zebra;
54 static int hf_zebra_len;
55 static int hf_zebra_command;
56 static int hf_zebra_request;
57 static int hf_zebra_interface;
58 static int hf_zebra_index;
59 static int hf_zebra_indexnum;
60 static int hf_zebra_type_v0;
61 static int hf_zebra_type_v1;
62 static int hf_zebra_intflags;
63 static int hf_zebra_rtflags;
64 static int hf_zebra_distance;
65 static int hf_zebra_metric;
66 static int hf_zebra_mtu;
67 static int hf_zebra_mtu6;
68 static int hf_zebra_bandwidth;
69 static int hf_zebra_family;
70 static int hf_zebra_flags;
71 static int hf_zebra_message;
72 static int hf_zebra_route_safi;
73 static int hf_zebra_msg_nexthop;
74 static int hf_zebra_msg_index;
75 static int hf_zebra_msg_distance;
76 static int hf_zebra_msg_metric;
77 static int hf_zebra_nexthopnum;
78 static int hf_zebra_nexthop4;
79 static int hf_zebra_nexthop6;
80 static int hf_zebra_dest4;
81 static int hf_zebra_dest6;
82 static int hf_zebra_prefixlen;
83 static int hf_zebra_prefix4;
84 static int hf_zebra_prefix6;
85 static int hf_zebra_version;
86 static int hf_zebra_marker;
87 static int hf_zebra_intstatus;
88 static int hf_zebra_routeridaddress;
89 static int hf_zebra_routeridmask;
90 static int hf_zebra_mac;
91 static int hf_zebra_redist_default;
92 static int hf_zebra_vrfid;
93 static int hf_zebra_routeridfamily;
94 static int hf_zebra_nexthoptype;
95 static int hf_zebra_msg_mtu;
96 static int hf_zebra_msg_tag;
97 static int hf_zebra_tag;
98 static int hf_zebra_maclen;
99 static int hf_zebra_haslinkparam;
100 /* FRRouting, Zebra API v4, v5 and v6 */
101 static int hf_zebra_command_v4;
102 static int hf_zebra_command_v5;
103 static int hf_zebra_command_v6;
104 static int hf_zebra_type_v4;
105 static int hf_zebra_type_v5;
106 static int hf_zebra_ptmenable;
107 static int hf_zebra_ptmstatus;
108 static int hf_zebra_instance;
109 static int hf_zebra_rtflags_u32;
110 static int hf_zebra_speed;
111 static int hf_zebra_lltype;
112 static int hf_zebra_message4;
113 static int hf_zebra_message5;
114 static int hf_zebra_route_safi_u8;
115 static int hf_zebra_rmac;
116 static int hf_zebra_msg4_tag;
117 static int hf_zebra_msg4_mtu;
118 static int hf_zebra_msg4_srcpfx;
119 static int hf_zebra_msg5_distance;
120 static int hf_zebra_msg5_metric;
121 static int hf_zebra_msg5_tag;
122 static int hf_zebra_msg5_mtu;
123 static int hf_zebra_msg5_srcpfx;
124 static int hf_zebra_msg_label;
125 static int hf_zebra_msg_tableid;
126 static int hf_zebra_nexthopnum_u16;
127 static int hf_zebra_nexthoptype_frr;
128 static int hf_zebra_bhtype;
129 static int hf_zebra_srcprefixlen;
130 static int hf_zebra_srcprefix4;
131 static int hf_zebra_srcprefix6;
132 static int hf_zebra_tableid;
133 static int hf_zebra_afi;
134 static int hf_zebra_pid;
135 static int hf_zebra_vrf_table_id;
136 static int hf_zebra_vrf_netns_name;
137 static int hf_zebra_vrf_name;
138 static int hf_zebra_proto;
139 static int hf_zebra_label_chunk_keep;
140 static int hf_zebra_label_chunk_size;
141 static int hf_zebra_label_chunk_start;
142 static int hf_zebra_label_chunk_end;
143 static int hf_zebra_mpls_enabled;
144 static int hf_zebra_multipath_num;
145 static int hf_zebra_labelnum;
146 static int hf_zebra_label;
147 static int hf_zebra_receive_notify;
149 static int ett_zebra;
150 static int ett_zebra_request;
151 static int ett_message;
153 #define TCP_PORT_ZEBRA 2600 /* Not IANA registered */
155 /* Zebra message types. */
156 #define ZEBRA_INTERFACE_ADD 1
157 #define ZEBRA_INTERFACE_DELETE 2
158 #define ZEBRA_INTERFACE_ADDRESS_ADD 3
159 #define ZEBRA_INTERFACE_ADDRESS_DELETE 4
160 #define ZEBRA_INTERFACE_UP 5
161 #define ZEBRA_INTERFACE_DOWN 6
162 #define ZEBRA_IPV4_ROUTE_ADD 7
163 #define ZEBRA_IPV4_ROUTE_DELETE 8
164 #define ZEBRA_IPV6_ROUTE_ADD 9
165 #define ZEBRA_IPV6_ROUTE_DELETE 10
166 #define ZEBRA_REDISTRIBUTE_ADD 11
167 #define ZEBRA_REDISTRIBUTE_DELETE 12
168 #define ZEBRA_REDISTRIBUTE_DEFAULT_ADD 13
169 #define ZEBRA_REDISTRIBUTE_DEFAULT_DELETE 14
170 #define ZEBRA_IPV4_NEXTHOP_LOOKUP 15
171 #define ZEBRA_IPV6_NEXTHOP_LOOKUP 16
172 #define ZEBRA_IPV4_IMPORT_LOOKUP 17
173 #define ZEBRA_IPV6_IMPORT_LOOKUP 18
174 #define ZEBRA_INTERFACE_RENAME 19
175 #define ZEBRA_ROUTER_ID_ADD 20
176 #define ZEBRA_ROUTER_ID_DELETE 21
177 #define ZEBRA_ROUTER_ID_UPDATE 22
178 #define ZEBRA_HELLO 23
179 #define ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB 24
180 #define ZEBRA_VRF_UNREGISTER 25
181 #define ZEBRA_INTERFACE_LINK_PARAMS 26
182 #define ZEBRA_NEXTHOP_REGISTER 27
183 #define ZEBRA_NEXTHOP_UNREGISTER 28
184 #define ZEBRA_NEXTHOP_UPDATE 29
185 #define ZEBRA_MESSAGE_MAX 30
188 static const value_string messages[] = {
189 { ZEBRA_INTERFACE_ADD, "Add Interface" },
190 { ZEBRA_INTERFACE_DELETE, "Delete Interface" },
191 { ZEBRA_INTERFACE_ADDRESS_ADD, "Add Interface Address" },
192 { ZEBRA_INTERFACE_ADDRESS_DELETE, "Delete Interface Address" },
193 { ZEBRA_INTERFACE_UP, "Interface Up" },
194 { ZEBRA_INTERFACE_DOWN, "Interface Down" },
195 { ZEBRA_IPV4_ROUTE_ADD, "Add IPv4 Route" },
196 { ZEBRA_IPV4_ROUTE_DELETE, "Delete IPv4 Route" },
197 { ZEBRA_IPV6_ROUTE_ADD, "Add IPv6 Route" },
198 { ZEBRA_IPV6_ROUTE_DELETE, "Delete IPv6 Route" },
199 { ZEBRA_REDISTRIBUTE_ADD, "Add Redistribute" },
200 { ZEBRA_REDISTRIBUTE_DELETE, "Delete Redistribute" },
201 { ZEBRA_REDISTRIBUTE_DEFAULT_ADD, "Add Default Redistribute" },
202 { ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, "Delete Default Redistribute" },
203 { ZEBRA_IPV4_NEXTHOP_LOOKUP, "IPv4 Nexthop Lookup" },
204 { ZEBRA_IPV6_NEXTHOP_LOOKUP, "IPv6 Nexthop Lookup" },
205 { ZEBRA_IPV4_IMPORT_LOOKUP, "IPv4 Import Lookup" },
206 { ZEBRA_IPV6_IMPORT_LOOKUP, "IPv6 Import Lookup" },
207 { ZEBRA_INTERFACE_RENAME, "Rename Interface" },
208 { ZEBRA_ROUTER_ID_ADD, "Router ID Add" },
209 { ZEBRA_ROUTER_ID_DELETE, "Router ID Delete" },
210 { ZEBRA_ROUTER_ID_UPDATE, "Router ID Update" },
211 { ZEBRA_HELLO, "Hello" },
212 { ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB, "IPv4 Nexthop Lookup Multicast RIB" },
213 { ZEBRA_VRF_UNREGISTER, "VRF Unregister" },
214 { ZEBRA_INTERFACE_LINK_PARAMS, "Interface Link Parameters" },
215 { ZEBRA_NEXTHOP_REGISTER, "Nexthop Register" },
216 { ZEBRA_NEXTHOP_UNREGISTER, "Nexthop Unregister" },
217 { ZEBRA_NEXTHOP_UPDATE, "Nexthop Update" },
218 { 0, NULL },
221 /* FRRouting ZAPI v4 message types. */
222 enum {
223 FRR_ZAPI4_INTERFACE_ADD,
224 FRR_ZAPI4_INTERFACE_DELETE,
225 FRR_ZAPI4_INTERFACE_ADDRESS_ADD,
226 FRR_ZAPI4_INTERFACE_ADDRESS_DELETE,
227 FRR_ZAPI4_INTERFACE_UP,
228 FRR_ZAPI4_INTERFACE_DOWN,
229 FRR_ZAPI4_IPV4_ROUTE_ADD,
230 FRR_ZAPI4_IPV4_ROUTE_DELETE,
231 FRR_ZAPI4_IPV6_ROUTE_ADD,
232 FRR_ZAPI4_IPV6_ROUTE_DELETE,
233 FRR_ZAPI4_REDISTRIBUTE_ADD,
234 FRR_ZAPI4_REDISTRIBUTE_DELETE,
235 FRR_ZAPI4_REDISTRIBUTE_DEFAULT_ADD,
236 FRR_ZAPI4_REDISTRIBUTE_DEFAULT_DELETE,
237 FRR_ZAPI4_ROUTER_ID_ADD,
238 FRR_ZAPI4_ROUTER_ID_DELETE,
239 FRR_ZAPI4_ROUTER_ID_UPDATE,
240 FRR_ZAPI4_HELLO,
241 FRR_ZAPI4_NEXTHOP_REGISTER,
242 FRR_ZAPI4_NEXTHOP_UNREGISTER,
243 FRR_ZAPI4_NEXTHOP_UPDATE,
244 FRR_ZAPI4_INTERFACE_NBR_ADDRESS_ADD,
245 FRR_ZAPI4_INTERFACE_NBR_ADDRESS_DELETE,
246 FRR_ZAPI4_INTERFACE_BFD_DEST_UPDATE,
247 FRR_ZAPI4_IMPORT_ROUTE_REGISTER,
248 FRR_ZAPI4_IMPORT_ROUTE_UNREGISTER,
249 FRR_ZAPI4_IMPORT_CHECK_UPDATE,
250 FRR_ZAPI4_IPV4_ROUTE_IPV6_NEXTHOP_ADD,
251 FRR_ZAPI4_BFD_DEST_REGISTER,
252 FRR_ZAPI4_BFD_DEST_DEREGISTER,
253 FRR_ZAPI4_BFD_DEST_UPDATE,
254 FRR_ZAPI4_BFD_DEST_REPLAY,
255 FRR_ZAPI4_REDISTRIBUTE_IPV4_ADD,
256 FRR_ZAPI4_REDISTRIBUTE_IPV4_DEL,
257 FRR_ZAPI4_REDISTRIBUTE_IPV6_ADD,
258 FRR_ZAPI4_REDISTRIBUTE_IPV6_DEL,
259 FRR_ZAPI4_VRF_UNREGISTER,
260 FRR_ZAPI4_VRF_ADD,
261 FRR_ZAPI4_VRF_DELETE,
262 FRR_ZAPI4_INTERFACE_VRF_UPDATE,
263 FRR_ZAPI4_BFD_CLIENT_REGISTER,
264 FRR_ZAPI4_INTERFACE_ENABLE_RADV,
265 FRR_ZAPI4_INTERFACE_DISABLE_RADV,
266 FRR_ZAPI4_IPV4_NEXTHOP_LOOKUP_MRIB,
267 FRR_ZAPI4_INTERFACE_LINK_PARAMS,
268 FRR_ZAPI4_MPLS_LABELS_ADD,
269 FRR_ZAPI4_MPLS_LABELS_DELETE,
270 FRR_ZAPI4_IPV4_NEXTHOP_ADD,
271 FRR_ZAPI4_IPV4_NEXTHOP_DELETE,
272 FRR_ZAPI4_IPV6_NEXTHOP_ADD,
273 FRR_ZAPI4_IPV6_NEXTHOP_DELETE,
274 FRR_ZAPI4_IPMR_ROUTE_STATS,
275 FRR_ZAPI4_LABEL_MANAGER_CONNECT,
276 FRR_ZAPI4_GET_LABEL_CHUNK,
277 FRR_ZAPI4_RELEASE_LABEL_CHUNK,
278 FRR_ZAPI4_PW_ADD,
279 FRR_ZAPI4_PW_DELETE,
280 FRR_ZAPI4_PW_SET,
281 FRR_ZAPI4_PW_UNSET,
282 FRR_ZAPI4_PW_STATUS_UPDATE,
285 static const value_string frr_zapi4_messages[] = {
286 { FRR_ZAPI4_INTERFACE_ADD, "Add Interface" },
287 { FRR_ZAPI4_INTERFACE_DELETE, "Delete Interface" },
288 { FRR_ZAPI4_INTERFACE_ADDRESS_ADD, "Add Interface Address" },
289 { FRR_ZAPI4_INTERFACE_ADDRESS_DELETE, "Delete Interface Address" },
290 { FRR_ZAPI4_INTERFACE_UP, "Interface Up" },
291 { FRR_ZAPI4_INTERFACE_DOWN, "Interface Down" },
292 { FRR_ZAPI4_IPV4_ROUTE_ADD, "Add IPv4 Route" },
293 { FRR_ZAPI4_IPV4_ROUTE_DELETE, "Delete IPv4 Route" },
294 { FRR_ZAPI4_IPV6_ROUTE_ADD, "Add IPv6 Route" },
295 { FRR_ZAPI4_IPV6_ROUTE_DELETE, "Delete IPv6 Route" },
296 { FRR_ZAPI4_REDISTRIBUTE_ADD, "Add Redistribute" },
297 { FRR_ZAPI4_REDISTRIBUTE_DELETE, "Delete Redistribute" },
298 { FRR_ZAPI4_REDISTRIBUTE_DEFAULT_ADD, "Add Default Redistribute" },
299 { FRR_ZAPI4_REDISTRIBUTE_DEFAULT_DELETE,"Delete Default Redistribute" },
300 { FRR_ZAPI4_ROUTER_ID_ADD, "Router ID Add" },
301 { FRR_ZAPI4_ROUTER_ID_DELETE, "Router ID Delete" },
302 { FRR_ZAPI4_ROUTER_ID_UPDATE, "Router ID Update" },
303 { FRR_ZAPI4_HELLO, "Hello" },
304 { FRR_ZAPI4_NEXTHOP_REGISTER, "Nexthop Register" },
305 { FRR_ZAPI4_NEXTHOP_UNREGISTER, "Nexthop Unregister" },
306 { FRR_ZAPI4_NEXTHOP_UPDATE, "Nexthop Update" },
307 { FRR_ZAPI4_INTERFACE_NBR_ADDRESS_ADD, "Interface Neighbor Address Add" },
308 { FRR_ZAPI4_INTERFACE_NBR_ADDRESS_DELETE, "Interface Neighbor Address Delete" },
309 { FRR_ZAPI4_INTERFACE_BFD_DEST_UPDATE, "Interface BFD Destination Update" },
310 { FRR_ZAPI4_IMPORT_ROUTE_REGISTER, "Import Route Register" },
311 { FRR_ZAPI4_IMPORT_ROUTE_UNREGISTER, "Import Route Unregister" },
312 { FRR_ZAPI4_IMPORT_CHECK_UPDATE, "Import Check Update" },
313 { FRR_ZAPI4_IPV4_ROUTE_IPV6_NEXTHOP_ADD,"Add IPv6 nexthop for IPv4 Route" },
314 { FRR_ZAPI4_BFD_DEST_REGISTER, "BFD Destination Register" },
315 { FRR_ZAPI4_BFD_DEST_DEREGISTER, "BFD Destination Deregister" },
316 { FRR_ZAPI4_BFD_DEST_UPDATE, "BFD Destination Update" },
317 { FRR_ZAPI4_BFD_DEST_REPLAY, "BFD Destination Replay" },
318 { FRR_ZAPI4_REDISTRIBUTE_IPV4_ADD, "Add Redistribute IPv4 Route" },
319 { FRR_ZAPI4_REDISTRIBUTE_IPV4_DEL, "Delete Redistribute IPv4 Route" },
320 { FRR_ZAPI4_REDISTRIBUTE_IPV6_ADD, "Add Redistribute IPv6 Route" },
321 { FRR_ZAPI4_REDISTRIBUTE_IPV6_DEL, "Delete Redistribute IPv6 Route" },
322 { FRR_ZAPI4_VRF_UNREGISTER, "VRF Unregister" },
323 { FRR_ZAPI4_VRF_ADD, "VRF Add" },
324 { FRR_ZAPI4_VRF_DELETE, "VRF Delete" },
325 { FRR_ZAPI4_INTERFACE_VRF_UPDATE, "Interface VRF Update" },
326 { FRR_ZAPI4_BFD_CLIENT_REGISTER, "BFD Client Register" },
327 { FRR_ZAPI4_INTERFACE_ENABLE_RADV, "Interface Enable Router Advertisement" },
328 { FRR_ZAPI4_INTERFACE_DISABLE_RADV, "Interface Disable Router Advertisement" },
329 { FRR_ZAPI4_IPV4_NEXTHOP_LOOKUP_MRIB, "IPv4 Nexthop Lookup Multicast RIB" },
330 { FRR_ZAPI4_INTERFACE_LINK_PARAMS, "Interface Link Parameters" },
331 { FRR_ZAPI4_MPLS_LABELS_ADD, "MPLS Labels Add" },
332 { FRR_ZAPI4_MPLS_LABELS_DELETE, "MPLS Labels Delete" },
333 { FRR_ZAPI4_IPV4_NEXTHOP_ADD, "Add IPv4 Nexthop" },
334 { FRR_ZAPI4_IPV4_NEXTHOP_DELETE, "Delete IPv4 Nexthop" },
335 { FRR_ZAPI4_IPV6_NEXTHOP_ADD, "Add IPv6 Nexthop" },
336 { FRR_ZAPI4_IPV6_NEXTHOP_DELETE, "Delete IPv6 Nexthop" },
337 { FRR_ZAPI4_IPMR_ROUTE_STATS, "IPMR Route Statics" },
338 { FRR_ZAPI4_LABEL_MANAGER_CONNECT, "Label Manager Connect" },
339 { FRR_ZAPI4_GET_LABEL_CHUNK, "Get Label Chunk" },
340 { FRR_ZAPI4_RELEASE_LABEL_CHUNK, "Release Label Chunk" },
341 { FRR_ZAPI4_PW_ADD, "PseudoWire Add" },
342 { FRR_ZAPI4_PW_DELETE, "PseudoWire Delete" },
343 { FRR_ZAPI4_PW_SET, "PseudoWire Set" },
344 { FRR_ZAPI4_PW_UNSET, "PseudoWire Unset" },
345 { FRR_ZAPI4_PW_STATUS_UPDATE, "PseudoWire Status Update" },
346 { 0, NULL },
349 enum {
350 FRR_ZAPI5_INTERFACE_ADD,
351 FRR_ZAPI5_INTERFACE_DELETE,
352 FRR_ZAPI5_INTERFACE_ADDRESS_ADD,
353 FRR_ZAPI5_INTERFACE_ADDRESS_DELETE,
354 FRR_ZAPI5_INTERFACE_UP,
355 FRR_ZAPI5_INTERFACE_DOWN,
356 FRR_ZAPI5_INTERFACE_SET_MASTER,
357 FRR_ZAPI5_ROUTE_ADD,
358 FRR_ZAPI5_ROUTE_DELETE,
359 FRR_ZAPI5_ROUTE_NOTIFY_OWNER,
360 FRR_ZAPI5_IPV4_ROUTE_ADD,
361 FRR_ZAPI5_IPV4_ROUTE_DELETE,
362 FRR_ZAPI5_IPV6_ROUTE_ADD,
363 FRR_ZAPI5_IPV6_ROUTE_DELETE,
364 FRR_ZAPI5_REDISTRIBUTE_ADD,
365 FRR_ZAPI5_REDISTRIBUTE_DELETE,
366 FRR_ZAPI5_REDISTRIBUTE_DEFAULT_ADD,
367 FRR_ZAPI5_REDISTRIBUTE_DEFAULT_DELETE,
368 FRR_ZAPI5_ROUTER_ID_ADD,
369 FRR_ZAPI5_ROUTER_ID_DELETE,
370 FRR_ZAPI5_ROUTER_ID_UPDATE,
371 FRR_ZAPI5_HELLO,
372 FRR_ZAPI5_CAPABILITIES,
373 FRR_ZAPI5_NEXTHOP_REGISTER,
374 FRR_ZAPI5_NEXTHOP_UNREGISTER,
375 FRR_ZAPI5_NEXTHOP_UPDATE,
376 FRR_ZAPI5_INTERFACE_NBR_ADDRESS_ADD,
377 FRR_ZAPI5_INTERFACE_NBR_ADDRESS_DELETE,
378 FRR_ZAPI5_INTERFACE_BFD_DEST_UPDATE,
379 FRR_ZAPI5_IMPORT_ROUTE_REGISTER,
380 FRR_ZAPI5_IMPORT_ROUTE_UNREGISTER,
381 FRR_ZAPI5_IMPORT_CHECK_UPDATE,
382 FRR_ZAPI5_IPV4_ROUTE_IPV6_NEXTHOP_ADD,
383 FRR_ZAPI5_BFD_DEST_REGISTER,
384 FRR_ZAPI5_BFD_DEST_DEREGISTER,
385 FRR_ZAPI5_BFD_DEST_UPDATE,
386 FRR_ZAPI5_BFD_DEST_REPLAY,
387 FRR_ZAPI5_REDISTRIBUTE_ROUTE_ADD,
388 FRR_ZAPI5_REDISTRIBUTE_ROUTE_DEL,
389 FRR_ZAPI5_VRF_UNREGISTER,
390 FRR_ZAPI5_VRF_ADD,
391 FRR_ZAPI5_VRF_DELETE,
392 FRR_ZAPI5_VRF_LABEL,
393 FRR_ZAPI5_INTERFACE_VRF_UPDATE,
394 FRR_ZAPI5_BFD_CLIENT_REGISTER,
395 FRR_ZAPI5_INTERFACE_ENABLE_RADV,
396 FRR_ZAPI5_INTERFACE_DISABLE_RADV,
397 FRR_ZAPI5_IPV4_NEXTHOP_LOOKUP_MRIB,
398 FRR_ZAPI5_INTERFACE_LINK_PARAMS,
399 FRR_ZAPI5_MPLS_LABELS_ADD,
400 FRR_ZAPI5_MPLS_LABELS_DELETE,
401 FRR_ZAPI5_IPMR_ROUTE_STATS,
402 FRR_ZAPI5_LABEL_MANAGER_CONNECT,
403 FRR_ZAPI5_LABEL_MANAGER_CONNECT_ASYNC,
404 FRR_ZAPI5_GET_LABEL_CHUNK,
405 FRR_ZAPI5_RELEASE_LABEL_CHUNK,
406 FRR_ZAPI5_FEC_REGISTER,
407 FRR_ZAPI5_FEC_UNREGISTER,
408 FRR_ZAPI5_FEC_UPDATE,
409 FRR_ZAPI5_ADVERTISE_DEFAULT_GW,
410 FRR_ZAPI5_ADVERTISE_SUBNET,
411 FRR_ZAPI5_ADVERTISE_ALL_VNI,
412 FRR_ZAPI5_VNI_ADD,
413 FRR_ZAPI5_VNI_DEL,
414 FRR_ZAPI5_L3VNI_ADD,
415 FRR_ZAPI5_L3VNI_DEL,
416 FRR_ZAPI5_REMOTE_VTEP_ADD,
417 FRR_ZAPI5_REMOTE_VTEP_DEL,
418 FRR_ZAPI5_MACIP_ADD,
419 FRR_ZAPI5_MACIP_DEL,
420 FRR_ZAPI5_IP_PREFIX_ROUTE_ADD,
421 FRR_ZAPI5_IP_PREFIX_ROUTE_DEL,
422 FRR_ZAPI5_REMOTE_MACIP_ADD,
423 FRR_ZAPI5_REMOTE_MACIP_DEL,
424 FRR_ZAPI5_PW_ADD,
425 FRR_ZAPI5_PW_DELETE,
426 FRR_ZAPI5_PW_SET,
427 FRR_ZAPI5_PW_UNSET,
428 FRR_ZAPI5_PW_STATUS_UPDATE,
429 FRR_ZAPI5_RULE_ADD,
430 FRR_ZAPI5_RULE_DELETE,
431 FRR_ZAPI5_RULE_NOTIFY_OWNER,
432 FRR_ZAPI5_TABLE_MANAGER_CONNECT,
433 FRR_ZAPI5_GET_TABLE_CHUNK,
434 FRR_ZAPI5_RELEASE_TABLE_CHUNK,
435 FRR_ZAPI5_IPSET_CREATE,
436 FRR_ZAPI5_IPSET_DESTROY,
437 FRR_ZAPI5_IPSET_ENTRY_ADD,
438 FRR_ZAPI5_IPSET_ENTRY_DELETE,
439 FRR_ZAPI5_IPSET_NOTIFY_OWNER,
440 FRR_ZAPI5_IPSET_ENTRY_NOTIFY_OWNER,
441 FRR_ZAPI5_IPTABLE_ADD,
442 FRR_ZAPI5_IPTABLE_DELETE,
443 FRR_ZAPI5_IPTABLE_NOTIFY_OWNER,
446 static const value_string frr_zapi5_messages[] = {
447 { FRR_ZAPI5_INTERFACE_ADD, "Add Interface" },
448 { FRR_ZAPI5_INTERFACE_DELETE, "Delete Interface" },
449 { FRR_ZAPI5_INTERFACE_ADDRESS_ADD, "Add Interface Address" },
450 { FRR_ZAPI5_INTERFACE_ADDRESS_DELETE, "Delete Interface Address" },
451 { FRR_ZAPI5_INTERFACE_UP, "Interface Up" },
452 { FRR_ZAPI5_INTERFACE_DOWN, "Interface Down" },
453 { FRR_ZAPI5_ROUTE_ADD, "Add Route" },
454 { FRR_ZAPI5_ROUTE_DELETE, "Delete Route" },
455 { FRR_ZAPI5_IPV4_ROUTE_ADD, "Add IPv4 Route" },
456 { FRR_ZAPI5_IPV4_ROUTE_DELETE, "Delete IPv4 Route" },
457 { FRR_ZAPI5_IPV6_ROUTE_ADD, "Add IPv6 Route" },
458 { FRR_ZAPI5_IPV6_ROUTE_DELETE, "Delete IPv6 Route" },
459 { FRR_ZAPI5_REDISTRIBUTE_ADD, "Add Redistribute" },
460 { FRR_ZAPI5_REDISTRIBUTE_DELETE, "Delete Redistribute" },
461 { FRR_ZAPI5_REDISTRIBUTE_DEFAULT_ADD, "Add Default Redistribute" },
462 { FRR_ZAPI5_REDISTRIBUTE_DEFAULT_DELETE,"Delete Default Redistribute" },
463 { FRR_ZAPI5_ROUTER_ID_ADD, "Router ID Add" },
464 { FRR_ZAPI5_ROUTER_ID_DELETE, "Router ID Delete" },
465 { FRR_ZAPI5_ROUTER_ID_UPDATE, "Router ID Update" },
466 { FRR_ZAPI5_HELLO, "Hello" },
467 { FRR_ZAPI5_CAPABILITIES, "Capabilities" },
468 { FRR_ZAPI5_NEXTHOP_REGISTER, "Nexthop Register" },
469 { FRR_ZAPI5_NEXTHOP_UNREGISTER, "Nexthop Unregister" },
470 { FRR_ZAPI5_NEXTHOP_UPDATE, "Nexthop Update" },
471 { FRR_ZAPI5_INTERFACE_NBR_ADDRESS_ADD, "Interface Neighbor Address Add" },
472 { FRR_ZAPI5_INTERFACE_NBR_ADDRESS_DELETE, "Interface Neighbor Address Delete" },
473 { FRR_ZAPI5_INTERFACE_BFD_DEST_UPDATE, "Interface BFD Destination Update" },
474 { FRR_ZAPI5_IMPORT_ROUTE_REGISTER, "Import Route Register" },
475 { FRR_ZAPI5_IMPORT_ROUTE_UNREGISTER, "Import Route Unregister" },
476 { FRR_ZAPI5_IMPORT_CHECK_UPDATE, "Import Check Update" },
477 { FRR_ZAPI5_IPV4_ROUTE_IPV6_NEXTHOP_ADD,"Add IPv6 nexthop for IPv4 Route" },
478 { FRR_ZAPI5_BFD_DEST_REGISTER, "BFD Destination Register" },
479 { FRR_ZAPI5_BFD_DEST_DEREGISTER, "BFD Destination Deregister" },
480 { FRR_ZAPI5_BFD_DEST_UPDATE, "BFD Destination Update" },
481 { FRR_ZAPI5_BFD_DEST_REPLAY, "BFD Destination Replay" },
482 { FRR_ZAPI5_REDISTRIBUTE_ROUTE_ADD, "Add Redistribute Route" },
483 { FRR_ZAPI5_REDISTRIBUTE_ROUTE_DEL, "Delete Redistribute Route" },
484 { FRR_ZAPI5_VRF_UNREGISTER, "VRF Unregister" },
485 { FRR_ZAPI5_VRF_ADD, "VRF Add" },
486 { FRR_ZAPI5_VRF_DELETE, "VRF Delete" },
487 { FRR_ZAPI5_VRF_LABEL, "VRF Label" },
488 { FRR_ZAPI5_INTERFACE_VRF_UPDATE, "Interface VRF Update" },
489 { FRR_ZAPI5_BFD_CLIENT_REGISTER, "BFD Client Register" },
490 { FRR_ZAPI5_INTERFACE_ENABLE_RADV, "Interface Enable Router Advertisement" },
491 { FRR_ZAPI5_INTERFACE_DISABLE_RADV, "Interface Disable Router Advertisement" },
492 { FRR_ZAPI5_IPV4_NEXTHOP_LOOKUP_MRIB, "IPv4 Nexthop Lookup Multicast RIB" },
493 { FRR_ZAPI5_INTERFACE_LINK_PARAMS, "Interface Link Parameters" },
494 { FRR_ZAPI5_MPLS_LABELS_ADD, "MPLS Labels Add" },
495 { FRR_ZAPI5_MPLS_LABELS_DELETE, "MPLS Labels Delete" },
496 { FRR_ZAPI5_IPMR_ROUTE_STATS, "IPMR Route Statics" },
497 { FRR_ZAPI5_LABEL_MANAGER_CONNECT, "Label Manager Connect" },
498 { FRR_ZAPI5_LABEL_MANAGER_CONNECT_ASYNC,"Label Manager Connect Asynchronous" },
499 { FRR_ZAPI5_GET_LABEL_CHUNK, "Get Label Chunk" },
500 { FRR_ZAPI5_RELEASE_LABEL_CHUNK, "Release Label Chunk" },
501 { FRR_ZAPI5_FEC_REGISTER, "FEC Register" },
502 { FRR_ZAPI5_FEC_UNREGISTER, "FEC Unregister" },
503 { FRR_ZAPI5_FEC_UPDATE, "FEC Update" },
504 { FRR_ZAPI5_ADVERTISE_DEFAULT_GW, "Advertise Default Gateway" },
505 { FRR_ZAPI5_ADVERTISE_SUBNET, "Advertise Subnet" },
506 { FRR_ZAPI5_ADVERTISE_ALL_VNI, "Advertise all VNI" },
507 { FRR_ZAPI5_VNI_ADD, "VNI Add" },
508 { FRR_ZAPI5_VNI_DEL, "VNI Delete" },
509 { FRR_ZAPI5_L3VNI_ADD, "L3VNI Add" },
510 { FRR_ZAPI5_L3VNI_DEL, "L3VNI Delete" },
511 { FRR_ZAPI5_REMOTE_VTEP_ADD, "Remote VTEP Add" },
512 { FRR_ZAPI5_REMOTE_VTEP_DEL, "Remote VTEP Delete" },
513 { FRR_ZAPI5_MACIP_ADD, "MAC/IP Add" },
514 { FRR_ZAPI5_MACIP_DEL, "MAC/IP Delete" },
515 { FRR_ZAPI5_IP_PREFIX_ROUTE_ADD, "IP Prefix Route Add" },
516 { FRR_ZAPI5_IP_PREFIX_ROUTE_DEL, "IP Prefix Route Delete" },
517 { FRR_ZAPI5_REMOTE_MACIP_ADD, "Remote MAC/IP Add" },
518 { FRR_ZAPI5_REMOTE_MACIP_DEL, "Remote MAC/IP Delete" },
519 { FRR_ZAPI5_PW_ADD, "PseudoWire Add" },
520 { FRR_ZAPI5_PW_DELETE, "PseudoWire Delete" },
521 { FRR_ZAPI5_PW_SET, "PseudoWire Set" },
522 { FRR_ZAPI5_PW_UNSET, "PseudoWire Unset" },
523 { FRR_ZAPI5_PW_STATUS_UPDATE, "PseudoWire Status Update" },
524 { FRR_ZAPI5_RULE_ADD, "Rule Add" },
525 { FRR_ZAPI5_RULE_DELETE, "Rule Delete" },
526 { FRR_ZAPI5_RULE_NOTIFY_OWNER, "Rule Notify Owner" },
527 { FRR_ZAPI5_TABLE_MANAGER_CONNECT, "Table Manager Connect" },
528 { FRR_ZAPI5_GET_TABLE_CHUNK, "Get Table Chunk" },
529 { FRR_ZAPI5_RELEASE_TABLE_CHUNK, "Release Table Chunk" },
530 { FRR_ZAPI5_IPSET_CREATE, "IPSet Create" },
531 { FRR_ZAPI5_IPSET_DESTROY, "IPSet Destroy" },
532 { FRR_ZAPI5_IPSET_ENTRY_ADD, "IPSet Entry Add" },
533 { FRR_ZAPI5_IPSET_ENTRY_DELETE, "IPSet Entry Delete" },
534 { FRR_ZAPI5_IPSET_NOTIFY_OWNER, "IPSet Notify Oner" },
535 { FRR_ZAPI5_IPSET_ENTRY_NOTIFY_OWNER, "IPSet Entry Notify Owner" },
536 { FRR_ZAPI5_IPTABLE_ADD, "IPTable Add" },
537 { FRR_ZAPI5_IPTABLE_DELETE, "IPTable Delete" },
538 { FRR_ZAPI5_IPTABLE_NOTIFY_OWNER, "IPTable Notify Owner" },
539 { 0, NULL },
542 enum {
543 FRR_ZAPI6_INTERFACE_ADD,
544 FRR_ZAPI6_INTERFACE_DELETE,
545 FRR_ZAPI6_INTERFACE_ADDRESS_ADD,
546 FRR_ZAPI6_INTERFACE_ADDRESS_DELETE,
547 FRR_ZAPI6_INTERFACE_UP,
548 FRR_ZAPI6_INTERFACE_DOWN,
549 FRR_ZAPI6_INTERFACE_SET_MASTER,
550 FRR_ZAPI6_ROUTE_ADD,
551 FRR_ZAPI6_ROUTE_DELETE,
552 FRR_ZAPI6_ROUTE_NOTIFY_OWNER,
553 FRR_ZAPI6_REDISTRIBUTE_ADD,
554 FRR_ZAPI6_REDISTRIBUTE_DELETE,
555 FRR_ZAPI6_REDISTRIBUTE_DEFAULT_ADD,
556 FRR_ZAPI6_REDISTRIBUTE_DEFAULT_DELETE,
557 FRR_ZAPI6_ROUTER_ID_ADD,
558 FRR_ZAPI6_ROUTER_ID_DELETE,
559 FRR_ZAPI6_ROUTER_ID_UPDATE,
560 FRR_ZAPI6_HELLO,
561 FRR_ZAPI6_CAPABILITIES,
562 FRR_ZAPI6_NEXTHOP_REGISTER,
563 FRR_ZAPI6_NEXTHOP_UNREGISTER,
564 FRR_ZAPI6_NEXTHOP_UPDATE,
565 FRR_ZAPI6_INTERFACE_NBR_ADDRESS_ADD,
566 FRR_ZAPI6_INTERFACE_NBR_ADDRESS_DELETE,
567 FRR_ZAPI6_INTERFACE_BFD_DEST_UPDATE,
568 FRR_ZAPI6_IMPORT_ROUTE_REGISTER,
569 FRR_ZAPI6_IMPORT_ROUTE_UNREGISTER,
570 FRR_ZAPI6_IMPORT_CHECK_UPDATE,
571 //FRR_ZAPI6_IPV4_ROUTE_IPV6_NEXTHOP_ADD,
572 FRR_ZAPI6_BFD_DEST_REGISTER,
573 FRR_ZAPI6_BFD_DEST_DEREGISTER,
574 FRR_ZAPI6_BFD_DEST_UPDATE,
575 FRR_ZAPI6_BFD_DEST_REPLAY,
576 FRR_ZAPI6_REDISTRIBUTE_ROUTE_ADD,
577 FRR_ZAPI6_REDISTRIBUTE_ROUTE_DEL,
578 FRR_ZAPI6_VRF_UNREGISTER,
579 FRR_ZAPI6_VRF_ADD,
580 FRR_ZAPI6_VRF_DELETE,
581 FRR_ZAPI6_VRF_LABEL,
582 FRR_ZAPI6_INTERFACE_VRF_UPDATE,
583 FRR_ZAPI6_BFD_CLIENT_REGISTER,
584 FRR_ZAPI6_BFD_CLIENT_DEREGISTER,
585 FRR_ZAPI6_INTERFACE_ENABLE_RADV,
586 FRR_ZAPI6_INTERFACE_DISABLE_RADV,
587 FRR_ZAPI6_IPV4_NEXTHOP_LOOKUP_MRIB,
588 FRR_ZAPI6_INTERFACE_LINK_PARAMS,
589 FRR_ZAPI6_MPLS_LABELS_ADD,
590 FRR_ZAPI6_MPLS_LABELS_DELETE,
591 FRR_ZAPI6_IPMR_ROUTE_STATS,
592 FRR_ZAPI6_LABEL_MANAGER_CONNECT,
593 FRR_ZAPI6_LABEL_MANAGER_CONNECT_ASYNC,
594 FRR_ZAPI6_GET_LABEL_CHUNK,
595 FRR_ZAPI6_RELEASE_LABEL_CHUNK,
596 FRR_ZAPI6_FEC_REGISTER,
597 FRR_ZAPI6_FEC_UNREGISTER,
598 FRR_ZAPI6_FEC_UPDATE,
599 FRR_ZAPI6_ADVERTISE_DEFAULT_GW,
600 FRR_ZAPI6_ADVERTISE_SUBNET,
601 FRR_ZAPI6_ADVERTISE_ALL_VNI,
602 FRR_ZAPI6_LOCAL_ES_ADD,
603 FRR_ZAPI6_LOCAL_ES_DEL,
604 FRR_ZAPI6_VNI_ADD,
605 FRR_ZAPI6_VNI_DEL,
606 FRR_ZAPI6_L3VNI_ADD,
607 FRR_ZAPI6_L3VNI_DEL,
608 FRR_ZAPI6_REMOTE_VTEP_ADD,
609 FRR_ZAPI6_REMOTE_VTEP_DEL,
610 FRR_ZAPI6_MACIP_ADD,
611 FRR_ZAPI6_MACIP_DEL,
612 FRR_ZAPI6_IP_PREFIX_ROUTE_ADD,
613 FRR_ZAPI6_IP_PREFIX_ROUTE_DEL,
614 FRR_ZAPI6_REMOTE_MACIP_ADD,
615 FRR_ZAPI6_REMOTE_MACIP_DEL,
616 FRR_ZAPI6_DUPLICATE_ADDR_DETECTION,
617 FRR_ZAPI6_PW_ADD,
618 FRR_ZAPI6_PW_DELETE,
619 FRR_ZAPI6_PW_SET,
620 FRR_ZAPI6_PW_UNSET,
621 FRR_ZAPI6_PW_STATUS_UPDATE,
622 FRR_ZAPI6_RULE_ADD,
623 FRR_ZAPI6_RULE_DELETE,
624 FRR_ZAPI6_RULE_NOTIFY_OWNER,
625 FRR_ZAPI6_TABLE_MANAGER_CONNECT,
626 FRR_ZAPI6_GET_TABLE_CHUNK,
627 FRR_ZAPI6_RELEASE_TABLE_CHUNK,
628 FRR_ZAPI6_IPSET_CREATE,
629 FRR_ZAPI6_IPSET_DESTROY,
630 FRR_ZAPI6_IPSET_ENTRY_ADD,
631 FRR_ZAPI6_IPSET_ENTRY_DELETE,
632 FRR_ZAPI6_IPSET_NOTIFY_OWNER,
633 FRR_ZAPI6_IPSET_ENTRY_NOTIFY_OWNER,
634 FRR_ZAPI6_IPTABLE_ADD,
635 FRR_ZAPI6_IPTABLE_DELETE,
636 FRR_ZAPI6_IPTABLE_NOTIFY_OWNER,
637 FRR_ZAPI6_VXLAN_FLOOD_CONTROL,
640 static const value_string frr_zapi6_messages[] = {
641 { FRR_ZAPI6_INTERFACE_ADD, "Add Interface" },
642 { FRR_ZAPI6_INTERFACE_DELETE, "Delete Interface" },
643 { FRR_ZAPI6_INTERFACE_ADDRESS_ADD, "Add Interface Address" },
644 { FRR_ZAPI6_INTERFACE_ADDRESS_DELETE, "Delete Interface Address" },
645 { FRR_ZAPI6_INTERFACE_UP, "Interface Up" },
646 { FRR_ZAPI6_INTERFACE_DOWN, "Interface Down" },
647 { FRR_ZAPI6_ROUTE_ADD, "Add Route" },
648 { FRR_ZAPI6_ROUTE_DELETE, "Delete Route" },
649 { FRR_ZAPI6_REDISTRIBUTE_ADD, "Add Redistribute" },
650 { FRR_ZAPI6_REDISTRIBUTE_DELETE, "Delete Redistribute" },
651 { FRR_ZAPI6_REDISTRIBUTE_DEFAULT_ADD, "Add Default Redistribute" },
652 { FRR_ZAPI6_REDISTRIBUTE_DEFAULT_DELETE,"Delete Default Redistribute" },
653 { FRR_ZAPI6_ROUTER_ID_ADD, "Router ID Add" },
654 { FRR_ZAPI6_ROUTER_ID_DELETE, "Router ID Delete" },
655 { FRR_ZAPI6_ROUTER_ID_UPDATE, "Router ID Update" },
656 { FRR_ZAPI6_HELLO, "Hello" },
657 { FRR_ZAPI6_CAPABILITIES, "Capabilities" },
658 { FRR_ZAPI6_NEXTHOP_REGISTER, "Nexthop Register" },
659 { FRR_ZAPI6_NEXTHOP_UNREGISTER, "Nexthop Unregister" },
660 { FRR_ZAPI6_NEXTHOP_UPDATE, "Nexthop Update" },
661 { FRR_ZAPI6_INTERFACE_NBR_ADDRESS_ADD, "Interface Neighbor Address Add" },
662 { FRR_ZAPI6_INTERFACE_NBR_ADDRESS_DELETE, "Interface Neighbor Address Delete" },
663 { FRR_ZAPI6_INTERFACE_BFD_DEST_UPDATE, "Interface BFD Destination Update" },
664 { FRR_ZAPI6_IMPORT_ROUTE_REGISTER, "Import Route Register" },
665 { FRR_ZAPI6_IMPORT_ROUTE_UNREGISTER, "Import Route Unregister" },
666 { FRR_ZAPI6_IMPORT_CHECK_UPDATE, "Import Check Update" },
667 //{ FRR_ZAPI6_IPV4_ROUTE_IPV6_NEXTHOP_ADD,"Add IPv6 nexthop for IPv4 Route" },
668 { FRR_ZAPI6_BFD_DEST_REGISTER, "BFD Destination Register" },
669 { FRR_ZAPI6_BFD_DEST_DEREGISTER, "BFD Destination Deregister" },
670 { FRR_ZAPI6_BFD_DEST_UPDATE, "BFD Destination Update" },
671 { FRR_ZAPI6_BFD_DEST_REPLAY, "BFD Destination Replay" },
672 { FRR_ZAPI6_REDISTRIBUTE_ROUTE_ADD, "Add Redistribute Route" },
673 { FRR_ZAPI6_REDISTRIBUTE_ROUTE_DEL, "Delete Redistribute Route" },
674 { FRR_ZAPI6_VRF_UNREGISTER, "VRF Unregister" },
675 { FRR_ZAPI6_VRF_ADD, "VRF Add" },
676 { FRR_ZAPI6_VRF_DELETE, "VRF Delete" },
677 { FRR_ZAPI6_VRF_LABEL, "VRF Label" },
678 { FRR_ZAPI6_INTERFACE_VRF_UPDATE, "Interface VRF Update" },
679 { FRR_ZAPI6_BFD_CLIENT_REGISTER, "BFD Client Register" },
680 { FRR_ZAPI6_BFD_CLIENT_DEREGISTER, "BFD Client Deregister" },
681 { FRR_ZAPI6_INTERFACE_ENABLE_RADV, "Interface Enable Router Advertisement" },
682 { FRR_ZAPI6_INTERFACE_DISABLE_RADV, "Interface Disable Router Advertisement" },
683 { FRR_ZAPI6_IPV4_NEXTHOP_LOOKUP_MRIB, "IPv4 Nexthop Lookup Multicast RIB" },
684 { FRR_ZAPI6_INTERFACE_LINK_PARAMS, "Interface Link Parameters" },
685 { FRR_ZAPI6_MPLS_LABELS_ADD, "MPLS Labels Add" },
686 { FRR_ZAPI6_MPLS_LABELS_DELETE, "MPLS Labels Delete" },
687 { FRR_ZAPI6_IPMR_ROUTE_STATS, "IPMR Route Statics" },
688 { FRR_ZAPI6_LABEL_MANAGER_CONNECT, "Label Manager Connect" },
689 { FRR_ZAPI6_LABEL_MANAGER_CONNECT_ASYNC,"Label Manager Connect Asynchronous" },
690 { FRR_ZAPI6_GET_LABEL_CHUNK, "Get Label Chunk" },
691 { FRR_ZAPI6_RELEASE_LABEL_CHUNK, "Release Label Chunk" },
692 { FRR_ZAPI6_FEC_REGISTER, "FEC Register" },
693 { FRR_ZAPI6_FEC_UNREGISTER, "FEC Unregister" },
694 { FRR_ZAPI6_FEC_UPDATE, "FEC Update" },
695 { FRR_ZAPI6_ADVERTISE_DEFAULT_GW, "Advertise Default Gateway" },
696 { FRR_ZAPI6_ADVERTISE_SUBNET, "Advertise Subnet" },
697 { FRR_ZAPI6_ADVERTISE_ALL_VNI, "Advertise all VNI" },
698 { FRR_ZAPI6_LOCAL_ES_ADD, "Local Ethernet Segment Add" },
699 { FRR_ZAPI6_LOCAL_ES_DEL, "Local Ethernet Segment Delete" },
700 { FRR_ZAPI6_VNI_ADD, "VNI Add" },
701 { FRR_ZAPI6_VNI_DEL, "VNI Delete" },
702 { FRR_ZAPI6_L3VNI_ADD, "L3VNI Add" },
703 { FRR_ZAPI6_L3VNI_DEL, "L3VNI Delete" },
704 { FRR_ZAPI6_REMOTE_VTEP_ADD, "Remote VTEP Add" },
705 { FRR_ZAPI6_REMOTE_VTEP_DEL, "Remote VTEP Delete" },
706 { FRR_ZAPI6_MACIP_ADD, "MAC/IP Add" },
707 { FRR_ZAPI6_MACIP_DEL, "MAC/IP Delete" },
708 { FRR_ZAPI6_IP_PREFIX_ROUTE_ADD, "IP Prefix Route Add" },
709 { FRR_ZAPI6_IP_PREFIX_ROUTE_DEL, "IP Prefix Route Delete" },
710 { FRR_ZAPI6_REMOTE_MACIP_ADD, "Remote MAC/IP Add" },
711 { FRR_ZAPI6_REMOTE_MACIP_DEL, "Remote MAC/IP Delete" },
712 { FRR_ZAPI6_DUPLICATE_ADDR_DETECTION, "Duplicate Address Detection" },
713 { FRR_ZAPI6_PW_ADD, "PseudoWire Add" },
714 { FRR_ZAPI6_PW_DELETE, "PseudoWire Delete" },
715 { FRR_ZAPI6_PW_SET, "PseudoWire Set" },
716 { FRR_ZAPI6_PW_UNSET, "PseudoWire Unset" },
717 { FRR_ZAPI6_PW_STATUS_UPDATE, "PseudoWire Status Update" },
718 { FRR_ZAPI6_RULE_ADD, "Rule Add" },
719 { FRR_ZAPI6_RULE_DELETE, "Rule Delete" },
720 { FRR_ZAPI6_RULE_NOTIFY_OWNER, "Rule Notify Owner" },
721 { FRR_ZAPI6_TABLE_MANAGER_CONNECT, "Table Manager Connect" },
722 { FRR_ZAPI6_GET_TABLE_CHUNK, "Get Table Chunk" },
723 { FRR_ZAPI6_RELEASE_TABLE_CHUNK, "Release Table Chunk" },
724 { FRR_ZAPI6_IPSET_CREATE, "IPSet Create" },
725 { FRR_ZAPI6_IPSET_DESTROY, "IPSet Destroy" },
726 { FRR_ZAPI6_IPSET_ENTRY_ADD, "IPSet Entry Add" },
727 { FRR_ZAPI6_IPSET_ENTRY_DELETE, "IPSet Entry Delete" },
728 { FRR_ZAPI6_IPSET_NOTIFY_OWNER, "IPSet Notify Oner" },
729 { FRR_ZAPI6_IPSET_ENTRY_NOTIFY_OWNER, "IPSet Entry Notify Owner" },
730 { FRR_ZAPI6_IPTABLE_ADD, "IPTable Add" },
731 { FRR_ZAPI6_IPTABLE_DELETE, "IPTable Delete" },
732 { FRR_ZAPI6_IPTABLE_NOTIFY_OWNER, "IPTable Notify Owner" },
733 { FRR_ZAPI6_VXLAN_FLOOD_CONTROL, "VXLAN Flood Control" },
734 { 0, NULL },
737 /* Zebra route's types. */
738 #define ZEBRA_ROUTE_SYSTEM 0
739 #define ZEBRA_ROUTE_KERNEL 1
740 #define ZEBRA_ROUTE_CONNECT 2
741 #define ZEBRA_ROUTE_STATIC 3
742 #define ZEBRA_ROUTE_RIP 4
743 #define ZEBRA_ROUTE_RIPNG 5
744 #define ZEBRA_ROUTE_OSPF 6
745 #define ZEBRA_ROUTE_OSPF6 7
746 #define ZEBRA_ROUTE_BGP 8
748 static const value_string routes_v0[] = {
749 { ZEBRA_ROUTE_SYSTEM, "System Route" },
750 { ZEBRA_ROUTE_KERNEL, "Kernel Route" },
751 { ZEBRA_ROUTE_CONNECT, "Connected Route" },
752 { ZEBRA_ROUTE_STATIC, "Static Route" },
753 { ZEBRA_ROUTE_RIP, "RIP Route" },
754 { ZEBRA_ROUTE_RIPNG, "RIPnG Route" },
755 { ZEBRA_ROUTE_OSPF, "OSPF Route" },
756 { ZEBRA_ROUTE_OSPF6, "OSPF6 Route" },
757 { ZEBRA_ROUTE_BGP, "BGP Route" },
758 { 0, NULL },
762 * In Quagga, ISIS is type 8 and BGP is type 9, but Zebra didn't have ISIS...
763 * so for Zebra BGP is type 8. So we dup the value_string table for quagga.
765 #define QUAGGA_ROUTE_ISIS 8
766 #define QUAGGA_ROUTE_BGP 9
767 #define QUAGGA_ROUTE_HSLS 10
768 #define QUAGGA_ROUTE_OLSR 11
769 #define QUAGGA_ROUTE_BABEL 12
771 static const value_string routes_v1[] = {
772 { ZEBRA_ROUTE_SYSTEM, "System Route" },
773 { ZEBRA_ROUTE_KERNEL, "Kernel Route" },
774 { ZEBRA_ROUTE_CONNECT, "Connected Route" },
775 { ZEBRA_ROUTE_STATIC, "Static Route" },
776 { ZEBRA_ROUTE_RIP, "RIP Route" },
777 { ZEBRA_ROUTE_RIPNG, "RIPnG Route" },
778 { ZEBRA_ROUTE_OSPF, "OSPF Route" },
779 { ZEBRA_ROUTE_OSPF6, "OSPF6 Route" },
780 { QUAGGA_ROUTE_ISIS, "ISIS Route" },
781 { QUAGGA_ROUTE_BGP, "BGP Route" },
782 { QUAGGA_ROUTE_HSLS, "HSLS Route" },
783 { QUAGGA_ROUTE_OLSR, "OLSR Route" },
784 { QUAGGA_ROUTE_BABEL, "BABEL Route" },
785 { 0, NULL },
788 #define FRR_ZAPI4_ROUTE_PIM 10
789 #define FRR_ZAPI4_ROUTE_NHRP 11
790 #define FRR_ZAPI4_ROUTE_HSLS 12
791 #define FRR_ZAPI4_ROUTE_OLSR 13
792 #define FRR_ZAPI4_ROUTE_TABLE 14
793 #define FRR_ZAPI4_ROUTE_LDP 15
794 #define FRR_ZAPI4_ROUTE_VNC 16
795 #define FRR_ZAPI4_ROUTE_VNC_DIRECT 17
796 #define FRR_ZAPI4_ROUTE_VNC_DIRECT_RH 18
797 #define FRR_ZAPI4_ROUTE_BGP_DIRECT 19
798 #define FRR_ZAPI4_ROUTE_BGP_DIRECT_EXT 20
800 static const value_string routes_v4[] = {
801 { ZEBRA_ROUTE_SYSTEM, "System Route" },
802 { ZEBRA_ROUTE_KERNEL, "Kernel Route" },
803 { ZEBRA_ROUTE_CONNECT, "Connected Route" },
804 { ZEBRA_ROUTE_STATIC, "Static Route" },
805 { ZEBRA_ROUTE_RIP, "RIP Route" },
806 { ZEBRA_ROUTE_RIPNG, "RIPnG Route" },
807 { ZEBRA_ROUTE_OSPF, "OSPF Route" },
808 { ZEBRA_ROUTE_OSPF6, "OSPF6 Route" },
809 { QUAGGA_ROUTE_ISIS, "ISIS Route" },
810 { QUAGGA_ROUTE_BGP, "BGP Route" },
811 { FRR_ZAPI4_ROUTE_PIM, "PIM Route" },
812 { FRR_ZAPI4_ROUTE_NHRP, "NHRP Route" },
813 { FRR_ZAPI4_ROUTE_HSLS, "HSLS Route" },
814 { FRR_ZAPI4_ROUTE_OLSR, "OLSR Route" },
815 { FRR_ZAPI4_ROUTE_TABLE, "Table Route" },
816 { FRR_ZAPI4_ROUTE_LDP, "LDP Route" },
817 { FRR_ZAPI4_ROUTE_VNC, "VNC Route" },
818 { FRR_ZAPI4_ROUTE_VNC_DIRECT, "VNC Direct Route" },
819 { FRR_ZAPI4_ROUTE_VNC_DIRECT_RH, "VNC RN Route" },
820 { FRR_ZAPI4_ROUTE_BGP_DIRECT, "BGP Direct Route" },
821 { FRR_ZAPI4_ROUTE_BGP_DIRECT_EXT, "BGP Direct to NVE groups Route" },
822 { 0, NULL},
825 #define FRR_ZAPI5_ROUTE_EIGRP 11
826 #define FRR_ZAPI5_ROUTE_NHRP 12
827 #define FRR_ZAPI5_ROUTE_HSLS 13
828 #define FRR_ZAPI5_ROUTE_OLSR 14
829 #define FRR_ZAPI5_ROUTE_TABLE 15
830 #define FRR_ZAPI5_ROUTE_LDP 16
831 #define FRR_ZAPI5_ROUTE_VNC 17
832 #define FRR_ZAPI5_ROUTE_VNC_DIRECT 18
833 #define FRR_ZAPI5_ROUTE_VNC_DIRECT_RH 19
834 #define FRR_ZAPI5_ROUTE_BGP_DIRECT 20
835 #define FRR_ZAPI5_ROUTE_BGP_DIRECT_EXT 21
836 #define FRR_ZAPI5_ROUTE_BABEL 22
837 #define FRR_ZAPI5_ROUTE_SHARP 23
838 #define FRR_ZAPI5_ROUTE_PBR 24
839 #define FRR_ZAPI6_ROUTE_BFD 25
840 #define FRR_ZAPI6_ROUTE_OPENFABRIC 26
842 static const value_string routes_v5[] = {
843 { ZEBRA_ROUTE_SYSTEM, "System Route" },
844 { ZEBRA_ROUTE_KERNEL, "Kernel Route" },
845 { ZEBRA_ROUTE_CONNECT, "Connected Route" },
846 { ZEBRA_ROUTE_STATIC, "Static Route" },
847 { ZEBRA_ROUTE_RIP, "RIP Route" },
848 { ZEBRA_ROUTE_RIPNG, "RIPnG Route" },
849 { ZEBRA_ROUTE_OSPF, "OSPF Route" },
850 { ZEBRA_ROUTE_OSPF6, "OSPF6 Route" },
851 { QUAGGA_ROUTE_ISIS, "ISIS Route" },
852 { QUAGGA_ROUTE_BGP, "BGP Route" },
853 { FRR_ZAPI4_ROUTE_PIM, "PIM Route" },
854 { FRR_ZAPI5_ROUTE_EIGRP, "EIGRP Route" },
855 { FRR_ZAPI5_ROUTE_NHRP, "NHRP Route" },
856 { FRR_ZAPI5_ROUTE_HSLS, "HSLS Route" },
857 { FRR_ZAPI5_ROUTE_OLSR, "OLSR Route" },
858 { FRR_ZAPI5_ROUTE_TABLE, "Table Route" },
859 { FRR_ZAPI5_ROUTE_LDP, "LDP Route" },
860 { FRR_ZAPI5_ROUTE_VNC, "VNC Route" },
861 { FRR_ZAPI5_ROUTE_VNC_DIRECT, "VNC Direct Route" },
862 { FRR_ZAPI5_ROUTE_VNC_DIRECT_RH, "VNC RN Route" },
863 { FRR_ZAPI5_ROUTE_BGP_DIRECT, "BGP Direct Route" },
864 { FRR_ZAPI5_ROUTE_BGP_DIRECT_EXT, "BGP Direct to NVE groups Route" },
865 { FRR_ZAPI5_ROUTE_BABEL, "BABEL Route" },
866 { FRR_ZAPI5_ROUTE_SHARP, "SHARPd Route" },
867 { FRR_ZAPI5_ROUTE_PBR, "PBR Route" },
868 { FRR_ZAPI6_ROUTE_BFD, "BFD Route" },
869 { FRR_ZAPI6_ROUTE_OPENFABRIC, "OpenFabric Route" },
870 { 0, NULL },
873 /* Zebra's family types. */
874 #define ZEBRA_FAMILY_UNSPEC 0
875 #define ZEBRA_FAMILY_IPV4 2
876 #define ZEBRA_FAMILY_IPV6 10
878 static const value_string families[] = {
879 { ZEBRA_FAMILY_IPV4, "IPv4" },
880 { ZEBRA_FAMILY_IPV6, "IPv6" },
881 { 0, NULL },
884 /* Zebra message flags */
885 #define ZEBRA_FLAG_INTERNAL 0x01
886 #define ZEBRA_FLAG_SELFROUTE 0x02
887 #define ZEBRA_FLAG_BLACKHOLE 0x04
888 #define ZEBRA_FLAG_IBGP 0x08
889 #define ZEBRA_FLAG_SELECTED 0x10
890 #define ZEBRA_FLAG_FIB_OVERRIDE 0x20
891 #define ZEBRA_FLAG_STATIC 0x40
892 #define ZEBRA_FLAG_REJECT 0x80
893 /* ZAPI v4 (FRRouting v3) message flags */
894 #define ZEBRA_FLAG_SCOPE_LINK 0x100
895 #define FRR_FLAG_FIB_OVERRIDE 0x200
896 /* ZAPI v5 (FRRouting v5) message flags */
897 #define ZEBRA_FLAG_EVPN_ROUTE 0x400
898 #define FRR_FLAG_ALLOW_RECURSION 0x01
899 /* ZAPI v6 (FRRouting v7) message flags */
900 #define FRR_ZAPI6_FLAG_IBGP 0x04
901 #define FRR_ZAPI6_FLAG_SELECTED 0x08
902 #define FRR_ZAPI6_FLAG_FIB_OVERRIDE 0x10
903 #define FRR_ZAPI6_FLAG_EVPN_ROUTE 0x20
904 #define FRR_ZAPI6_FLAG_RR_USE_DISTANCE 0x40
905 #define FRR_ZAPI6_FLAG_ONLINk 0x40
908 /* Zebra API message flag. */
909 #define ZEBRA_ZAPI_MESSAGE_NEXTHOP 0x01
910 #define ZEBRA_ZAPI_MESSAGE_IFINDEX 0x02
911 #define ZEBRA_ZAPI_MESSAGE_DISTANCE 0x04
912 #define ZEBRA_ZAPI_MESSAGE_METRIC 0x08
913 #define ZEBRA_ZAPI_MESSAGE_MTU 0x10
914 #define ZEBRA_ZAPI_MESSAGE_TAG 0x20
915 /* ZAPI v4 (FRRouting v3) API message flags */
916 #define FRR_ZAPI4_MESSAGE_TAG 0x10
917 #define FRR_ZAPI4_MESSAGE_MTU 0x20
918 #define FRR_ZAPI4_MESSAGE_SRCPFX 0x40
919 /* ZAPI v5 (FRRouting v5) API message flags */
920 #define FRR_ZAPI5_MESSAGE_DISTANCE 0x02
921 #define FRR_ZAPI5_MESSAGE_METRIC 0x04
922 #define FRR_ZAPI5_MESSAGE_TAG 0x08
923 #define FRR_ZAPI5_MESSAGE_MTU 0x10
924 #define FRR_ZAPI5_MESSAGE_SRCPFX 0x20
925 #define FRR_ZAPI5_MESSAGE_LABEL 0x40
926 #define FRR_ZAPI5_MESSAGE_TABLEID 0x80
928 /* Zebra NextHop Types */
929 #define ZEBRA_NEXTHOP_TYPE_IFINDEX 0x01
930 #define ZEBRA_NEXTHOP_TYPE_IFNAME 0x02
931 #define ZEBRA_NEXTHOP_TYPE_IPV4 0x03
932 #define ZEBRA_NEXTHOP_TYPE_IPV4_IFINDEX 0x04
933 #define ZEBRA_NEXTHOP_TYPE_IPV4_IFNAME 0x05
934 #define ZEBRA_NEXTHOP_TYPE_IPV6 0x06
935 #define ZEBRA_NEXTHOP_TYPE_IPV6_IFINDEX 0x07
936 #define ZEBRA_NEXTHOP_TYPE_IPV6_IFNAME 0x08
937 #define ZEBRA_NEXTHOP_TYPE_BLACKHOLE 0x09
939 static const value_string zebra_nht[] = {
940 { ZEBRA_NEXTHOP_TYPE_IFINDEX, "IFIndex" },
941 { ZEBRA_NEXTHOP_TYPE_IFNAME, "IFName" },
942 { ZEBRA_NEXTHOP_TYPE_IPV4, "IPv4" },
943 { ZEBRA_NEXTHOP_TYPE_IPV4_IFINDEX, "IPv4 IFIndex" },
944 { ZEBRA_NEXTHOP_TYPE_IPV4_IFNAME, "IPv4 IFName" },
945 { ZEBRA_NEXTHOP_TYPE_IPV6, "IPv6 Nexthop" },
946 { ZEBRA_NEXTHOP_TYPE_IPV6_IFINDEX, "IPv6 IFIndex" },
947 { ZEBRA_NEXTHOP_TYPE_IPV6_IFNAME, "IPv6 IFName" },
948 { ZEBRA_NEXTHOP_TYPE_BLACKHOLE, "Blackhole" },
949 { 0, NULL },
952 /* FRR NextHop Types */
953 #define FRR_NEXTHOP_TYPE_IFINDEX 0x01
954 #define FRR_NEXTHOP_TYPE_IPV4 0x02
955 #define FRR_NEXTHOP_TYPE_IPV4_IFINDEX 0x03
956 #define FRR_NEXTHOP_TYPE_IPV6 0x04
957 #define FRR_NEXTHOP_TYPE_IPV6_IFINDEX 0x05
958 #define FRR_NEXTHOP_TYPE_BLACKHOLE 0x06
959 static const value_string frr_nht[] = {
960 { FRR_NEXTHOP_TYPE_IFINDEX, "IFIndex" },
961 { FRR_NEXTHOP_TYPE_IPV4, "IPv4" },
962 { FRR_NEXTHOP_TYPE_IPV4_IFINDEX, "IPv4 IFIndex" },
963 { FRR_NEXTHOP_TYPE_IPV6, "IPv6" },
964 { FRR_NEXTHOP_TYPE_IPV6_IFINDEX, "IPv6 IFIndex" },
965 { FRR_NEXTHOP_TYPE_BLACKHOLE, "Blackhole" },
966 { 0, NULL },
969 /* Subsequent Address Family Identifier. */
970 #define ZEBRA_SAFI_UNICAST 1
971 #define ZEBRA_SAFI_MULTICAST 2
972 #define ZEBRA_SAFI_RESERVED_3 3
973 #define ZEBRA_SAFI_MPLS_VPN 4
975 static const value_string safi[] = {
976 { ZEBRA_SAFI_UNICAST, "Unicast" },
977 { ZEBRA_SAFI_MULTICAST, "Multicast" },
978 { ZEBRA_SAFI_RESERVED_3, "Reserved" },
979 { ZEBRA_SAFI_MPLS_VPN, "MPLS VPN" },
980 { 0, NULL },
983 enum blackhole_type {
984 BLACKHOLE_UNSPEC = 0,
985 BLACKHOLE_NULL,
986 BLACKHOLE_REJECT,
987 BLACKHOLE_ADMINPROHIB,
990 static const value_string blackhole_type[] = {
991 { BLACKHOLE_UNSPEC, "Unspec" },
992 { BLACKHOLE_NULL, "NULL" },
993 { BLACKHOLE_REJECT, "Reject" },
994 { BLACKHOLE_ADMINPROHIB, "Administrative Prohibit" },
995 { 0, NULL},
998 #define INTERFACE_NAMSIZ 20
1000 #define PSIZE(a) (((a) + 7) / (8))
1002 typedef struct _zebra_header_t {
1003 uint16_t len;
1004 uint16_t command;
1005 uint8_t version;
1007 } zebra_header_t;
1009 static int
1010 zebra_route_nexthop(proto_tree *tree, bool request, tvbuff_t *tvb,
1011 int offset, uint16_t len, uint8_t family, uint8_t version)
1013 uint8_t nexthoptype = 0, interfacenamelength;
1014 uint16_t nexthopcount;
1015 if (version < 5) {
1016 nexthopcount = tvb_get_uint8(tvb, offset);
1017 proto_tree_add_uint(tree, hf_zebra_nexthopnum, tvb, offset, 1,
1018 nexthopcount);
1019 offset += 1;
1020 } else {
1021 nexthopcount = tvb_get_ntohs(tvb, offset);
1022 proto_tree_add_uint(tree, hf_zebra_nexthopnum_u16, tvb, offset,
1023 2, nexthopcount);
1024 offset += 2;
1027 if (nexthopcount > len)
1028 return offset; /* Sanity */
1030 while (nexthopcount--) {
1031 if (version > 4) {
1032 proto_tree_add_item(tree, hf_zebra_vrfid, tvb, offset,
1033 4, ENC_BIG_ENDIAN);
1034 offset += 4;
1036 if (version < 4 && request) { /* Quagga */
1037 nexthoptype = tvb_get_uint8(tvb, offset);
1038 proto_tree_add_item(tree, hf_zebra_nexthoptype, tvb,
1039 offset, 1, ENC_BIG_ENDIAN);
1040 offset += 1;
1041 } else if (version >= 4) { /* FRR */
1042 nexthoptype = tvb_get_uint8(tvb, offset);
1043 proto_tree_add_item(tree, hf_zebra_nexthoptype_frr, tvb,
1044 offset, 1, ENC_BIG_ENDIAN);
1045 offset += 1;
1047 if ((version < 4 &&
1048 ((request &&
1049 (nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4 ||
1050 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4_IFINDEX ||
1051 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4_IFNAME)) ||
1052 (!request && family == ZEBRA_FAMILY_IPV4))) ||
1053 (version >= 4 &&
1054 (nexthoptype == FRR_NEXTHOP_TYPE_IPV4 ||
1055 nexthoptype == FRR_NEXTHOP_TYPE_IPV4_IFINDEX))) {
1056 proto_tree_add_item(tree, hf_zebra_nexthop4, tvb,
1057 offset, 4, ENC_NA);
1058 offset += 4;
1060 if ((version < 4 &&
1061 ((request &&
1062 (nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6 ||
1063 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6_IFINDEX ||
1064 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6_IFNAME)) ||
1065 (!request && family == ZEBRA_FAMILY_IPV6))) ||
1066 (version >= 4 &&
1067 (nexthoptype == FRR_NEXTHOP_TYPE_IPV6 ||
1068 nexthoptype == FRR_NEXTHOP_TYPE_IPV6_IFINDEX))) {
1069 proto_tree_add_item(tree, hf_zebra_nexthop6, tvb,
1070 offset, 16, ENC_NA);
1071 offset += 16;
1073 if (nexthoptype == ZEBRA_NEXTHOP_TYPE_IFINDEX ||
1074 (version < 4 &&
1075 (nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4_IFINDEX ||
1076 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6_IFINDEX)) ||
1077 (version >= 4 &&
1078 (nexthoptype == FRR_NEXTHOP_TYPE_IPV4_IFINDEX ||
1079 nexthoptype == FRR_NEXTHOP_TYPE_IPV6_IFINDEX))) {
1080 proto_tree_add_item(tree, hf_zebra_index, tvb, offset,
1081 4, ENC_BIG_ENDIAN);
1082 offset += 4;
1085 if (version < 4 &&
1086 (nexthoptype == ZEBRA_NEXTHOP_TYPE_IFNAME ||
1087 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4_IFNAME ||
1088 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6_IFNAME)) {
1089 interfacenamelength = tvb_get_uint8(tvb, offset);
1090 offset += 1;
1091 proto_tree_add_item(tree, hf_zebra_interface, tvb,
1092 offset, interfacenamelength,
1093 ENC_ASCII | ENC_NA);
1094 offset += interfacenamelength;
1096 if (version > 4 &&
1097 (nexthoptype == FRR_NEXTHOP_TYPE_BLACKHOLE)) {
1098 proto_tree_add_item(tree, hf_zebra_bhtype, tvb, offset,
1099 1, ENC_BIG_ENDIAN);
1100 offset += 1;
1103 return offset;
1106 static int
1107 zebra_route_ifindex(proto_tree *tree, tvbuff_t *tvb, int offset, uint16_t len)
1109 uint16_t indexcount = tvb_get_uint8(tvb, offset);
1110 proto_tree_add_uint(tree, hf_zebra_indexnum,
1111 tvb, offset, 1, indexcount);
1112 offset += 1;
1113 if (indexcount > len)
1114 return offset; /* Sanity */
1116 while (indexcount--) {
1117 proto_tree_add_item(tree, hf_zebra_index, tvb, offset, 4,
1118 ENC_BIG_ENDIAN);
1119 offset += 4;
1121 return offset;
1124 static int
1125 zebra_route_message(proto_tree *tree, tvbuff_t *tvb, int offset, uint8_t version)
1127 static int * const flags[] = {
1128 &hf_zebra_msg_nexthop,
1129 &hf_zebra_msg_index,
1130 &hf_zebra_msg_distance,
1131 &hf_zebra_msg_metric,
1132 &hf_zebra_msg_mtu,
1133 &hf_zebra_msg_tag,
1134 NULL
1136 static int * const flags4[] = {
1137 &hf_zebra_msg_nexthop,
1138 &hf_zebra_msg_index,
1139 &hf_zebra_msg_distance,
1140 &hf_zebra_msg_metric,
1141 &hf_zebra_msg4_tag,
1142 &hf_zebra_msg4_mtu,
1143 &hf_zebra_msg4_srcpfx,
1144 NULL
1146 static int * const flags5[] = {
1147 &hf_zebra_msg_nexthop,
1148 &hf_zebra_msg5_distance,
1149 &hf_zebra_msg5_metric,
1150 &hf_zebra_msg5_tag,
1151 &hf_zebra_msg5_mtu,
1152 &hf_zebra_msg5_srcpfx,
1153 &hf_zebra_msg_label,
1154 &hf_zebra_msg_tableid,
1155 NULL
1157 if (version < 4) {
1158 proto_tree_add_bitmask(tree, tvb, offset, hf_zebra_message,
1159 ett_message, flags, ENC_NA);
1160 } else if (version == 4) {
1161 proto_tree_add_bitmask(tree, tvb, offset, hf_zebra_message4,
1162 ett_message, flags4, ENC_NA);
1163 } else {
1164 proto_tree_add_bitmask(tree, tvb, offset, hf_zebra_message5,
1165 ett_message, flags5, ENC_NA);
1168 offset += 1;
1170 return offset;
1173 static int
1174 zebra_route(proto_tree *tree, bool request, tvbuff_t *tvb, int offset,
1175 uint16_t len, uint8_t family, uint16_t command, uint8_t version)
1177 uint32_t prefix4, srcprefix4, rtflags = 0;
1178 uint8_t message, prefixlen, buffer6[16], srcprefixlen, srcbuffer6[16];
1180 if (version == 0) {
1181 proto_tree_add_item(tree, hf_zebra_type_v0, tvb,
1182 offset, 1, ENC_BIG_ENDIAN);
1183 } else if (version < 4) {
1184 proto_tree_add_item(tree, hf_zebra_type_v1, tvb,
1185 offset, 1, ENC_BIG_ENDIAN);
1186 } else if (version == 4) {
1187 proto_tree_add_item(tree, hf_zebra_type_v4, tvb,
1188 offset, 1, ENC_BIG_ENDIAN);
1189 } else {
1190 proto_tree_add_item(tree, hf_zebra_type_v5, tvb,
1191 offset, 1, ENC_BIG_ENDIAN);
1193 offset += 1;
1195 if (version > 3) {
1196 proto_tree_add_item(tree, hf_zebra_instance, tvb, offset, 2,
1197 ENC_BIG_ENDIAN);
1198 offset += 2;
1199 rtflags = tvb_get_ntohl(tvb, offset);
1200 proto_tree_add_item(tree, hf_zebra_rtflags_u32, tvb, offset, 4,
1201 ENC_BIG_ENDIAN);
1202 offset += 4;
1203 } else {
1204 proto_tree_add_item(tree, hf_zebra_rtflags, tvb, offset, 1,
1205 ENC_BIG_ENDIAN);
1206 offset += 1;
1209 message = tvb_get_uint8(tvb, offset);
1210 offset = zebra_route_message(tree, tvb, offset, version);
1212 if (version > 1 && version < 5) {
1213 /* version 2 added safi */
1214 if (((version == 2 || version == 3) && request)||
1215 (version == 4 && (command == FRR_ZAPI4_IPV4_ROUTE_ADD ||
1216 command == FRR_ZAPI4_IPV4_ROUTE_DELETE ||
1217 command == FRR_ZAPI4_IPV6_ROUTE_ADD ||
1218 command == FRR_ZAPI4_IPV6_ROUTE_DELETE))) {
1219 proto_tree_add_item(tree, hf_zebra_route_safi, tvb,
1220 offset, 2, ENC_BIG_ENDIAN);
1221 offset += 2;
1223 } else if (version >= 5) {
1224 /* version 5: safi is 1 byte */
1225 proto_tree_add_item(tree, hf_zebra_route_safi_u8, tvb, offset,
1226 1, ENC_BIG_ENDIAN);
1227 offset += 1;
1228 if ((version == 5 &&rtflags & ZEBRA_FLAG_EVPN_ROUTE) ||
1229 (version > 5 &&rtflags & FRR_ZAPI6_FLAG_EVPN_ROUTE)) {
1230 proto_tree_add_item(tree, hf_zebra_rmac, tvb, offset, 6,
1231 ENC_NA);
1232 offset += 6;
1234 family = tvb_get_uint8(tvb, offset);
1235 proto_tree_add_item(tree, hf_zebra_family, tvb, offset, 1,
1236 ENC_BIG_ENDIAN);
1237 offset += 1;
1240 prefixlen = tvb_get_uint8(tvb, offset);
1241 proto_tree_add_uint(tree, hf_zebra_prefixlen, tvb,
1242 offset, 1, prefixlen);
1243 offset += 1;
1245 if (family == ZEBRA_FAMILY_IPV6) {
1246 memset(buffer6, '\0', sizeof buffer6);
1247 tvb_memcpy(tvb, buffer6, offset,
1248 MIN((unsigned) PSIZE(prefixlen), sizeof buffer6));
1249 proto_tree_add_ipv6(tree, hf_zebra_prefix6,
1250 tvb, offset, PSIZE(prefixlen), (ws_in6_addr *)buffer6);
1251 } else if (family == ZEBRA_FAMILY_IPV4) {
1252 prefix4 = 0;
1253 tvb_memcpy(tvb, (uint8_t *)&prefix4, offset,
1254 MIN((unsigned) PSIZE(prefixlen), sizeof prefix4));
1255 proto_tree_add_ipv4(tree, hf_zebra_prefix4,
1256 tvb, offset, PSIZE(prefixlen), prefix4);
1258 offset += PSIZE(prefixlen);
1260 if ((version == 4 && family == ZEBRA_FAMILY_IPV6 &&
1261 message & FRR_ZAPI4_MESSAGE_SRCPFX) ||
1262 (version > 4 && message & FRR_ZAPI5_MESSAGE_SRCPFX)) {
1263 srcprefixlen = tvb_get_uint8(tvb, offset);
1264 proto_tree_add_uint(tree, hf_zebra_srcprefixlen, tvb, offset, 1,
1265 srcprefixlen);
1266 offset += 1;
1268 if (family == ZEBRA_FAMILY_IPV6) {
1269 memset(srcbuffer6, '\0', sizeof srcbuffer6);
1270 tvb_memcpy(tvb, srcbuffer6, offset,
1271 MIN((unsigned)PSIZE(srcprefixlen),
1272 sizeof srcbuffer6));
1273 proto_tree_add_ipv6(tree, hf_zebra_srcprefix6, tvb,
1274 offset, PSIZE(srcprefixlen),
1275 (ws_in6_addr *)srcbuffer6);
1276 } else if (family == ZEBRA_FAMILY_IPV4) {
1277 prefix4 = 0;
1278 tvb_memcpy(tvb, (uint8_t *)&srcprefix4, offset,
1279 MIN((unsigned)PSIZE(srcprefixlen),
1280 sizeof srcprefix4));
1281 proto_tree_add_ipv4(tree, hf_zebra_srcprefix4, tvb,
1282 offset, PSIZE(srcprefixlen),
1283 srcprefix4);
1285 offset += PSIZE(srcprefixlen);
1288 if (message & ZEBRA_ZAPI_MESSAGE_NEXTHOP) {
1289 if (version == 4 &&
1290 (command == FRR_ZAPI4_REDISTRIBUTE_IPV4_ADD ||
1291 command == FRR_ZAPI4_REDISTRIBUTE_IPV4_DEL)) {
1292 proto_tree_add_item(tree, hf_zebra_nexthopnum, tvb,
1293 offset, 1, ENC_BIG_ENDIAN);
1294 offset += 1;
1295 proto_tree_add_item(tree, hf_zebra_nexthop4, tvb,
1296 offset, 4, ENC_NA);
1297 offset += 4;
1298 } else if (version == 4 &&
1299 (command == FRR_ZAPI4_REDISTRIBUTE_IPV6_ADD ||
1300 command == FRR_ZAPI4_REDISTRIBUTE_IPV6_DEL)) {
1301 proto_tree_add_item(tree, hf_zebra_nexthopnum, tvb,
1302 offset, 1, ENC_BIG_ENDIAN);
1303 offset += 1;
1304 proto_tree_add_item(tree, hf_zebra_nexthop6, tvb,
1305 offset, 16, ENC_NA);
1306 offset += 16;
1307 } else {
1308 offset = zebra_route_nexthop(tree, request, tvb, offset,
1309 len, family, version);
1312 if (version < 5 && message & ZEBRA_ZAPI_MESSAGE_IFINDEX) {
1313 offset = zebra_route_ifindex(tree, tvb, offset, len);
1315 if ((version < 5 && message & ZEBRA_ZAPI_MESSAGE_DISTANCE) ||
1316 (version >= 5 && message & FRR_ZAPI5_MESSAGE_DISTANCE)) {
1317 proto_tree_add_item(tree, hf_zebra_distance,
1318 tvb, offset, 1, ENC_BIG_ENDIAN);
1319 offset += 1;
1321 if ((version < 5 && message & ZEBRA_ZAPI_MESSAGE_METRIC) ||
1322 (version >= 5 && message & FRR_ZAPI5_MESSAGE_METRIC)) {
1323 proto_tree_add_item(tree, hf_zebra_metric,
1324 tvb, offset, 4, ENC_BIG_ENDIAN);
1325 offset += 4;
1327 if ((version < 4 && message & ZEBRA_ZAPI_MESSAGE_MTU) ||
1328 (version == 4 && message & FRR_ZAPI4_MESSAGE_MTU) ||
1329 (version > 4 && message & FRR_ZAPI5_MESSAGE_MTU)) {
1330 proto_tree_add_item(tree, hf_zebra_mtu,
1331 tvb, offset, 4, ENC_BIG_ENDIAN);
1332 offset += 4;
1334 if ((version < 4 && message & ZEBRA_ZAPI_MESSAGE_TAG) ||
1335 (version == 4 && message & FRR_ZAPI4_MESSAGE_TAG) ||
1336 (version > 4 && message & FRR_ZAPI5_MESSAGE_TAG)) {
1337 proto_tree_add_item(tree, hf_zebra_tag,
1338 tvb, offset, 4, ENC_BIG_ENDIAN);
1339 offset += 4;
1341 if (version > 4 && message & FRR_ZAPI5_MESSAGE_TABLEID) {
1342 proto_tree_add_item(tree, hf_zebra_tableid,
1343 tvb, offset, 4, ENC_BIG_ENDIAN);
1344 offset += 4;
1346 return offset;
1349 static int
1350 zebra_interface_address(proto_tree *tree, tvbuff_t *tvb, int offset)
1352 uint8_t family;
1353 proto_tree_add_item(tree, hf_zebra_index, tvb,
1354 offset, 4, ENC_BIG_ENDIAN);
1355 offset += 4;
1356 proto_tree_add_item(tree, hf_zebra_flags, tvb,
1357 offset, 1, ENC_BIG_ENDIAN);
1358 offset += 1;
1359 proto_tree_add_item(tree, hf_zebra_family, tvb,
1360 offset, 1, ENC_BIG_ENDIAN);
1361 family = tvb_get_uint8(tvb, offset);
1362 offset += 1;
1363 if (family == ZEBRA_FAMILY_IPV4) {
1364 proto_tree_add_item(tree, hf_zebra_prefix4,
1365 tvb, offset, 4, ENC_BIG_ENDIAN);
1366 offset += 4;
1368 else if (family == ZEBRA_FAMILY_IPV6) {
1369 proto_tree_add_item(tree, hf_zebra_prefix6,
1370 tvb, offset, 16, ENC_NA);
1371 offset += 16;
1373 else
1374 return offset;
1376 proto_tree_add_item(tree, hf_zebra_prefixlen, tvb,
1377 offset, 1, ENC_BIG_ENDIAN);
1378 offset += 1;
1380 if (family == ZEBRA_FAMILY_IPV4) {
1381 proto_tree_add_item(tree, hf_zebra_dest4,
1382 tvb, offset, 4, ENC_BIG_ENDIAN);
1383 offset += 4;
1385 else if (family == ZEBRA_FAMILY_IPV6) {
1386 proto_tree_add_item(tree, hf_zebra_dest6,
1387 tvb, offset, 16, ENC_NA);
1388 offset += 16;
1390 return offset;
1393 static int zebra_hello(proto_tree *tree, tvbuff_t *tvb, int offset, int left,
1394 uint8_t version)
1396 proto_tree_add_item(tree, hf_zebra_redist_default, tvb, offset, 1,
1397 ENC_BIG_ENDIAN);
1398 offset += 1;
1399 if (version > 3) {
1400 proto_tree_add_item(tree, hf_zebra_instance, tvb, offset, 2,
1401 ENC_BIG_ENDIAN);
1402 offset += 2;
1405 if (version > 4 && left > offset) {
1406 proto_tree_add_item(tree, hf_zebra_receive_notify, tvb, offset,
1407 1, ENC_BIG_ENDIAN);
1408 offset += 1;
1410 return offset;
1413 static int zebra_redistribute(proto_tree *tree, tvbuff_t *tvb, int offset,
1414 uint8_t version)
1416 if (version > 3) {
1417 proto_tree_add_item(tree, hf_zebra_afi, tvb, offset, 1,
1418 ENC_BIG_ENDIAN);
1419 offset += 1;
1421 if (version == 0) {
1422 proto_tree_add_item(tree, hf_zebra_type_v0, tvb, offset, 1,
1423 ENC_BIG_ENDIAN);
1424 } else if (version < 4) {
1425 proto_tree_add_item(tree, hf_zebra_type_v1, tvb, offset, 1,
1426 ENC_BIG_ENDIAN);
1427 } else if (version == 4) {
1428 proto_tree_add_item(tree, hf_zebra_type_v4, tvb, offset, 1,
1429 ENC_BIG_ENDIAN);
1430 } else {
1431 proto_tree_add_item(tree, hf_zebra_type_v5, tvb, offset, 1,
1432 ENC_BIG_ENDIAN);
1434 offset += 1;
1435 if (version > 3) {
1436 proto_tree_add_item(tree, hf_zebra_instance, tvb, offset, 2,
1437 ENC_BIG_ENDIAN);
1438 offset += 2;
1441 return offset;
1444 static int zebra_vrf(proto_tree *tree, tvbuff_t *tvb, int offset)
1446 proto_tree_add_item(tree, hf_zebra_vrf_table_id, tvb, offset, 4,
1447 ENC_BIG_ENDIAN);
1448 offset += 4;
1449 proto_tree_add_item(tree, hf_zebra_vrf_netns_name, tvb, offset, 16,
1450 ENC_ASCII | ENC_NA);
1451 offset += 16;
1452 proto_tree_add_item(tree, hf_zebra_vrf_name, tvb, offset, 36,
1453 ENC_ASCII | ENC_NA);
1454 offset += 36;
1455 return offset;
1458 static int zebra_label_manager_connect(proto_tree *tree, tvbuff_t *tvb,
1459 int offset)
1461 proto_tree_add_item(tree, hf_zebra_proto, tvb, offset, 1,
1462 ENC_BIG_ENDIAN);
1463 offset += 1;
1464 proto_tree_add_item(tree, hf_zebra_instance, tvb, offset, 2,
1465 ENC_BIG_ENDIAN);
1466 offset += 2;
1467 return offset;
1470 static int zebra_get_label_chunk(proto_tree *tree, bool request,
1471 tvbuff_t *tvb, int offset)
1473 proto_tree_add_item(tree, hf_zebra_proto, tvb, offset, 1,
1474 ENC_BIG_ENDIAN);
1475 offset += 1;
1476 proto_tree_add_item(tree, hf_zebra_instance, tvb, offset, 2,
1477 ENC_BIG_ENDIAN);
1478 offset += 2;
1479 proto_tree_add_item(tree, hf_zebra_label_chunk_keep, tvb, offset, 1,
1480 ENC_BIG_ENDIAN);
1481 offset += 1;
1482 if (request) {
1483 proto_tree_add_item(tree, hf_zebra_label_chunk_size, tvb,
1484 offset, 4, ENC_BIG_ENDIAN);
1485 offset += 4;
1486 } else {
1487 proto_tree_add_item(tree, hf_zebra_label_chunk_start, tvb,
1488 offset, 4, ENC_BIG_ENDIAN);
1489 offset += 4;
1490 proto_tree_add_item(tree, hf_zebra_label_chunk_end, tvb, offset,
1491 4, ENC_BIG_ENDIAN);
1492 offset += 4;
1495 return offset;
1498 static int zebra_capabilties(proto_tree *tree, tvbuff_t *tvb, int offset)
1500 proto_tree_add_item(tree, hf_zebra_mpls_enabled, tvb, offset, 1,
1501 ENC_BIG_ENDIAN);
1502 offset += 1;
1503 proto_tree_add_item(tree, hf_zebra_multipath_num, tvb, offset, 4,
1504 ENC_BIG_ENDIAN);
1505 offset += 4;
1506 return offset;
1509 static int zebra_nexthop_register(proto_tree *tree, tvbuff_t *tvb, int offset,
1510 uint16_t len, int msg_offset)
1512 int init_offset = offset, rest = (int)len - msg_offset;
1513 uint16_t family = ZEBRA_FAMILY_UNSPEC;
1514 while (rest > offset - init_offset) {
1515 proto_tree_add_item(tree, hf_zebra_flags, tvb, offset, 1,
1516 ENC_BIG_ENDIAN);
1517 offset += 1;
1518 family = tvb_get_ntohs(tvb, offset);
1519 proto_tree_add_item(tree, hf_zebra_family, tvb, offset, 2,
1520 ENC_BIG_ENDIAN);
1521 offset += 2;
1522 proto_tree_add_item(tree, hf_zebra_prefixlen, tvb, offset, 1,
1523 ENC_BIG_ENDIAN);
1524 offset += 1;
1525 if (family == ZEBRA_FAMILY_IPV6) {
1526 proto_tree_add_item(tree, hf_zebra_prefix6, tvb, offset,
1527 16, ENC_NA);
1528 offset += 16;
1529 } else if (family == ZEBRA_FAMILY_IPV4) {
1530 proto_tree_add_item(tree, hf_zebra_prefix4, tvb, offset,
1531 4, ENC_BIG_ENDIAN);
1532 offset += 4;
1535 return offset;
1538 static int
1539 zebra_interface(proto_tree *tree, tvbuff_t *tvb, int offset,
1540 uint16_t command, uint8_t version)
1542 int maclen;
1543 proto_tree_add_item(tree, hf_zebra_interface,
1544 tvb, offset, INTERFACE_NAMSIZ, ENC_ASCII);
1545 offset += INTERFACE_NAMSIZ;
1546 proto_tree_add_item(tree, hf_zebra_index, tvb,
1547 offset, 4, ENC_BIG_ENDIAN);
1548 offset += 4;
1549 proto_tree_add_item(tree, hf_zebra_intstatus, tvb,
1550 offset, 1, ENC_BIG_ENDIAN);
1551 offset += 1;
1552 if (version != 0) {
1553 proto_tree_add_item(tree, hf_zebra_intflags, tvb,
1554 offset, 8, ENC_BIG_ENDIAN);
1555 offset += 8;
1556 } else {
1557 proto_tree_add_item(tree, hf_zebra_intflags, tvb,
1558 offset, 4, ENC_BIG_ENDIAN);
1559 offset += 4;
1561 if (version >= 4) {
1562 proto_tree_add_item(tree, hf_zebra_ptmenable, tvb, offset, 1,
1563 ENC_BIG_ENDIAN);
1564 offset += 1;
1565 proto_tree_add_item(tree, hf_zebra_ptmstatus, tvb, offset, 1,
1566 ENC_BIG_ENDIAN);
1567 offset += 1;
1569 proto_tree_add_item(tree, hf_zebra_metric, tvb, offset, 4,
1570 ENC_BIG_ENDIAN);
1571 offset += 4;
1572 if (version >= 4) {
1573 proto_tree_add_item(tree, hf_zebra_speed, tvb, offset, 4,
1574 ENC_BIG_ENDIAN);
1575 offset += 4;
1577 proto_tree_add_item(tree, hf_zebra_mtu, tvb,
1578 offset, 4, ENC_BIG_ENDIAN);
1579 offset += 4;
1580 if (version != 0) {
1581 proto_tree_add_item(tree, hf_zebra_mtu6, tvb,
1582 offset, 4, ENC_BIG_ENDIAN);
1583 offset += 4;
1585 proto_tree_add_item(tree, hf_zebra_bandwidth, tvb,
1586 offset, 4, ENC_BIG_ENDIAN);
1587 offset += 4;
1588 if (version > 2 || (version <= 2 && command == ZEBRA_INTERFACE_ADD)) {
1589 if (version > 2) {
1590 proto_tree_add_item(tree, hf_zebra_lltype, tvb,
1591 offset, 4, ENC_BIG_ENDIAN);
1592 offset += 4;
1594 if (version != 0) {
1595 maclen = (int)tvb_get_ntohl(tvb, offset);
1596 proto_tree_add_item(tree, hf_zebra_maclen, tvb,
1597 offset, 4, ENC_BIG_ENDIAN);
1598 offset += 4;
1599 if (maclen > 0)
1600 proto_tree_add_item(tree, hf_zebra_mac, tvb,
1601 offset, maclen, ENC_NA);
1602 offset += maclen;
1604 if (version > 2) {
1605 proto_tree_add_item(tree, hf_zebra_haslinkparam, tvb,
1606 offset, 1, ENC_BIG_ENDIAN);
1607 offset += 1;
1610 return offset;
1613 static int
1614 zebra_nexthop_lookup(proto_tree *tree, bool request, tvbuff_t *tvb,
1615 int offset, uint16_t len, uint8_t family, uint8_t version)
1617 if (family == ZEBRA_FAMILY_IPV6) {
1618 proto_tree_add_item(tree, hf_zebra_dest6, tvb, offset, 16,
1619 ENC_NA);
1620 offset += 16;
1621 }else {
1622 proto_tree_add_item(tree, hf_zebra_dest4, tvb, offset, 4,
1623 ENC_BIG_ENDIAN);
1624 offset += 4;
1626 if (!request) {
1627 proto_tree_add_item(tree, hf_zebra_metric,tvb, offset, 4,
1628 ENC_BIG_ENDIAN);
1629 offset += 4;
1630 offset = zebra_route_nexthop(tree, request, tvb, offset, len,
1631 family, version);
1633 return offset;
1636 static int
1637 zerba_router_update(proto_tree *tree, tvbuff_t *tvb, int offset)
1639 proto_tree_add_item(tree, hf_zebra_routeridfamily, tvb, offset, 1,
1640 ENC_BIG_ENDIAN);
1641 offset += 1;
1642 proto_tree_add_item(tree, hf_zebra_routeridaddress, tvb,
1643 offset, 4, ENC_BIG_ENDIAN);
1644 offset += 4;
1645 proto_tree_add_item(tree, hf_zebra_routeridmask, tvb,
1646 offset, 1, ENC_BIG_ENDIAN);
1647 offset += 1;
1648 return offset;
1651 static int
1652 zebra_nexthop_update(proto_tree *tree, tvbuff_t *tvb, int offset,
1653 uint8_t version)
1655 uint16_t family = tvb_get_ntohs(tvb, offset);
1656 uint8_t prefixlen, nexthopcount, nexthoptype, labelnum;
1657 proto_tree_add_item(tree, hf_zebra_family, tvb, offset, 2,
1658 ENC_BIG_ENDIAN);
1659 offset += 2;
1660 prefixlen = tvb_get_uint8(tvb, offset);
1661 proto_tree_add_uint(tree, hf_zebra_prefixlen, tvb, offset, 1,
1662 prefixlen);
1663 offset += 1;
1664 if (family == ZEBRA_FAMILY_IPV6) {
1665 proto_tree_add_item(tree, hf_zebra_prefix6, tvb, offset, 16,
1666 ENC_NA);
1667 offset += 16;
1668 } else if (family == ZEBRA_FAMILY_IPV4) {
1669 proto_tree_add_item(tree, hf_zebra_prefix4, tvb, offset, 4,
1670 ENC_BIG_ENDIAN);
1671 offset += 4;
1674 if (version > 4) {
1675 proto_tree_add_item(tree, hf_zebra_type_v5, tvb, offset, 1,
1676 ENC_BIG_ENDIAN);
1677 offset += 1;
1680 if (version > 4) {
1681 proto_tree_add_item(tree, hf_zebra_instance, tvb, offset, 2,
1682 ENC_BIG_ENDIAN);
1683 offset += 2;
1685 if (version > 3) {
1686 proto_tree_add_item(tree, hf_zebra_distance, tvb, offset, 1,
1687 ENC_BIG_ENDIAN);
1688 offset += 1;
1691 proto_tree_add_item(tree, hf_zebra_metric, tvb, offset, 4,
1692 ENC_BIG_ENDIAN);
1693 offset += 4;
1695 nexthopcount = tvb_get_uint8(tvb, offset);
1696 proto_tree_add_uint(tree, hf_zebra_nexthopnum, tvb, offset, 1,
1697 nexthopcount);
1698 offset += 1;
1700 while (nexthopcount--) {
1701 nexthoptype = tvb_get_uint8(tvb, offset);
1702 if (version > 3) {
1703 proto_tree_add_item(tree, hf_zebra_nexthoptype_frr, tvb,
1704 offset, 1, ENC_BIG_ENDIAN);
1705 } else {
1706 proto_tree_add_item(tree, hf_zebra_nexthoptype, tvb,
1707 offset, 1, ENC_BIG_ENDIAN);
1709 offset += 1;
1711 if ((version < 4 &&
1712 (nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6 ||
1713 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6_IFINDEX ||
1714 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6_IFNAME)) ||
1715 (version >= 4 &&
1716 (nexthoptype == FRR_NEXTHOP_TYPE_IPV6 ||
1717 nexthoptype == FRR_NEXTHOP_TYPE_IPV6_IFINDEX))) {
1718 proto_tree_add_item(tree, hf_zebra_nexthop6, tvb,
1719 offset, 16, ENC_NA);
1720 offset += 16;
1722 if ((version < 4 &&
1723 (nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4 ||
1724 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4_IFINDEX ||
1725 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4_IFNAME)) ||
1726 (version >= 4 &&
1727 (nexthoptype == FRR_NEXTHOP_TYPE_IPV4 ||
1728 nexthoptype == FRR_NEXTHOP_TYPE_IPV4_IFINDEX))) {
1729 proto_tree_add_item(tree, hf_zebra_nexthop4, tvb,
1730 offset, 4, ENC_NA);
1731 offset += 4;
1733 if (nexthoptype == ZEBRA_NEXTHOP_TYPE_IFINDEX ||
1734 (version < 4 &&
1735 (nexthoptype == ZEBRA_NEXTHOP_TYPE_IFNAME ||
1736 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4_IFINDEX ||
1737 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV4_IFNAME ||
1738 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6_IFINDEX ||
1739 nexthoptype == ZEBRA_NEXTHOP_TYPE_IPV6_IFNAME)) ||
1740 (version >= 4 &&
1741 (nexthoptype == FRR_NEXTHOP_TYPE_IPV4 ||
1742 nexthoptype == FRR_NEXTHOP_TYPE_IPV4_IFINDEX ||
1743 nexthoptype == FRR_NEXTHOP_TYPE_IPV6 ||
1744 nexthoptype == FRR_NEXTHOP_TYPE_IPV6_IFINDEX))) {
1745 proto_tree_add_item(tree, hf_zebra_index, tvb, offset,
1746 4, ENC_BIG_ENDIAN);
1747 offset += 4;
1749 if (version > 4) {
1750 labelnum = tvb_get_uint8(tvb, offset);
1751 proto_tree_add_uint(tree, hf_zebra_labelnum, tvb,
1752 offset, 1, labelnum);
1753 offset += 1;
1754 while (labelnum--) {
1755 proto_tree_add_item(tree, hf_zebra_label, tvb,
1756 offset, 4, ENC_BIG_ENDIAN);
1757 offset += 4;
1761 return offset;
1764 static int
1765 dissect_zebra_request(proto_tree *tree, bool request, tvbuff_t *tvb,
1766 int offset, int left, uint16_t len, uint16_t command,
1767 uint8_t version)
1769 int init_offset = offset;
1770 proto_tree_add_uint(tree, hf_zebra_len, tvb, offset, 2, len);
1771 offset += 2;
1772 if (version != 0) {
1773 proto_tree_add_item(tree, hf_zebra_marker, tvb, offset, 1, ENC_NA);
1774 offset += 1;
1775 proto_tree_add_uint(tree, hf_zebra_version, tvb, offset, 1,
1776 version);
1777 offset += 1;
1778 if (version == 3 || version == 4) {
1779 proto_tree_add_item(tree, hf_zebra_vrfid, tvb, offset,
1780 2, ENC_BIG_ENDIAN);
1781 offset += 2;
1782 } else if (version > 4) {
1783 proto_tree_add_item(tree, hf_zebra_vrfid, tvb, offset,
1784 4, ENC_BIG_ENDIAN);
1785 offset += 4;
1787 if (version < 4) {
1788 proto_tree_add_uint(tree, hf_zebra_command, tvb, offset,
1789 2, command);
1790 } else if (version == 4) {
1791 proto_tree_add_uint(tree, hf_zebra_command_v4, tvb,
1792 offset, 2, command);
1793 } else if (version == 5) {
1794 proto_tree_add_uint(tree, hf_zebra_command_v5, tvb,
1795 offset, 2, command);
1796 } else {
1797 proto_tree_add_uint(tree, hf_zebra_command_v6, tvb,
1798 offset, 2, command);
1800 offset += 2;
1801 } else {
1802 proto_tree_add_uint(tree, hf_zebra_command, tvb, offset, 1,
1803 command);
1804 offset += 1;
1807 if (version < 4) {
1808 switch (command) {
1809 case ZEBRA_INTERFACE_ADD:
1810 case ZEBRA_INTERFACE_DELETE:
1811 case ZEBRA_INTERFACE_UP:
1812 case ZEBRA_INTERFACE_DOWN:
1813 if (request)
1814 break; /* Request just subscribes to messages */
1815 offset = zebra_interface(tree, tvb, offset, command,
1816 version);
1817 break;
1818 case ZEBRA_INTERFACE_ADDRESS_ADD:
1819 case ZEBRA_INTERFACE_ADDRESS_DELETE:
1820 offset = zebra_interface_address(tree, tvb, offset);
1821 break;
1822 case ZEBRA_IPV4_ROUTE_ADD:
1823 case ZEBRA_IPV4_ROUTE_DELETE:
1824 offset = zebra_route(tree, request, tvb, offset, len,
1825 ZEBRA_FAMILY_IPV4, command, version);
1826 break;
1827 case ZEBRA_IPV6_ROUTE_ADD:
1828 case ZEBRA_IPV6_ROUTE_DELETE:
1829 offset = zebra_route(tree, request, tvb, offset, len,
1830 ZEBRA_FAMILY_IPV6, command, version);
1831 break;
1832 case ZEBRA_REDISTRIBUTE_ADD:
1833 case ZEBRA_REDISTRIBUTE_DEFAULT_ADD:
1834 offset = zebra_redistribute(tree, tvb, offset, version);
1835 break;
1836 case ZEBRA_IPV4_IMPORT_LOOKUP:
1837 case ZEBRA_IPV4_NEXTHOP_LOOKUP:
1838 offset = zebra_nexthop_lookup(tree, request, tvb,
1839 offset, len,
1840 ZEBRA_FAMILY_IPV4,
1841 version);
1842 break;
1843 case ZEBRA_IPV6_IMPORT_LOOKUP:
1844 case ZEBRA_IPV6_NEXTHOP_LOOKUP:
1845 offset = zebra_nexthop_lookup(tree, request, tvb,
1846 offset, len,
1847 ZEBRA_FAMILY_IPV6,
1848 version);
1849 break;
1850 case ZEBRA_ROUTER_ID_UPDATE:
1851 offset = zerba_router_update(tree, tvb, offset);
1852 break;
1853 case ZEBRA_ROUTER_ID_ADD:
1854 case ZEBRA_ROUTER_ID_DELETE:
1855 case ZEBRA_REDISTRIBUTE_DEFAULT_DELETE:
1856 /* nothing to do */
1857 break;
1858 case ZEBRA_REDISTRIBUTE_DELETE:
1859 /* in version 1+, there's a route type field */
1860 if (version > 0) {
1861 proto_tree_add_item(tree, hf_zebra_type_v1, tvb,
1862 offset, 1, ENC_BIG_ENDIAN);
1864 break;
1865 case ZEBRA_HELLO:
1866 offset = zebra_hello(tree, tvb, offset, left, version);
1867 break;
1868 case ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB:
1869 case ZEBRA_VRF_UNREGISTER:
1870 case ZEBRA_INTERFACE_LINK_PARAMS:
1871 break;
1872 case ZEBRA_NEXTHOP_REGISTER:
1873 case ZEBRA_NEXTHOP_UNREGISTER:
1874 offset = zebra_nexthop_register(tree, tvb, offset, len,
1875 offset - init_offset);
1876 break;
1877 case ZEBRA_NEXTHOP_UPDATE:
1878 offset = zebra_nexthop_update(tree, tvb, offset, version);
1879 break;
1881 } else if (version == 4) {
1882 switch (command) {
1883 case FRR_ZAPI4_INTERFACE_ADD:
1884 case FRR_ZAPI4_INTERFACE_UP:
1885 case FRR_ZAPI4_INTERFACE_DOWN:
1886 case FRR_ZAPI4_INTERFACE_DELETE:
1887 if (request)
1888 break; /* Request just subscribes to messages */
1889 offset = zebra_interface(tree, tvb, offset, command,
1890 version);
1891 break;
1892 case FRR_ZAPI4_INTERFACE_ADDRESS_ADD:
1893 case FRR_ZAPI4_INTERFACE_ADDRESS_DELETE:
1894 offset = zebra_interface_address(tree, tvb, offset);
1895 break;
1896 case FRR_ZAPI4_IPV4_ROUTE_ADD:
1897 case FRR_ZAPI4_IPV4_ROUTE_DELETE:
1898 case FRR_ZAPI4_REDISTRIBUTE_IPV4_ADD:
1899 case FRR_ZAPI4_REDISTRIBUTE_IPV4_DEL:
1900 offset = zebra_route(tree, request, tvb, offset, len,
1901 ZEBRA_FAMILY_IPV4, command,
1902 version);
1903 break;
1904 case FRR_ZAPI4_IPV6_ROUTE_ADD:
1905 case FRR_ZAPI4_IPV6_ROUTE_DELETE:
1906 case FRR_ZAPI4_REDISTRIBUTE_IPV6_ADD:
1907 case FRR_ZAPI4_REDISTRIBUTE_IPV6_DEL:
1908 offset = zebra_route(tree, request, tvb, offset, len,
1909 ZEBRA_FAMILY_IPV6, command,
1910 version);
1911 break;
1912 case FRR_ZAPI4_REDISTRIBUTE_ADD:
1913 case FRR_ZAPI4_REDISTRIBUTE_DEFAULT_ADD:
1914 offset = zebra_redistribute(tree, tvb, offset, version);
1915 break;
1916 case FRR_ZAPI4_ROUTER_ID_UPDATE:
1917 offset = zerba_router_update(tree, tvb, offset);
1918 break;
1919 case FRR_ZAPI4_ROUTER_ID_ADD:
1920 case FRR_ZAPI4_ROUTER_ID_DELETE:
1921 case FRR_ZAPI4_REDISTRIBUTE_DEFAULT_DELETE:
1922 /* nothing to do */
1923 break;
1924 case FRR_ZAPI4_REDISTRIBUTE_DELETE:
1925 proto_tree_add_item(tree, hf_zebra_type_v4, tvb, offset,
1926 1, ENC_BIG_ENDIAN);
1927 offset += 1;
1928 break;
1929 case FRR_ZAPI4_HELLO:
1930 offset = zebra_hello(tree, tvb, offset, left, version);
1931 break;
1932 case FRR_ZAPI4_NEXTHOP_REGISTER:
1933 case FRR_ZAPI4_NEXTHOP_UNREGISTER:
1934 offset = zebra_nexthop_register(tree, tvb, offset, len,
1935 offset - init_offset);
1936 break;
1937 case FRR_ZAPI4_NEXTHOP_UPDATE:
1938 offset = zebra_nexthop_update(tree, tvb, offset,
1939 version);
1940 break;
1941 case FRR_ZAPI4_INTERFACE_NBR_ADDRESS_ADD:
1942 case FRR_ZAPI4_INTERFACE_NBR_ADDRESS_DELETE:
1943 case FRR_ZAPI4_INTERFACE_BFD_DEST_UPDATE:
1944 case FRR_ZAPI4_IMPORT_ROUTE_REGISTER:
1945 case FRR_ZAPI4_IMPORT_ROUTE_UNREGISTER:
1946 case FRR_ZAPI4_IMPORT_CHECK_UPDATE:
1947 case FRR_ZAPI4_IPV4_ROUTE_IPV6_NEXTHOP_ADD:
1948 case FRR_ZAPI4_BFD_DEST_REGISTER:
1949 case FRR_ZAPI4_BFD_DEST_DEREGISTER:
1950 case FRR_ZAPI4_BFD_DEST_UPDATE:
1951 case FRR_ZAPI4_BFD_DEST_REPLAY:
1952 case FRR_ZAPI4_VRF_UNREGISTER:
1953 case FRR_ZAPI4_VRF_ADD:
1954 case FRR_ZAPI4_VRF_DELETE:
1955 case FRR_ZAPI4_INTERFACE_VRF_UPDATE:
1956 break;
1957 case FRR_ZAPI4_BFD_CLIENT_REGISTER:
1958 proto_tree_add_item(tree, hf_zebra_pid, tvb, offset, 4,
1959 ENC_BIG_ENDIAN);
1960 offset += 4;
1961 break;
1962 case FRR_ZAPI4_INTERFACE_ENABLE_RADV:
1963 case FRR_ZAPI4_INTERFACE_DISABLE_RADV:
1964 case FRR_ZAPI4_IPV4_NEXTHOP_LOOKUP_MRIB:
1965 case FRR_ZAPI4_INTERFACE_LINK_PARAMS:
1966 case FRR_ZAPI4_MPLS_LABELS_ADD:
1967 case FRR_ZAPI4_MPLS_LABELS_DELETE:
1968 case FRR_ZAPI4_IPV4_NEXTHOP_ADD:
1969 case FRR_ZAPI4_IPV4_NEXTHOP_DELETE:
1970 case FRR_ZAPI4_IPV6_NEXTHOP_ADD:
1971 case FRR_ZAPI4_IPV6_NEXTHOP_DELETE:
1972 case FRR_ZAPI4_IPMR_ROUTE_STATS:
1973 case FRR_ZAPI4_LABEL_MANAGER_CONNECT:
1974 case FRR_ZAPI4_GET_LABEL_CHUNK:
1975 case FRR_ZAPI4_RELEASE_LABEL_CHUNK:
1976 case FRR_ZAPI4_PW_ADD:
1977 case FRR_ZAPI4_PW_DELETE:
1978 case FRR_ZAPI4_PW_SET:
1979 case FRR_ZAPI4_PW_UNSET:
1980 case FRR_ZAPI4_PW_STATUS_UPDATE:
1981 break;
1983 } else if (version == 5) {
1984 switch (command) {
1985 case FRR_ZAPI5_INTERFACE_ADD:
1986 case FRR_ZAPI5_INTERFACE_UP:
1987 case FRR_ZAPI5_INTERFACE_DOWN:
1988 case FRR_ZAPI5_INTERFACE_DELETE:
1989 if (request)
1990 break; /* Request just subscribes to messages */
1991 offset = zebra_interface(tree, tvb, offset, command,
1992 version);
1993 break;
1994 case FRR_ZAPI5_INTERFACE_ADDRESS_ADD:
1995 case FRR_ZAPI5_INTERFACE_ADDRESS_DELETE:
1996 offset = zebra_interface_address(tree, tvb, offset);
1997 break;
1998 case FRR_ZAPI5_IPV4_ROUTE_ADD:
1999 case FRR_ZAPI5_IPV4_ROUTE_DELETE:
2000 offset = zebra_route(tree, request, tvb, offset, len,
2001 ZEBRA_FAMILY_IPV4, command,
2002 version);
2003 break;
2004 case FRR_ZAPI5_IPV6_ROUTE_ADD:
2005 case FRR_ZAPI5_IPV6_ROUTE_DELETE:
2006 offset = zebra_route(tree, request, tvb, offset, len,
2007 ZEBRA_FAMILY_IPV6, command,
2008 version);
2009 break;
2010 case FRR_ZAPI5_ROUTE_ADD:
2011 case FRR_ZAPI5_ROUTE_DELETE:
2012 case FRR_ZAPI5_REDISTRIBUTE_ROUTE_ADD:
2013 case FRR_ZAPI5_REDISTRIBUTE_ROUTE_DEL:
2014 offset = zebra_route(tree, request, tvb, offset, len,
2015 ZEBRA_FAMILY_UNSPEC, command,
2016 version);
2017 break;
2018 case FRR_ZAPI5_REDISTRIBUTE_ADD:
2019 case FRR_ZAPI5_REDISTRIBUTE_DEFAULT_ADD:
2020 offset = zebra_redistribute(tree, tvb, offset, version);
2021 break;
2022 case FRR_ZAPI5_ROUTER_ID_UPDATE:
2023 offset = zerba_router_update(tree, tvb, offset);
2024 break;
2025 case FRR_ZAPI5_ROUTER_ID_ADD:
2026 case FRR_ZAPI5_ROUTER_ID_DELETE:
2027 case FRR_ZAPI5_REDISTRIBUTE_DEFAULT_DELETE:
2028 /* nothing to do */
2029 break;
2030 case FRR_ZAPI5_REDISTRIBUTE_DELETE:
2031 proto_tree_add_item(tree, hf_zebra_type_v5, tvb, offset,
2032 1, ENC_BIG_ENDIAN);
2033 offset += 1;
2034 break;
2035 case FRR_ZAPI5_HELLO:
2036 offset = zebra_hello(tree, tvb, offset, left, version);
2037 break;
2038 case FRR_ZAPI5_CAPABILITIES:
2039 offset = zebra_capabilties(tree, tvb, offset);
2040 break;
2041 case FRR_ZAPI5_NEXTHOP_REGISTER:
2042 case FRR_ZAPI5_NEXTHOP_UNREGISTER:
2043 offset = zebra_nexthop_register(tree, tvb, offset, len,
2044 offset - init_offset);
2045 break;
2046 case FRR_ZAPI5_NEXTHOP_UPDATE:
2047 offset = zebra_nexthop_update(tree, tvb, offset,
2048 version);
2049 break;
2050 case FRR_ZAPI5_INTERFACE_NBR_ADDRESS_ADD:
2051 case FRR_ZAPI5_INTERFACE_NBR_ADDRESS_DELETE:
2052 case FRR_ZAPI5_INTERFACE_BFD_DEST_UPDATE:
2053 case FRR_ZAPI5_IMPORT_ROUTE_REGISTER:
2054 case FRR_ZAPI5_IMPORT_ROUTE_UNREGISTER:
2055 case FRR_ZAPI5_IMPORT_CHECK_UPDATE:
2056 case FRR_ZAPI5_IPV4_ROUTE_IPV6_NEXTHOP_ADD:
2057 case FRR_ZAPI5_BFD_DEST_REGISTER:
2058 case FRR_ZAPI5_BFD_DEST_DEREGISTER:
2059 case FRR_ZAPI5_BFD_DEST_UPDATE:
2060 case FRR_ZAPI5_BFD_DEST_REPLAY:
2061 case FRR_ZAPI5_VRF_UNREGISTER:
2062 break;
2063 case FRR_ZAPI5_VRF_ADD:
2064 offset = zebra_vrf(tree, tvb, offset);
2065 break;
2066 case FRR_ZAPI5_VRF_DELETE:
2067 case FRR_ZAPI5_VRF_LABEL:
2068 case FRR_ZAPI5_INTERFACE_VRF_UPDATE:
2069 break;
2070 case FRR_ZAPI5_BFD_CLIENT_REGISTER:
2071 proto_tree_add_item(tree, hf_zebra_pid, tvb, offset, 4,
2072 ENC_BIG_ENDIAN);
2073 offset += 4;
2074 break;
2075 case FRR_ZAPI5_INTERFACE_ENABLE_RADV:
2076 case FRR_ZAPI5_INTERFACE_DISABLE_RADV:
2077 case FRR_ZAPI5_IPV4_NEXTHOP_LOOKUP_MRIB:
2078 case FRR_ZAPI5_INTERFACE_LINK_PARAMS:
2079 case FRR_ZAPI5_MPLS_LABELS_ADD:
2080 case FRR_ZAPI5_MPLS_LABELS_DELETE:
2081 case FRR_ZAPI5_IPMR_ROUTE_STATS:
2082 break;
2083 case FRR_ZAPI5_LABEL_MANAGER_CONNECT:
2084 case FRR_ZAPI5_LABEL_MANAGER_CONNECT_ASYNC:
2085 offset = zebra_label_manager_connect(tree, tvb, offset);
2086 break;
2087 case FRR_ZAPI5_GET_LABEL_CHUNK:
2088 offset =
2089 zebra_get_label_chunk(tree, request, tvb, offset);
2090 break;
2091 case FRR_ZAPI5_RELEASE_LABEL_CHUNK:
2092 case FRR_ZAPI5_FEC_REGISTER:
2093 case FRR_ZAPI5_FEC_UNREGISTER:
2094 case FRR_ZAPI5_FEC_UPDATE:
2095 case FRR_ZAPI5_ADVERTISE_DEFAULT_GW:
2096 case FRR_ZAPI5_ADVERTISE_SUBNET:
2097 case FRR_ZAPI5_ADVERTISE_ALL_VNI:
2098 case FRR_ZAPI5_VNI_ADD:
2099 case FRR_ZAPI5_VNI_DEL:
2100 case FRR_ZAPI5_L3VNI_ADD:
2101 case FRR_ZAPI5_L3VNI_DEL:
2102 case FRR_ZAPI5_REMOTE_VTEP_ADD:
2103 case FRR_ZAPI5_REMOTE_VTEP_DEL:
2104 case FRR_ZAPI5_MACIP_ADD:
2105 case FRR_ZAPI5_MACIP_DEL:
2106 case FRR_ZAPI5_IP_PREFIX_ROUTE_ADD:
2107 case FRR_ZAPI5_IP_PREFIX_ROUTE_DEL:
2108 case FRR_ZAPI5_REMOTE_MACIP_ADD:
2109 case FRR_ZAPI5_REMOTE_MACIP_DEL:
2110 case FRR_ZAPI5_PW_ADD:
2111 case FRR_ZAPI5_PW_DELETE:
2112 case FRR_ZAPI5_PW_SET:
2113 case FRR_ZAPI5_PW_UNSET:
2114 case FRR_ZAPI5_PW_STATUS_UPDATE:
2115 case FRR_ZAPI5_RULE_ADD:
2116 case FRR_ZAPI5_RULE_DELETE:
2117 case FRR_ZAPI5_RULE_NOTIFY_OWNER:
2118 case FRR_ZAPI5_TABLE_MANAGER_CONNECT:
2119 case FRR_ZAPI5_GET_TABLE_CHUNK:
2120 case FRR_ZAPI5_RELEASE_TABLE_CHUNK:
2121 case FRR_ZAPI5_IPSET_CREATE:
2122 case FRR_ZAPI5_IPSET_DESTROY:
2123 case FRR_ZAPI5_IPSET_ENTRY_ADD:
2124 case FRR_ZAPI5_IPSET_ENTRY_DELETE:
2125 case FRR_ZAPI5_IPSET_NOTIFY_OWNER:
2126 case FRR_ZAPI5_IPSET_ENTRY_NOTIFY_OWNER:
2127 case FRR_ZAPI5_IPTABLE_ADD:
2128 case FRR_ZAPI5_IPTABLE_DELETE:
2129 case FRR_ZAPI5_IPTABLE_NOTIFY_OWNER:
2130 break;
2132 } else { /* version 6 */
2133 switch (command) {
2134 case FRR_ZAPI6_INTERFACE_ADD:
2135 case FRR_ZAPI6_INTERFACE_UP:
2136 case FRR_ZAPI6_INTERFACE_DOWN:
2137 case FRR_ZAPI6_INTERFACE_DELETE:
2138 if (request)
2139 break; /* Request just subscribes to messages */
2140 offset = zebra_interface(tree, tvb, offset, command,
2141 version);
2142 break;
2143 case FRR_ZAPI6_INTERFACE_ADDRESS_ADD:
2144 case FRR_ZAPI6_INTERFACE_ADDRESS_DELETE:
2145 offset = zebra_interface_address(tree, tvb, offset);
2146 break;
2147 case FRR_ZAPI6_ROUTE_ADD:
2148 case FRR_ZAPI6_ROUTE_DELETE:
2149 case FRR_ZAPI6_REDISTRIBUTE_ROUTE_ADD:
2150 case FRR_ZAPI6_REDISTRIBUTE_ROUTE_DEL:
2151 offset = zebra_route(tree, request, tvb, offset, len,
2152 ZEBRA_FAMILY_UNSPEC, command,
2153 version);
2154 break;
2155 case FRR_ZAPI6_REDISTRIBUTE_ADD:
2156 case FRR_ZAPI6_REDISTRIBUTE_DEFAULT_ADD:
2157 offset = zebra_redistribute(tree, tvb, offset, version);
2158 break;
2159 case FRR_ZAPI6_ROUTER_ID_UPDATE:
2160 offset = zerba_router_update(tree, tvb, offset);
2161 break;
2162 case FRR_ZAPI6_ROUTER_ID_ADD:
2163 case FRR_ZAPI6_ROUTER_ID_DELETE:
2164 case FRR_ZAPI6_REDISTRIBUTE_DEFAULT_DELETE:
2165 /* nothing to do */
2166 break;
2167 case FRR_ZAPI6_REDISTRIBUTE_DELETE:
2168 proto_tree_add_item(tree, hf_zebra_type_v5, tvb, offset,
2169 1, ENC_BIG_ENDIAN);
2170 offset += 1;
2171 break;
2172 case FRR_ZAPI6_HELLO:
2173 offset = zebra_hello(tree, tvb, offset, left, version);
2174 break;
2175 case FRR_ZAPI6_CAPABILITIES:
2176 offset = zebra_capabilties(tree, tvb, offset);
2177 break;
2178 case FRR_ZAPI6_NEXTHOP_REGISTER:
2179 case FRR_ZAPI6_NEXTHOP_UNREGISTER:
2180 offset = zebra_nexthop_register(tree, tvb, offset, len,
2181 offset - init_offset);
2182 break;
2183 case FRR_ZAPI6_NEXTHOP_UPDATE:
2184 offset = zebra_nexthop_update(tree, tvb, offset,
2185 version);
2186 break;
2187 case FRR_ZAPI6_INTERFACE_NBR_ADDRESS_ADD:
2188 case FRR_ZAPI6_INTERFACE_NBR_ADDRESS_DELETE:
2189 case FRR_ZAPI6_INTERFACE_BFD_DEST_UPDATE:
2190 case FRR_ZAPI6_IMPORT_ROUTE_REGISTER:
2191 case FRR_ZAPI6_IMPORT_ROUTE_UNREGISTER:
2192 case FRR_ZAPI6_IMPORT_CHECK_UPDATE:
2193 //case FRR_ZAPI6_IPV4_ROUTE_IPV6_NEXTHOP_ADD:
2194 case FRR_ZAPI6_BFD_DEST_REGISTER:
2195 case FRR_ZAPI6_BFD_DEST_DEREGISTER:
2196 case FRR_ZAPI6_BFD_DEST_UPDATE:
2197 case FRR_ZAPI6_BFD_DEST_REPLAY:
2198 case FRR_ZAPI6_VRF_UNREGISTER:
2199 break;
2200 case FRR_ZAPI6_VRF_ADD:
2201 offset = zebra_vrf(tree, tvb, offset);
2202 break;
2203 case FRR_ZAPI6_VRF_DELETE:
2204 case FRR_ZAPI6_VRF_LABEL:
2205 case FRR_ZAPI6_INTERFACE_VRF_UPDATE:
2206 break;
2207 case FRR_ZAPI6_BFD_CLIENT_REGISTER:
2208 proto_tree_add_item(tree, hf_zebra_pid, tvb, offset, 4,
2209 ENC_BIG_ENDIAN);
2210 offset += 4;
2211 break;
2212 case FRR_ZAPI6_BFD_CLIENT_DEREGISTER:
2213 case FRR_ZAPI6_INTERFACE_ENABLE_RADV:
2214 case FRR_ZAPI6_INTERFACE_DISABLE_RADV:
2215 case FRR_ZAPI6_IPV4_NEXTHOP_LOOKUP_MRIB:
2216 case FRR_ZAPI6_INTERFACE_LINK_PARAMS:
2217 case FRR_ZAPI6_MPLS_LABELS_ADD:
2218 case FRR_ZAPI6_MPLS_LABELS_DELETE:
2219 case FRR_ZAPI6_IPMR_ROUTE_STATS:
2220 break;
2221 case FRR_ZAPI6_LABEL_MANAGER_CONNECT:
2222 case FRR_ZAPI6_LABEL_MANAGER_CONNECT_ASYNC:
2223 offset = zebra_label_manager_connect(tree, tvb, offset);
2224 break;
2225 case FRR_ZAPI6_GET_LABEL_CHUNK:
2226 offset =
2227 zebra_get_label_chunk(tree, request, tvb, offset);
2228 break;
2229 case FRR_ZAPI6_RELEASE_LABEL_CHUNK:
2230 case FRR_ZAPI6_FEC_REGISTER:
2231 case FRR_ZAPI6_FEC_UNREGISTER:
2232 case FRR_ZAPI6_FEC_UPDATE:
2233 case FRR_ZAPI6_ADVERTISE_DEFAULT_GW:
2234 case FRR_ZAPI6_ADVERTISE_SUBNET:
2235 case FRR_ZAPI6_ADVERTISE_ALL_VNI:
2236 case FRR_ZAPI6_LOCAL_ES_ADD:
2237 case FRR_ZAPI6_LOCAL_ES_DEL:
2238 case FRR_ZAPI6_VNI_ADD:
2239 case FRR_ZAPI6_VNI_DEL:
2240 case FRR_ZAPI6_L3VNI_ADD:
2241 case FRR_ZAPI6_L3VNI_DEL:
2242 case FRR_ZAPI6_REMOTE_VTEP_ADD:
2243 case FRR_ZAPI6_REMOTE_VTEP_DEL:
2244 case FRR_ZAPI6_MACIP_ADD:
2245 case FRR_ZAPI6_MACIP_DEL:
2246 case FRR_ZAPI6_IP_PREFIX_ROUTE_ADD:
2247 case FRR_ZAPI6_IP_PREFIX_ROUTE_DEL:
2248 case FRR_ZAPI6_REMOTE_MACIP_ADD:
2249 case FRR_ZAPI6_REMOTE_MACIP_DEL:
2250 case FRR_ZAPI6_PW_ADD:
2251 case FRR_ZAPI6_PW_DELETE:
2252 case FRR_ZAPI6_PW_SET:
2253 case FRR_ZAPI6_PW_UNSET:
2254 case FRR_ZAPI6_PW_STATUS_UPDATE:
2255 case FRR_ZAPI6_RULE_ADD:
2256 case FRR_ZAPI6_RULE_DELETE:
2257 case FRR_ZAPI6_RULE_NOTIFY_OWNER:
2258 case FRR_ZAPI6_TABLE_MANAGER_CONNECT:
2259 case FRR_ZAPI6_GET_TABLE_CHUNK:
2260 case FRR_ZAPI6_RELEASE_TABLE_CHUNK:
2261 case FRR_ZAPI6_IPSET_CREATE:
2262 case FRR_ZAPI6_IPSET_DESTROY:
2263 case FRR_ZAPI6_IPSET_ENTRY_ADD:
2264 case FRR_ZAPI6_IPSET_ENTRY_DELETE:
2265 case FRR_ZAPI6_IPSET_NOTIFY_OWNER:
2266 case FRR_ZAPI6_IPSET_ENTRY_NOTIFY_OWNER:
2267 case FRR_ZAPI6_IPTABLE_ADD:
2268 case FRR_ZAPI6_IPTABLE_DELETE:
2269 case FRR_ZAPI6_IPTABLE_NOTIFY_OWNER:
2270 case FRR_ZAPI6_VXLAN_FLOOD_CONTROL:
2271 break;
2274 return offset;
2278 Zebra Protocol header version 0:
2279 0 1 2 3
2280 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
2281 +-------------------------------+---------------+
2282 | Length (2) | Command (1) |
2283 +-------------------------------+---------------+
2285 Zebra Protocol header version 1, 2:
2286 0 1 2 3
2287 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
2288 +-------------------------------+---------------+-------------+
2289 | Length (2) | Marker (1) | Version (1) |
2290 +-------------------------------+---------------+-------------+
2291 | Command (2) |
2292 +-------------------------------+
2294 Version 3, 4:
2296 0 1 2 3
2297 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
2298 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2299 | Length | Marker | Version |
2300 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2301 | VRF ID | Command |
2302 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2304 Version 5, 6:
2306 0 1 2 3
2307 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
2308 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2309 | Length | Marker | Version |
2310 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2311 | VRF ID |
2312 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2313 | Command |
2314 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2316 The Marker byte in later versions uses reserved command values 0xFF (version
2317 1-3, Quagga) or 0xFE (version 4-6, FRR) to distinguish later protocol versions
2318 from version 0.
2321 static bool
2322 zebra_get_header(tvbuff_t *tvb, int offset, zebra_header_t *header)
2324 uint16_t len, command;
2325 uint8_t version;
2327 if (tvb_captured_length_remaining(tvb, offset) < 3) {
2328 return false;
2331 len = tvb_get_ntohs(tvb, offset);
2332 if (len < 3) {
2333 return false;
2336 offset += 2;
2337 command = tvb_get_uint8(tvb, offset);
2338 if (command < 0xFE) { // version 0
2339 version = 0;
2340 } else { // not version 0
2341 offset++;
2342 if (tvb_captured_length_remaining(tvb, offset) < 3) {
2343 return false;
2345 version = tvb_get_uint8(tvb, offset);
2346 if (version == 1 || version == 2) {
2347 offset++;
2348 } else if (version == 3 || version == 4) {
2349 offset += 3;
2350 } else if (version < 9) {
2351 /* The current highest version is 6. Give room
2352 * to invent a few more. */
2353 offset += 5;
2354 } else {
2355 return false;
2357 if (tvb_captured_length_remaining(tvb, offset) < 2) {
2358 return false;
2360 command = tvb_get_ntohs(tvb, offset);
2362 if (header) {
2363 header->len = len;
2364 header->command = command;
2365 header->version = version;
2367 return true;
2370 static bool
2371 test_zebra(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
2373 zebra_header_t header;
2375 if (!zebra_get_header(tvb, offset, &header)) {
2376 return false;
2379 if (header.len > 1024) {
2380 /* There can be multiple PDUs in a segment, but PDUs themselves
2381 * are small. Even 1024 is a generous overestimate.
2383 return false;
2386 if (header.version < 4) {
2387 if (!try_val_to_str(header.command, messages)) {
2388 return false;
2390 } else if (header.version == 4) {
2391 if (!try_val_to_str(header.command, frr_zapi4_messages)) {
2392 return false;
2394 } else if (header.version == 5) {
2395 if (!try_val_to_str(header.command, frr_zapi5_messages)) {
2396 return false;
2398 } else {
2399 if (!try_val_to_str(header.command, frr_zapi6_messages)) {
2400 return false;
2404 return true;
2407 static int
2408 dissect_zebra(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2410 proto_item *ti;
2411 proto_tree *zebra_tree;
2412 bool request;
2413 int left, offset = 0;
2415 if (!test_zebra(pinfo, tvb, offset, data)) {
2416 return 0;
2419 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZEBRA");
2421 request = (pinfo->destport == pinfo->match_uint);
2422 left = tvb_reported_length(tvb);
2424 col_set_str(pinfo->cinfo, COL_INFO,
2425 request? "Zebra Request" : "Zebra Reply");
2427 /* if (tree) */ {
2428 ti = proto_tree_add_item(tree, proto_zebra, tvb, offset, -1,
2429 ENC_NA);
2430 zebra_tree = proto_item_add_subtree(ti, ett_zebra);
2431 ti = proto_tree_add_boolean(zebra_tree, hf_zebra_request,
2432 tvb, offset, 0, request);
2433 proto_item_set_hidden(ti);
2435 for (;;) {
2436 zebra_header_t header;
2437 proto_tree *zebra_request_tree;
2439 if (!zebra_get_header(tvb, offset, &header)) {
2440 break;
2443 if (header.version < 4) {
2444 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
2445 val_to_str(header.command, messages,
2446 "Command Type 0x%02d"));
2447 ti = proto_tree_add_uint(zebra_tree, hf_zebra_command,
2448 tvb, offset, header.len,
2449 header.command);
2450 } else if (header.version == 4) {
2451 ti = proto_tree_add_uint(zebra_tree, hf_zebra_command_v4,
2452 tvb, offset, header.len,
2453 header.command);
2454 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
2455 val_to_str(header.command, frr_zapi4_messages,
2456 "Command Type 0x%02d"));
2457 } else if (header.version == 5) {
2458 ti = proto_tree_add_uint(zebra_tree, hf_zebra_command_v5,
2459 tvb, offset, header.len,
2460 header.command);
2461 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
2462 val_to_str(header.command, frr_zapi5_messages,
2463 "Command Type 0x%02d"));
2464 } else {
2465 ti = proto_tree_add_uint(zebra_tree, hf_zebra_command_v6,
2466 tvb, offset, header.len,
2467 header.command);
2468 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
2469 val_to_str(header.command, frr_zapi6_messages,
2470 "Command Type 0x%02d"));
2472 zebra_request_tree = proto_item_add_subtree(ti,
2473 ett_zebra_request);
2474 dissect_zebra_request(zebra_request_tree, request, tvb,
2475 offset, left, header.len,
2476 header.command, header.version);
2477 offset += header.len;
2478 left -= header.len;
2482 return tvb_captured_length(tvb);
2485 void
2486 proto_register_zebra(void)
2489 static hf_register_info hf[] = {
2490 { &hf_zebra_len,
2491 { "Length", "zebra.len",
2492 FT_UINT16, BASE_DEC, NULL, 0x0,
2493 "Length of Zebra request", HFILL }},
2494 { &hf_zebra_version,
2495 { "Version", "zebra.version",
2496 FT_UINT8, BASE_DEC, NULL, 0x0,
2497 "Zebra srv version", HFILL }},
2498 { &hf_zebra_marker,
2499 { "Marker", "zebra.marker",
2500 FT_UINT8, BASE_HEX, NULL, 0x0,
2501 "Zebra srv marker", HFILL }},
2502 { &hf_zebra_request,
2503 { "Request", "zebra.request",
2504 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
2505 "true if Zebra request", HFILL }},
2506 { &hf_zebra_command,
2507 { "Command", "zebra.command",
2508 FT_UINT16, BASE_DEC, VALS(messages), 0x0,
2509 "Zebra command", HFILL }},
2510 { &hf_zebra_interface,
2511 { "Interface", "zebra.interface",
2512 FT_STRING, BASE_NONE, NULL, 0x0,
2513 "Interface name of Zebra request", HFILL }},
2514 { &hf_zebra_index,
2515 { "Index", "zebra.index",
2516 FT_UINT32, BASE_DEC, NULL, 0x0,
2517 "Index of interface", HFILL }},
2518 { &hf_zebra_intstatus,
2519 { "Status", "zebra.intstatus",
2520 FT_UINT8, BASE_DEC, NULL, 0x0,
2521 "Status of interface", HFILL}},
2522 { &hf_zebra_indexnum,
2523 { "Index Number", "zebra.indexnum",
2524 FT_UINT8, BASE_DEC, NULL, 0x0,
2525 "Number of indices for route", HFILL }},
2526 { &hf_zebra_intflags,
2527 { "Flags", "zebra.intflags",
2528 FT_UINT64, BASE_DEC, NULL, 0x0,
2529 "Flags of interface", HFILL }},
2530 { &hf_zebra_rtflags,
2531 { "Flags", "zebra.rtflags",
2532 FT_UINT8, BASE_DEC, NULL, 0x0,
2533 "Flags of route", HFILL }},
2534 { &hf_zebra_message,
2535 { "Message", "zebra.message",
2536 FT_UINT8, BASE_DEC, NULL, 0x0,
2537 "Message type of route", HFILL }},
2538 { &hf_zebra_route_safi,
2539 { "SAFI", "zebra.safi",
2540 FT_UINT16, BASE_DEC, VALS(safi), 0x0,
2541 "Subsequent Address Family Identifier", HFILL }},
2542 { &hf_zebra_msg_nexthop,
2543 { "Message Nexthop", "zebra.message.nexthop",
2544 FT_BOOLEAN, 8, NULL, ZEBRA_ZAPI_MESSAGE_NEXTHOP,
2545 "Message contains nexthop", HFILL }},
2546 { &hf_zebra_msg_index,
2547 { "Message Index", "zebra.message.index",
2548 FT_BOOLEAN, 8, NULL, ZEBRA_ZAPI_MESSAGE_IFINDEX,
2549 "Message contains index", HFILL }},
2550 { &hf_zebra_msg_distance,
2551 { "Message Distance", "zebra.message.distance",
2552 FT_BOOLEAN, 8, NULL, ZEBRA_ZAPI_MESSAGE_DISTANCE,
2553 "Message contains distance", HFILL }},
2554 { &hf_zebra_msg_metric,
2555 { "Message Metric", "zebra.message.metric",
2556 FT_BOOLEAN, 8, NULL, ZEBRA_ZAPI_MESSAGE_METRIC,
2557 "Message contains metric", HFILL }},
2558 { &hf_zebra_type_v0,
2559 { "Type", "zebra.type",
2560 FT_UINT8, BASE_DEC, VALS(routes_v0), 0x0,
2561 "Type of route", HFILL }},
2562 { &hf_zebra_type_v1,
2563 { "Type", "zebra.type",
2564 FT_UINT8, BASE_DEC, VALS(routes_v1), 0x0,
2565 "Type of route", HFILL }},
2566 { &hf_zebra_distance,
2567 { "Distance", "zebra.distance",
2568 FT_UINT8, BASE_DEC, NULL, 0x0,
2569 "Distance of route", HFILL }},
2570 { &hf_zebra_metric,
2571 { "Metric", "zebra.metric",
2572 FT_UINT32, BASE_DEC, NULL, 0x0,
2573 "Metric of interface or route", HFILL }},
2574 { &hf_zebra_mtu,
2575 { "MTU", "zebra.mtu",
2576 FT_UINT32, BASE_DEC, NULL, 0x0,
2577 "MTU of interface", HFILL }},
2578 { &hf_zebra_mtu6,
2579 { "MTUv6", "zebra.mtu6",
2580 FT_UINT32, BASE_DEC, NULL, 0x0,
2581 "MTUv6 of interface", HFILL }},
2582 { &hf_zebra_bandwidth,
2583 { "Bandwidth", "zebra.bandwidth",
2584 FT_UINT32, BASE_DEC, NULL, 0x0,
2585 "Bandwidth of interface", HFILL }},
2586 { &hf_zebra_family,
2587 { "Family", "zebra.family",
2588 FT_UINT16, BASE_DEC, VALS(families), 0x0,
2589 "Family of IP address", HFILL }},
2590 { &hf_zebra_flags,
2591 { "Flags", "zebra.flags",
2592 FT_UINT8, BASE_DEC, NULL, 0x0,
2593 "Flags of Address Info", HFILL }},
2594 { &hf_zebra_dest4,
2595 { "Destination", "zebra.dest4",
2596 FT_IPv4, BASE_NONE, NULL, 0x0,
2597 "Destination IPv4 field", HFILL }},
2598 { &hf_zebra_dest6,
2599 { "Destination", "zebra.dest6",
2600 FT_IPv6, BASE_NONE, NULL, 0x0,
2601 "Destination IPv6 field", HFILL }},
2602 { &hf_zebra_nexthopnum,
2603 { "Nexthop Number", "zebra.nexthopnum",
2604 FT_UINT8, BASE_DEC, NULL, 0x0,
2605 "Number of nexthops in route", HFILL }},
2606 { &hf_zebra_nexthop4,
2607 { "Nexthop", "zebra.nexthop4",
2608 FT_IPv4, BASE_NONE, NULL, 0x0,
2609 "Nethop IPv4 field of route", HFILL }},
2610 { &hf_zebra_nexthop6,
2611 { "Nexthop", "zebra.nexthop6",
2612 FT_IPv6, BASE_NONE, NULL, 0x0,
2613 "Nethop IPv6 field of route", HFILL }},
2614 { &hf_zebra_prefixlen,
2615 { "Prefix length", "zebra.prefixlen",
2616 FT_UINT32, BASE_DEC, NULL, 0x0,
2617 NULL, HFILL }},
2618 { &hf_zebra_prefix4,
2619 { "Prefix", "zebra.prefix4",
2620 FT_IPv4, BASE_NONE, NULL, 0x0,
2621 "Prefix IPv4", HFILL }},
2622 { &hf_zebra_prefix6,
2623 { "Prefix", "zebra.prefix6",
2624 FT_IPv6, BASE_NONE, NULL, 0x0,
2625 "Prefix IPv6", HFILL }},
2626 { &hf_zebra_routeridaddress,
2627 { "Router ID address", "zebra.routerIDAddress",
2628 FT_IPv4, BASE_NONE, NULL, 0x0,
2629 NULL, HFILL }},
2630 { &hf_zebra_routeridmask,
2631 { "Router ID mask", "zebra.routerIDMask",
2632 FT_UINT8, BASE_DEC, NULL, 0x0,
2633 "netmask of Router ID", HFILL }},
2634 { &hf_zebra_mac,
2635 { "MAC address", "zebra.macaddress",
2636 FT_ETHER, BASE_NONE, NULL, 0x0,
2637 "MAC address of interface", HFILL }},
2638 { &hf_zebra_redist_default,
2639 { "Redistribute default", "zebra.redist_default",
2640 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
2641 "true if redistribute default", HFILL }},
2642 { &hf_zebra_vrfid,
2643 { "VRF-ID", "zebra.vrfid",
2644 FT_UINT32, BASE_HEX, NULL, 0x0,
2645 "VRF ID", HFILL }},
2646 { &hf_zebra_routeridfamily,
2647 { "Router ID Family", "zebra.routeridfamily",
2648 FT_UINT8, BASE_DEC, VALS(families), 0x0,
2649 "Family of Router ID", HFILL }},
2650 { &hf_zebra_nexthoptype,
2651 { "Nexthop Type", "zebra.nexthoptype",
2652 FT_UINT8, BASE_DEC, VALS(zebra_nht), 0x0,
2653 "Type of Nexthop", HFILL }},
2654 { &hf_zebra_msg_mtu,
2655 { "Message MTU", "zebra.message.mtu",
2656 FT_BOOLEAN, 8, NULL, ZEBRA_ZAPI_MESSAGE_MTU,
2657 "Message contains MTU", HFILL }},
2658 { &hf_zebra_msg_tag,
2659 { "Message TAG", "zebra.message.tag",
2660 FT_BOOLEAN, 8, NULL, ZEBRA_ZAPI_MESSAGE_TAG,
2661 "Message contains TAG", HFILL }},
2662 { &hf_zebra_tag,
2663 { "Tag", "zebra.tag",
2664 FT_UINT32, BASE_DEC, NULL, 0x0,
2665 "Route Tag", HFILL }},
2666 { &hf_zebra_maclen,
2667 { "MAC address length", "zebra.maclen",
2668 FT_UINT32, BASE_DEC, NULL, 0x0,
2669 "Length of MAC address of interface", HFILL }},
2670 { &hf_zebra_haslinkparam,
2671 { "Message has link parameters", "zebra.haslinkparam",
2672 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
2673 "Interface message has link parameters", HFILL }},
2674 /* FRRouting, Zebra API v4, v5 and v6 */
2675 { &hf_zebra_command_v4,
2676 { "Command", "zebra.command",
2677 FT_UINT16, BASE_DEC, VALS(frr_zapi4_messages), 0x0,
2678 "Zebra command", HFILL }},
2679 { &hf_zebra_command_v5,
2680 { "Command", "zebra.command",
2681 FT_UINT16, BASE_DEC, VALS(frr_zapi5_messages), 0x0,
2682 "Zebra command", HFILL }},
2683 { &hf_zebra_command_v6,
2684 { "Command", "zebra.command",
2685 FT_UINT16, BASE_DEC, VALS(frr_zapi6_messages), 0x0,
2686 "Zebra command", HFILL }},
2687 { &hf_zebra_type_v4,
2688 { "Type", "zebra.type",
2689 FT_UINT8, BASE_DEC, VALS(routes_v4), 0x0,
2690 "Type of route", HFILL }},
2691 { &hf_zebra_type_v5,
2692 { "Type", "zebra.type",
2693 FT_UINT8, BASE_DEC, VALS(routes_v5), 0x0,
2694 "Type of route", HFILL }},
2695 { &hf_zebra_ptmenable,
2696 { "PTM Enable", "zebra.ptmenable",
2697 FT_UINT8, BASE_DEC, NULL, 0x0,
2698 "PTM (Prescriptive Topology Manager) Enable", HFILL }},
2699 { &hf_zebra_ptmstatus,
2700 { "PTM Status", "zebra.ptmstatus",
2701 FT_UINT8, BASE_DEC, NULL, 0x0,
2702 "PTM (Prescriptive Topology Manager) Status", HFILL }},
2703 { &hf_zebra_instance,
2704 { "Instance", "zebra.instance",
2705 FT_UINT16, BASE_DEC, NULL, 0x0,
2706 "Routing Instance", HFILL }},
2707 { &hf_zebra_rtflags_u32,
2708 { "Flags", "zebra.rtflags",
2709 FT_UINT32, BASE_DEC, NULL, 0x0,
2710 "Flags of route", HFILL }},
2711 { &hf_zebra_speed,
2712 { "Speed", "zebra.speed",
2713 FT_UINT32, BASE_DEC, NULL, 0x0,
2714 "Speed of interface", HFILL }},
2715 { &hf_zebra_lltype,
2716 { "LLType", "zebra.lltype",
2717 FT_UINT32, BASE_DEC, NULL, 0x0,
2718 "Link Layer Type", HFILL }},
2719 { &hf_zebra_message4,
2720 { "Message", "zebra.message",
2721 FT_UINT8, BASE_DEC, NULL, 0x0,
2722 "Message type of route", HFILL }},
2723 { &hf_zebra_message5,
2724 { "Message", "zebra.message",
2725 FT_UINT8, BASE_DEC, NULL, 0x0,
2726 "Message type of route", HFILL }},
2727 { &hf_zebra_route_safi_u8,
2728 { "SAFI", "zebra.safi",
2729 FT_UINT8, BASE_DEC, VALS(safi), 0x0,
2730 "Subsequent Address Family Identifier", HFILL }},
2731 { &hf_zebra_rmac,
2732 { "RMAC", "zebra.rmac",
2733 FT_ETHER, BASE_NONE, NULL, 0x0,
2734 "Remote MAC", HFILL }},
2735 { &hf_zebra_msg4_tag,
2736 { "Message TAG", "zebra.message.tag",
2737 FT_BOOLEAN, 8, NULL, FRR_ZAPI4_MESSAGE_TAG,
2738 "Message contains TAG", HFILL }},
2739 { &hf_zebra_msg4_mtu,
2740 { "Message MTU", "zebra.message.mtu",
2741 FT_BOOLEAN, 8, NULL, FRR_ZAPI4_MESSAGE_MTU,
2742 "Message contains MTU", HFILL }},
2743 { &hf_zebra_msg4_srcpfx,
2744 { "Message Source Prefix", "zebra.message.srcpfx",
2745 FT_BOOLEAN, 8, NULL, FRR_ZAPI4_MESSAGE_SRCPFX,
2746 "Message contains Source Prefix",
2747 HFILL }},
2748 { &hf_zebra_msg5_distance,
2749 { "Message Distance", "zebra.message.distance",
2750 FT_BOOLEAN, 8, NULL, FRR_ZAPI5_MESSAGE_DISTANCE,
2751 "Message contains distance", HFILL }},
2752 { &hf_zebra_msg5_metric,
2753 { "Message Metric", "zebra.message.metric",
2754 FT_BOOLEAN, 8, NULL, FRR_ZAPI5_MESSAGE_METRIC,
2755 "Message contains metric", HFILL }},
2756 { &hf_zebra_msg5_tag,
2757 { "Message TAG", "zebra.message.tag",
2758 FT_BOOLEAN, 8, NULL, FRR_ZAPI5_MESSAGE_TAG,
2759 "Message contains TAG", HFILL }},
2760 { &hf_zebra_msg5_mtu,
2761 { "Message MTU", "zebra.message.mtu",
2762 FT_BOOLEAN, 8, NULL, FRR_ZAPI5_MESSAGE_MTU,
2763 "Message contains MTU", HFILL }},
2764 { &hf_zebra_msg5_srcpfx,
2765 { "Message Source Prefix", "zebra.message.srcpfx",
2766 FT_BOOLEAN, 8, NULL, FRR_ZAPI5_MESSAGE_SRCPFX,
2767 "Message contains Source Prefix", HFILL }},
2768 { &hf_zebra_msg_label,
2769 { "Message Label", "zebra.message.label",
2770 FT_BOOLEAN, 8, NULL, FRR_ZAPI5_MESSAGE_LABEL,
2771 "Message contains Label", HFILL }},
2772 { &hf_zebra_msg_tableid,
2773 { "Message Table ID", "zebra.message.tableid",
2774 FT_BOOLEAN, 8, NULL, FRR_ZAPI5_MESSAGE_TABLEID,
2775 "Message contains Table ID", HFILL }},
2776 { &hf_zebra_nexthopnum_u16,
2777 { "Nexthop Number", "zebra.nexthopnum",
2778 FT_UINT16, BASE_DEC, NULL, 0x0,
2779 "Number of nexthops in route", HFILL }},
2780 { &hf_zebra_nexthoptype_frr,
2781 { "Nexthop Type", "zebra.nexthoptype",
2782 FT_UINT8, BASE_DEC, VALS(frr_nht), 0x0,
2783 "Type of Nexthop", HFILL }},
2784 { &hf_zebra_bhtype,
2785 { "BHType", "zebra.bhtype",
2786 FT_UINT8, BASE_DEC, VALS(blackhole_type), 0x0,
2787 "Blackhole Type", HFILL }},
2788 { &hf_zebra_srcprefixlen,
2789 { "Source Prefix length", "zebra.srcprefixlen",
2790 FT_UINT32, BASE_DEC,
2791 NULL, 0x0, NULL, HFILL }},
2792 { &hf_zebra_srcprefix4,
2793 { "Source Prefix", "zebra.srcprefix4",
2794 FT_IPv4, BASE_NONE, NULL, 0x0,
2795 "Source Prefix IPv4", HFILL }},
2796 { &hf_zebra_srcprefix6,
2797 { "Source Prefix", "zebra.srcprefix6",
2798 FT_IPv6, BASE_NONE, NULL, 0x0,
2799 "Source Prefix IPv6", HFILL }},
2800 { &hf_zebra_tableid,
2801 { "Table ID", "zebra.tableid",
2802 FT_UINT32, BASE_DEC, NULL, 0x0,
2803 "Routing Table ID", HFILL }},
2804 { &hf_zebra_afi,
2805 { "AFI", "zebra.afi",
2806 FT_UINT8, BASE_DEC, NULL, 0x0,
2807 "AFI (Address Family Identifiers)", HFILL }},
2808 { &hf_zebra_pid,
2809 { "PID", "zebra.pid",
2810 FT_UINT32, BASE_DEC, NULL, 0x0,
2811 "Process ID", HFILL }},
2812 { &hf_zebra_vrf_table_id,
2813 { "VRF Table ID", "zebra.vrftableid",
2814 FT_UINT32, BASE_DEC, NULL, 0x0,
2815 "VRF Routing Table ID", HFILL }},
2816 { &hf_zebra_vrf_netns_name,
2817 { "VRF NETNS Name", "zebra.vrfnetnsname",
2818 FT_STRING, BASE_NONE, NULL, 0x0,
2819 "VRF (Virtual Routing and Forwarding) Network Namespace Name",
2820 HFILL }},
2821 { &hf_zebra_vrf_name,
2822 { "VRF Name", "zebra.vrfname",
2823 FT_STRING, BASE_NONE, NULL, 0x0,
2824 "VRF (Virtual Routing and Forwarding) Name", HFILL }},
2825 { &hf_zebra_proto,
2826 { "Protocol", "zebra.proto",
2827 FT_UINT8, BASE_DEC, NULL, 0x0,
2828 "Protocol of client", HFILL }},
2829 { &hf_zebra_label_chunk_keep,
2830 { "Label Chunk Keep", "zebra.label_chunk_keep",
2831 FT_UINT8, BASE_DEC, NULL, 0x0,
2832 "Keep of Label Chunk", HFILL }},
2833 { &hf_zebra_label_chunk_size,
2834 { "Label Chunk Size", "zebra.label_chunk_size",
2835 FT_UINT32, BASE_DEC, NULL, 0x0,
2836 "Size of Label Chunk", HFILL }},
2837 { &hf_zebra_label_chunk_start,
2838 { "Label Chunk Start","zebra.label_chunk_start",
2839 FT_UINT32, BASE_DEC, NULL, 0x0,
2840 "Start of Label Chunk", HFILL }},
2841 { &hf_zebra_label_chunk_end,
2842 { "Label Chunk End", "zebra.label_chunk_end",
2843 FT_UINT32, BASE_DEC, NULL, 0x0,
2844 "End of Label Chunk", HFILL }},
2845 { &hf_zebra_mpls_enabled,
2846 { "MPLS Enabled", "zebra.mpls_enabled",
2847 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
2848 "MPLS enabled capability", HFILL }},
2849 { &hf_zebra_multipath_num,
2850 { "Multipath Number", "zebra.multipath_num",
2851 FT_UINT32, BASE_DEC, NULL, 0x0,
2852 "Number of Multipath", HFILL }},
2853 { &hf_zebra_labelnum,
2854 { "Label Number", "zebra.labelnum",
2855 FT_UINT8, BASE_DEC, NULL, 0x0,
2856 "Number of Labels", HFILL }},
2857 { &hf_zebra_label,
2858 { "Label", "zebra.label",
2859 FT_UINT32, BASE_DEC, NULL, 0x0,
2860 "MPLS Label", HFILL }},
2861 { &hf_zebra_receive_notify,
2862 { "Receive Notify", "zebra.receive_notify",
2863 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
2864 "true if receive notify", HFILL }}
2867 static int *ett[] = {
2868 &ett_zebra,
2869 &ett_zebra_request,
2870 &ett_message,
2873 proto_zebra = proto_register_protocol("Zebra Protocol", "ZEBRA", "zebra");
2874 proto_register_field_array(proto_zebra, hf, array_length(hf));
2875 proto_register_subtree_array(ett, array_length(ett));
2876 zebra_handle = register_dissector("zebra", dissect_zebra, proto_zebra);
2879 void
2880 proto_reg_handoff_zebra(void)
2882 dissector_add_uint_with_preference("tcp.port", TCP_PORT_ZEBRA, zebra_handle);
2886 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2888 * Local variables:
2889 * c-basic-offset: 8
2890 * tab-width: 8
2891 * indent-tabs-mode: t
2892 * End:
2894 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
2895 * :indentSize=8:tabSize=8:noTabs=false: