Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-extreme.c
blobaa46abbdde697f7101b8d6dc38bc8c364feb8bec
1 /* packet-extreme.c
2 * Routines for the disassembly of Extreme Networks specific
3 * protocols (EDP/ESRP/EAPS(including ESL)/ELSM)
5 * Copyright 2005 Joerg Mayer (see AUTHORS file)
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
15 TODO:
16 - General
17 EAPS v2 is not supported (no spec)
18 Some stuff in the EDP Info field (no spec)
19 - Things seen in traces
20 Flags in the EDP Vlan field (value 0x01)
21 - TLV type 0x0e (ESL) shared link managemnt
22 TLV type 0x15 (XOS only?) Link bit details (eth autoneg)
23 EAPS type 0x10 (ESL?)
24 ESRP state 0x03
26 Specs:
28 EAPS v1 is specified in RFC3619
30 The following information is taken from the Extreme knowledge base
31 (login required). Search for ESRP.
32 Note: The information seems to be incorrect in at least one place
33 (position of edp.vlan.id).
35 ================================ snip ================================
37 ESRP Packet Format:
38 -------------------
40 0 1
41 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F
42 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 0000
43 | SOURCE MAC ADDRESS |
44 +-------------------------------+-------------------------------+ 0004
45 | SOURCE MAC ADDRESS (CONT) | DEST MAC ADDRESS |
46 +-------------------------------+-------------------------------+ 0008
47 | DEST MAC ADDRESS (CONT) |
48 +-------------------------------+---------------+---------------+ 000C
49 | LENGTH | DSAP = AA | SSAP = AA |
50 +---------------+---------------+---------------+---------------+ 0010
51 | LLC TYPE = UI | UID = 00E02B |
52 +---------------+---------------+---------------+---------------+ 0014
53 | SNAP TYPE = 00BB | EDP VERSION | RESERVED |
54 +-------------------------------+---------------+---------------+ 0018
55 | LENGTH | CHECKSUM |
56 +-------------------------------+-------------------------------+ 001C
57 | SEQUENCE NUMBER | MACHINE ID |
58 +-------------------------------+-------------------------------+ 0020
59 | MACHINE ID (CONT.) |
60 +-------------------------------+---------------+---------------+ 0024
61 | MACHINE ID (CONT.) | MARKER=99(EDP)| TYPE=08 (ESRP)|
62 +-------------------------------+---------------+---------------+ 0028
63 | LENGTH = 001C |0=IP 1=IPX 2=L2| GROUP = 0 |
64 +-------------------------------+-------------------------------+ 002C
65 | PRIORITY | STATE: 0=?? 1=MSTR 2=SLAVE |
66 +-------------------------------+-------------------------------+ 0030
67 | NUMBER OF ACTIVE PORTS | VIRTUAL IP ADDRESS |
68 +-------------------------------+-------------------------------+ 0034
69 | VIRTUAL IP ADDRESS (CONT) | SYSTEM MAC ADDRESS |
70 +-------------------------------+-------------------------------+ 0038
71 | SYSTEM MAC ADDRESS (CONT.) |
72 +-------------------------------+-------------------------------+ 003C
73 | HELLO TIMER | RESERVED |
74 +-------------------------------+-------------------------------+ 0040
77 ******************************************************************************
80 EDP is a SNAP encapsulated frame. The top level looks like this:
81 The top level format is like this:
82 [ SNAP header ] [ EDP header] [ TLV 0 ] [ TLV 1 ] ... [ TLV N ]
84 Header format:
85 1 octet: EDP version
86 1 octet: reserved
87 2 octets: length
88 2 octets: checksum
89 2 octets: sequence #
90 8 octets: device id (currently 2 0 octets followed by system mac address)
92 TLV stands for Type, Length, Value.
93 Format of a TLV entry:
94 marker ( 1 octet): Hex 99
95 type ( 1 octet):
96 The following types are used:
97 Null (used as an end signal): 0
98 Display (Mib II display string): 1
99 Info (Basic system information): 2
100 Vlan Info : 5
101 ESRP : 8
102 Length: Length of subsequent data(2 octets)
103 Value: Length octets of data.
105 Format for Info TLV:
106 two octets: originating slot #
107 two octets: originating port #
108 two octets: Virtual Chassis Id (If originating port is connected to a virtual chassis).
109 six octets: reserved
110 four octets: software version
111 16 octets: Virtual Chassis Id connections
113 Format for Vlan info:
114 octet 0: Flags (bit 8 = 1 means this vlan has an IP interface)
115 octets 1,2,3: reserved.
116 octets 4,5: vlan Id (0 if untagged)
117 octets 6,7: reserved.
118 octets 8 - 11: Vlan IP address.
119 Rest of value: VLAN name.
121 Display string is merely length octets of the MIBII display string.
123 These are the structures you will see most often in EDP frames.
125 ================================ snap ================================
129 #include "config.h"
131 #include <epan/packet.h>
132 #include <epan/expert.h>
133 #include <epan/to_str.h>
134 #include <epan/strutil.h>
135 #include <epan/in_cksum.h>
136 #include <epan/tfs.h>
137 #include "packet-llc.h"
138 #include <epan/oui.h>
140 void proto_register_edp(void);
141 void proto_reg_handoff_edp(void);
143 static int hf_llc_extreme_pid;
145 static dissector_handle_t edp_handle;
147 static int proto_edp;
148 /* EDP header */
149 static int hf_edp_version;
150 static int hf_edp_reserved;
151 static int hf_edp_length;
152 static int hf_edp_checksum;
153 static int hf_edp_checksum_status;
155 static int hf_edp_seqno;
156 static int hf_edp_midtype;
157 static int hf_edp_midmac;
158 /* TLV header */
159 static int hf_edp_tlv_marker;
160 static int hf_edp_tlv_type;
161 static int hf_edp_tlv_length;
162 /* Display string */
163 static int hf_edp_display;
164 static int hf_edp_display_string;
165 /* Info element */
166 static int hf_edp_info;
167 static int hf_edp_info_slot;
168 static int hf_edp_info_port;
169 static int hf_edp_info_vchassid;
170 static int hf_edp_info_reserved;
171 static int hf_edp_info_version;
172 static int hf_edp_info_version_major1;
173 static int hf_edp_info_version_major2;
174 static int hf_edp_info_version_sustaining;
175 static int hf_edp_info_version_internal;
176 static int hf_edp_info_vchassconn;
177 /* Vlan element */
178 static int hf_edp_vlan;
179 static int hf_edp_vlan_flags;
180 static int hf_edp_vlan_flags_ip;
181 static int hf_edp_vlan_flags_reserved;
182 static int hf_edp_vlan_flags_unknown;
183 static int hf_edp_vlan_reserved1;
184 static int hf_edp_vlan_id;
185 static int hf_edp_vlan_reserved2;
186 static int hf_edp_vlan_ip;
187 static int hf_edp_vlan_name;
188 /* ESRP element */
189 static int hf_edp_esrp;
190 static int hf_edp_esrp_proto;
191 static int hf_edp_esrp_group;
192 static int hf_edp_esrp_prio;
193 static int hf_edp_esrp_state;
194 static int hf_edp_esrp_ports;
195 static int hf_edp_esrp_virtip;
196 static int hf_edp_esrp_sysmac;
197 static int hf_edp_esrp_hello;
198 static int hf_edp_esrp_reserved;
199 /* EAPS element */
200 static int hf_edp_eaps;
201 static int hf_edp_eaps_ver;
202 static int hf_edp_eaps_type;
203 static int hf_edp_eaps_ctrlvlanid;
204 static int hf_edp_eaps_reserved0;
205 static int hf_edp_eaps_sysmac;
206 static int hf_edp_eaps_hello;
207 static int hf_edp_eaps_fail;
208 static int hf_edp_eaps_state;
209 static int hf_edp_eaps_reserved1;
210 static int hf_edp_eaps_helloseq;
211 static int hf_edp_eaps_reserved2;
212 /* ESL element */
213 static int hf_edp_esl;
214 static int hf_edp_esl_ver;
215 static int hf_edp_esl_type;
216 static int hf_edp_esl_ctrlvlanid;
217 static int hf_edp_esl_reserved0;
218 static int hf_edp_esl_sysmac;
219 static int hf_edp_esl_reserved1;
220 static int hf_edp_esl_state;
221 static int hf_edp_esl_linkrole;
222 static int hf_edp_esl_linkid1;
223 static int hf_edp_esl_failed1;
224 static int hf_edp_esl_failed2;
225 static int hf_edp_esl_reserved4;
226 static int hf_edp_esl_linkid2;
227 static int hf_edp_esl_reserved5;
228 static int hf_edp_esl_numlinks;
229 static int hf_edp_esl_linklist;
230 static int hf_edp_esl_rest;
231 /* ELSM (Extreme Link Status Monitoring) */
232 static int hf_edp_elsm;
233 static int hf_edp_elsm_type;
234 static int hf_edp_elsm_subtype;
235 static int hf_edp_elsm_magic;
236 /* ELRP (Extreme Loop Recognition Protocol)*/
237 static int hf_edp_elrp;
238 static int hf_edp_elrp_unknown;
239 /* Link properties */
240 static int hf_edp_link;
241 static int hf_edp_link_flags;
242 static int hf_edp_link_flags_autoneg;
243 static int hf_edp_link_flags_flowcontrol;
244 static int hf_edp_link_flags_unknown;
245 static int hf_edp_link_conf;
246 static int hf_edp_link_actual;
247 static int hf_edp_link_zero;
248 static int hf_edp_link_unknown;
249 /* Unknown element */
250 static int hf_edp_unknown;
251 static int hf_edp_unknown_data;
252 /* Null element */
253 static int hf_edp_null;
255 static expert_field ei_edp_short_tlv;
256 static expert_field ei_edp_checksum;
258 static int ett_edp;
259 static int ett_edp_tlv_header;
260 static int ett_edp_display;
261 static int ett_edp_info;
262 static int ett_edp_info_version;
263 static int ett_edp_vlan;
264 static int ett_edp_vlan_flags;
265 static int ett_edp_esrp;
266 static int ett_edp_eaps;
267 static int ett_edp_esl;
268 static int ett_edp_elsm;
269 static int ett_edp_elrp;
270 static int ett_edp_link;
271 static int ett_edp_link_flags;
272 static int ett_edp_unknown;
273 static int ett_edp_null;
275 #define PROTO_SHORT_NAME "EDP"
276 #define PROTO_LONG_NAME "Extreme Discovery Protocol"
278 static const value_string extreme_pid_vals[] = {
279 { 0x00bb, "EDP" },
281 { 0, NULL }
284 static const value_string esrp_proto_vals[] = {
285 { 0, "IP" },
286 { 1, "IPX" },
287 { 2, "L2" },
289 { 0, NULL }
292 static const value_string esrp_state_vals[] = {
293 { 0, "??" },
294 { 1, "Master" },
295 { 2, "Slave" },
297 { 0, NULL }
300 typedef enum {
301 EDP_TYPE_NULL = 0x00,
302 EDP_TYPE_DISPLAY,
303 EDP_TYPE_INFO,
304 EDP_TYPE_VLAN = 0x05,
305 EDP_TYPE_ESRP = 0x08,
306 EDP_TYPE_EAPS = 0x0b,
307 EDP_TYPE_ELRP = 0x0d,
308 EDP_TYPE_ESL,
309 EDP_TYPE_ELSM,
310 EDP_TYPE_LINK = 0x15
311 } edp_type_t;
313 static const value_string edp_type_vals[] = {
314 { EDP_TYPE_NULL, "Null"},
315 { EDP_TYPE_DISPLAY, "Display"},
316 { EDP_TYPE_INFO, "Info"},
317 { EDP_TYPE_VLAN, "VL"},
318 { EDP_TYPE_ESRP, "ESRP"},
319 { EDP_TYPE_EAPS, "EAPS"},
320 { EDP_TYPE_ELRP, "ELRP"},
321 { EDP_TYPE_ESL, "ESL"},
322 { EDP_TYPE_ELSM, "ELSM"},
323 { EDP_TYPE_LINK, "Link"},
325 { 0, NULL }
328 static const value_string edp_midtype_vals[] = {
329 { 0, "MAC" },
331 { 0, NULL }
334 static const value_string eaps_type_vals[] = {
335 { 5, "Health" },
336 { 6, "Ring up flush fdb" },
337 { 7, "Ring down flush fdb" },
338 { 8, "Link down" },
340 { 0, NULL }
343 static const value_string eaps_state_vals[] = {
344 { 0, "Idle" },
345 { 1, "Complete" },
346 { 2, "Failed" },
347 { 3, "Links up" },
348 { 4, "Links down" },
349 { 5, "Pre Forwarding" },
351 { 0, NULL }
354 static const value_string esl_role_vals[] = {
355 { 1, "Controller" },
356 { 2, "Partner" },
358 { 0, NULL }
361 static const value_string esl_state_vals[] = {
362 { 1, "Ready" },
363 { 2, "Blocking" },
365 { 0, NULL }
368 static const value_string esl_type_vals[] = {
369 { 1, "Segment Health" },
371 { 0, NULL }
374 static const value_string elsm_type_vals[] = {
375 { 0x01, "Hello" },
377 { 0, NULL }
380 static const value_string elsm_subtype_vals[] = {
381 { 0x00, "-" },
382 { 0x01, "+" },
384 { 0, NULL }
387 static const value_string link_speed_vals[] = {
388 { 0x00, "Autoneg" },
389 { 0x01, "10M" },
390 { 0x02, "100M" },
391 { 0x03, "1G" },
393 { 0, NULL }
396 static int
397 dissect_tlv_header(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, int length _U_, proto_tree *tree)
399 proto_tree *tlv_tree;
400 uint8_t tlv_marker;
401 uint8_t tlv_type;
402 uint16_t tlv_length;
404 tlv_marker = tvb_get_uint8(tvb, offset);
405 tlv_type = tvb_get_uint8(tvb, offset + 1);
406 tlv_length = tvb_get_ntohs(tvb, offset + 2);
408 tlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4,
409 ett_edp_tlv_header, NULL, "Marker 0x%02x, length %d, type %d = %s",
410 tlv_marker, tlv_length, tlv_type,
411 val_to_str(tlv_type, edp_type_vals, "Unknown (0x%02x)"));
413 proto_tree_add_item(tlv_tree, hf_edp_tlv_marker, tvb, offset, 1,
414 ENC_BIG_ENDIAN);
415 offset += 1;
417 proto_tree_add_uint(tlv_tree, hf_edp_tlv_type, tvb, offset, 1,
418 tlv_type);
419 offset += 1;
421 proto_tree_add_uint(tlv_tree, hf_edp_tlv_length, tvb, offset, 2,
422 tlv_length);
423 offset += 2;
425 return offset;
428 static void
429 dissect_display_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
431 proto_item *display_item;
432 proto_tree *display_tree;
433 const uint8_t *display_name;
435 display_item = proto_tree_add_item(tree, hf_edp_display,
436 tvb, offset, length, ENC_BIG_ENDIAN);
438 display_tree = proto_item_add_subtree(display_item, ett_edp_display);
440 dissect_tlv_header(tvb, pinfo, offset, 4, display_tree);
441 offset += 4;
442 length -= 4;
444 proto_tree_add_item_ret_string(display_tree, hf_edp_display_string, tvb, offset, length,
445 ENC_ASCII, pinfo->pool, &display_name);
446 proto_item_append_text(display_item, ": \"%s\"",
447 format_text(pinfo->pool, display_name, strlen((const char *)display_name)));
450 static int
451 dissect_null_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
453 proto_item *null_item;
454 proto_tree *null_tree;
456 null_item = proto_tree_add_protocol_format(tree, hf_edp_null,
457 tvb, offset, length, "Null");
459 null_tree = proto_item_add_subtree(null_item, ett_edp_null);
461 dissect_tlv_header(tvb, pinfo, offset, 4, null_tree);
462 offset += 4;
464 return offset;
467 static int
468 dissect_info_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
470 proto_tree *ver_tree;
471 uint8_t major1, major2, sustaining, internal;
472 uint16_t port, slot;
473 proto_item *info_item;
474 proto_tree *info_tree;
476 /* The slot and port numbers printed on the chassis are 1
477 bigger than the transmitted values indicate */
478 slot = tvb_get_ntohs(tvb, offset + 0 + 4) + 1;
479 port = tvb_get_ntohs(tvb, offset + 2 + 4) + 1;
481 /* version */
482 major1 = tvb_get_uint8(tvb, offset + 12 + 4);
483 major2 = tvb_get_uint8(tvb, offset + 13 + 4);
484 sustaining = tvb_get_uint8(tvb, offset + 14 + 4);
485 internal = tvb_get_uint8(tvb, offset + 15 + 4);
487 info_item = proto_tree_add_protocol_format(tree, hf_edp_info,
488 tvb, offset, length,
489 "Info: Slot/Port: %d/%d, Version: %d.%d.%d.%d",
490 slot, port, major1, major2, sustaining, internal);
492 info_tree = proto_item_add_subtree(info_item, ett_edp_info);
494 dissect_tlv_header(tvb, pinfo, offset, 4, info_tree);
495 offset += 4;
497 proto_tree_add_uint(info_tree, hf_edp_info_slot, tvb, offset, 2,
498 slot);
499 offset += 2;
501 proto_tree_add_uint(info_tree, hf_edp_info_port, tvb, offset, 2,
502 port);
503 offset += 2;
505 proto_tree_add_item(info_tree, hf_edp_info_vchassid, tvb, offset, 2,
506 ENC_BIG_ENDIAN);
507 offset += 2;
509 proto_tree_add_item(info_tree, hf_edp_info_reserved, tvb, offset, 6,
510 ENC_NA);
511 offset += 6;
513 /* Begin version subtree */
514 ver_tree = proto_tree_add_subtree_format(info_tree, tvb, offset, 4,
515 ett_edp_info_version, NULL, "Version: %u.%u.%u Internal: %u", major1, major2,
516 sustaining, internal);
518 proto_tree_add_item(ver_tree, hf_edp_info_version, tvb, offset, 4,
519 ENC_BIG_ENDIAN);
521 proto_tree_add_uint(ver_tree, hf_edp_info_version_major1, tvb, offset, 1,
522 major1);
523 offset += 1;
525 proto_tree_add_uint(ver_tree, hf_edp_info_version_major2, tvb, offset, 1,
526 major2);
527 offset += 1;
529 proto_tree_add_uint(ver_tree, hf_edp_info_version_sustaining, tvb, offset, 1,
530 sustaining);
531 offset += 1;
533 proto_tree_add_uint(ver_tree, hf_edp_info_version_internal, tvb, offset, 1,
534 internal);
535 offset += 1;
536 /* End of version subtree */
538 proto_tree_add_item(info_tree, hf_edp_info_vchassconn, tvb, offset, 16,
539 ENC_NA);
540 offset += 16;
542 return offset;
545 static int
546 dissect_vlan_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
548 proto_item *flags_item;
549 proto_tree *flags_tree;
550 proto_item *vlan_item;
551 proto_tree *vlan_tree;
552 uint16_t vlan_id;
553 const uint8_t *vlan_name;
555 vlan_item = proto_tree_add_item(tree, hf_edp_vlan, tvb,
556 offset, length, ENC_BIG_ENDIAN);
558 vlan_tree = proto_item_add_subtree(vlan_item, ett_edp_vlan);
560 dissect_tlv_header(tvb, pinfo, offset, 4, vlan_tree);
561 offset += 4;
562 length -= 4;
564 /* Begin flags subtree */
565 if (length < 1) {
566 expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv);
567 return offset;
569 flags_item = proto_tree_add_item(vlan_tree, hf_edp_vlan_flags, tvb, offset, 1,
570 ENC_BIG_ENDIAN);
572 flags_tree = proto_item_add_subtree(flags_item, ett_edp_vlan_flags);
574 proto_tree_add_item(flags_tree, hf_edp_vlan_flags_ip, tvb, offset, 1,
575 ENC_BIG_ENDIAN);
576 proto_tree_add_item(flags_tree, hf_edp_vlan_flags_reserved, tvb, offset, 1,
577 ENC_BIG_ENDIAN);
578 proto_tree_add_item(flags_tree, hf_edp_vlan_flags_unknown, tvb, offset, 1,
579 ENC_BIG_ENDIAN);
580 offset += 1;
581 length -= 1;
582 /* End of flags subtree */
584 if (length < 1) {
585 expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv);
586 return offset;
588 proto_tree_add_item(vlan_tree, hf_edp_vlan_reserved1, tvb, offset, 1,
589 ENC_NA);
590 offset += 1;
591 length -= 1;
593 if (length < 2) {
594 expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv);
595 return offset;
597 vlan_id = tvb_get_ntohs(tvb, offset);
598 col_append_fstr(pinfo->cinfo, COL_INFO, "%d", vlan_id);
599 proto_item_append_text(vlan_item, ": ID %d", vlan_id);
600 proto_tree_add_uint(vlan_tree, hf_edp_vlan_id, tvb, offset, 2,
601 vlan_id);
602 offset += 2;
603 length -= 2;
605 if (length < 4) {
606 expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv);
607 return offset;
609 proto_tree_add_item(vlan_tree, hf_edp_vlan_reserved2, tvb, offset, 4,
610 ENC_NA);
611 offset += 4;
612 length -= 4;
614 if (length < 4) {
615 expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv);
616 return offset;
618 proto_tree_add_item(vlan_tree, hf_edp_vlan_ip, tvb, offset, 4,
619 ENC_BIG_ENDIAN);
620 offset += 4;
621 length -= 4;
623 proto_tree_add_item_ret_string(vlan_tree, hf_edp_vlan_name, tvb, offset, length,
624 ENC_ASCII, pinfo->pool, &vlan_name);
625 proto_item_append_text(vlan_item, ", Name \"%s\"",
626 format_text(pinfo->pool, vlan_name, strlen((const char *)vlan_name)));
627 offset += length;
630 return offset;
633 static int
634 dissect_esrp_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
636 proto_item *esrp_item;
637 proto_tree *esrp_tree;
638 uint16_t group;
640 group = tvb_get_uint8(tvb, offset + 1 + 4);
641 esrp_item = proto_tree_add_protocol_format(tree, hf_edp_esrp,
642 tvb, offset, length, "ESRP: Group %d", group);
644 esrp_tree = proto_item_add_subtree(esrp_item, ett_edp_esrp);
646 dissect_tlv_header(tvb, pinfo, offset, 4, esrp_tree);
647 offset += 4;
649 proto_tree_add_item(esrp_tree, hf_edp_esrp_proto, tvb, offset, 1,
650 ENC_BIG_ENDIAN);
651 offset += 1;
653 proto_tree_add_item(esrp_tree, hf_edp_esrp_group, tvb, offset, 1,
654 ENC_BIG_ENDIAN);
655 offset += 1;
657 proto_tree_add_item(esrp_tree, hf_edp_esrp_prio, tvb, offset, 2,
658 ENC_BIG_ENDIAN);
659 offset += 2;
661 proto_tree_add_item(esrp_tree, hf_edp_esrp_state, tvb, offset, 2,
662 ENC_BIG_ENDIAN);
663 offset += 2;
665 proto_tree_add_item(esrp_tree, hf_edp_esrp_ports, tvb, offset, 2,
666 ENC_BIG_ENDIAN);
667 offset += 2;
669 proto_tree_add_item(esrp_tree, hf_edp_esrp_virtip, tvb, offset, 4,
670 ENC_BIG_ENDIAN);
671 offset += 4;
673 proto_tree_add_item(esrp_tree, hf_edp_esrp_sysmac, tvb, offset, 6,
674 ENC_NA);
675 offset += 6;
677 proto_tree_add_item(esrp_tree, hf_edp_esrp_hello, tvb, offset, 2,
678 ENC_BIG_ENDIAN);
679 offset += 2;
681 proto_tree_add_item(esrp_tree, hf_edp_esrp_reserved, tvb, offset, 2,
682 ENC_NA);
683 offset += 2;
685 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESRP");
687 return offset;
690 static int
691 dissect_eaps_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
693 proto_item *eaps_item;
694 proto_tree *eaps_tree;
695 uint16_t ctrlvlanid;
696 const char *sysmac_str;
698 ctrlvlanid = tvb_get_ntohs(tvb, offset + 1 + 1 + 4);
699 sysmac_str = tvb_ether_to_str(pinfo->pool, tvb, offset + 12);
701 eaps_item = proto_tree_add_protocol_format(tree, hf_edp_eaps,
702 tvb, offset, length, "EAPS: Ctrlvlan %d, Sysmac %s",
703 ctrlvlanid, sysmac_str);
705 eaps_tree = proto_item_add_subtree(eaps_item, ett_edp_eaps);
707 dissect_tlv_header(tvb, pinfo, offset, 4, eaps_tree);
708 offset += 4;
710 proto_tree_add_item(eaps_tree, hf_edp_eaps_ver, tvb, offset, 1,
711 ENC_BIG_ENDIAN);
712 offset += 1;
714 proto_tree_add_item(eaps_tree, hf_edp_eaps_type, tvb, offset, 1,
715 ENC_BIG_ENDIAN);
716 offset += 1;
718 proto_tree_add_item(eaps_tree, hf_edp_eaps_ctrlvlanid, tvb, offset, 2,
719 ENC_BIG_ENDIAN);
720 offset += 2;
722 proto_tree_add_item(eaps_tree, hf_edp_eaps_reserved0, tvb, offset, 4,
723 ENC_NA);
724 offset += 4;
726 proto_tree_add_item(eaps_tree, hf_edp_eaps_sysmac, tvb, offset, 6,
727 ENC_NA);
728 offset += 6;
730 proto_tree_add_item(eaps_tree, hf_edp_eaps_hello, tvb, offset, 2,
731 ENC_BIG_ENDIAN);
732 offset += 2;
734 proto_tree_add_item(eaps_tree, hf_edp_eaps_fail, tvb, offset, 2,
735 ENC_BIG_ENDIAN);
736 offset += 2;
738 proto_tree_add_item(eaps_tree, hf_edp_eaps_state, tvb, offset, 1,
739 ENC_BIG_ENDIAN);
740 offset += 1;
742 proto_tree_add_item(eaps_tree, hf_edp_eaps_reserved1, tvb, offset, 1,
743 ENC_NA);
744 offset += 1;
746 proto_tree_add_item(eaps_tree, hf_edp_eaps_helloseq, tvb, offset, 2,
747 ENC_BIG_ENDIAN);
748 offset += 2;
750 proto_tree_add_item(eaps_tree, hf_edp_eaps_reserved2, tvb, offset, 38,
751 ENC_NA);
752 offset += 38;
754 col_set_str(pinfo->cinfo, COL_PROTOCOL, "EAPS");
755 col_append_fstr(pinfo->cinfo, COL_INFO, " ID: %d, MAC: %s",
756 ctrlvlanid, sysmac_str);
758 return offset;
761 static int
762 dissect_esl_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
764 proto_item *esl_item;
765 proto_tree *esl_tree;
766 uint16_t ctrlvlanid;
767 uint16_t numlinks;
768 const char *sysmac_str;
770 ctrlvlanid = tvb_get_ntohs(tvb, offset + 2 + 4);
771 sysmac_str = tvb_ether_to_str(pinfo->pool, tvb, offset + 12);
773 esl_item = proto_tree_add_protocol_format(tree, hf_edp_esl,
774 tvb, offset, length, "ESL: Ctrlvlan %d, Sysmac %s",
775 ctrlvlanid, sysmac_str);
777 esl_tree = proto_item_add_subtree(esl_item, ett_edp_esl);
779 dissect_tlv_header(tvb, pinfo, offset, 4, esl_tree);
780 offset += 4;
781 length -= 4;
783 proto_tree_add_item(esl_tree, hf_edp_esl_ver, tvb, offset, 1,
784 ENC_BIG_ENDIAN);
785 offset += 1;
786 length -= 1;
788 proto_tree_add_item(esl_tree, hf_edp_esl_type, tvb, offset, 1,
789 ENC_BIG_ENDIAN);
790 offset += 1;
791 length -= 1;
793 proto_tree_add_item(esl_tree, hf_edp_esl_ctrlvlanid, tvb, offset, 2,
794 ENC_BIG_ENDIAN);
795 offset += 2;
796 length -= 2;
798 proto_tree_add_item(esl_tree, hf_edp_esl_reserved0, tvb, offset, 4,
799 ENC_NA);
800 offset += 4;
801 length -= 4;
803 proto_tree_add_item(esl_tree, hf_edp_esl_sysmac, tvb, offset, 6,
804 ENC_NA);
805 offset += 6;
806 length -= 6;
808 proto_tree_add_item(esl_tree, hf_edp_esl_reserved1, tvb, offset, 4,
809 ENC_NA);
810 offset += 4;
811 length -= 4;
813 proto_tree_add_item(esl_tree, hf_edp_esl_state, tvb, offset, 1,
814 ENC_BIG_ENDIAN);
815 offset += 1;
816 length -= 1;
818 proto_tree_add_item(esl_tree, hf_edp_esl_linkrole, tvb, offset, 1,
819 ENC_BIG_ENDIAN);
820 offset += 1;
821 length -= 1;
823 proto_tree_add_item(esl_tree, hf_edp_esl_linkid1, tvb, offset, 2,
824 ENC_BIG_ENDIAN);
825 offset += 2;
826 length -= 2;
828 proto_tree_add_item(esl_tree, hf_edp_esl_failed1, tvb, offset, 2,
829 ENC_BIG_ENDIAN);
830 offset += 2;
831 length -= 2;
833 proto_tree_add_item(esl_tree, hf_edp_esl_failed2, tvb, offset, 2,
834 ENC_BIG_ENDIAN);
835 offset += 2;
836 length -= 2;
838 proto_tree_add_item(esl_tree, hf_edp_esl_reserved4, tvb, offset, 2,
839 ENC_NA);
840 offset += 2;
841 length -= 2;
843 proto_tree_add_item(esl_tree, hf_edp_esl_linkid2, tvb, offset, 2,
844 ENC_BIG_ENDIAN);
845 offset += 2;
846 length -= 2;
848 proto_tree_add_item(esl_tree, hf_edp_esl_reserved5, tvb, offset, 2,
849 ENC_NA);
850 offset += 2;
851 length -= 2;
853 numlinks = tvb_get_ntohs(tvb, offset);
854 proto_tree_add_item(esl_tree, hf_edp_esl_numlinks, tvb, offset, 2,
855 ENC_BIG_ENDIAN);
856 offset += 2;
857 length -= 2;
859 for (; numlinks > 0 && length >= 2; numlinks--) {
860 proto_tree_add_item(esl_tree, hf_edp_esl_linklist, tvb, offset, 2,
861 ENC_BIG_ENDIAN);
862 offset += 2;
863 length -= 2;
866 proto_tree_add_item(esl_tree, hf_edp_esl_rest, tvb, offset, length,
867 ENC_NA);
868 offset += length;
870 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESL");
871 col_append_fstr(pinfo->cinfo, COL_INFO, " ID: %d, MAC: %s",
872 ctrlvlanid, sysmac_str);
874 return offset;
877 static int
878 dissect_elsm_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length,
879 proto_tree *tree, uint16_t seqno)
881 proto_item *elsm_item;
882 proto_tree *elsm_tree;
883 uint8_t type, subtype;
885 type = tvb_get_uint8(tvb, offset + 4);
886 subtype = tvb_get_uint8(tvb, offset + 4 + 1);
888 col_append_fstr(pinfo->cinfo, COL_INFO, " %s%s (#%d)",
889 val_to_str(type, elsm_type_vals, "Unknown (0x%02x)"),
890 val_to_str(subtype, elsm_subtype_vals, " Unknown (0x%02x)"),
891 seqno);
893 elsm_item = proto_tree_add_protocol_format(tree, hf_edp_elsm,
894 tvb, offset, length, "ELSM %s%s(#%d)",
895 val_to_str(type, elsm_type_vals, "Unknown (0x%02x)"),
896 val_to_str(subtype, elsm_subtype_vals, " Unknown (0x%02x)"),
897 seqno);
899 elsm_tree = proto_item_add_subtree(elsm_item, ett_edp_elsm);
901 dissect_tlv_header(tvb, pinfo, offset, 4, elsm_tree);
902 offset += 4;
904 /* The rest is actually guesswork */
905 proto_tree_add_item(elsm_tree, hf_edp_elsm_type, tvb, offset, 1,
906 ENC_BIG_ENDIAN);
907 offset += 1;
909 proto_tree_add_item(elsm_tree, hf_edp_elsm_subtype, tvb, offset, 1,
910 ENC_BIG_ENDIAN);
911 offset += 1;
913 proto_tree_add_item(elsm_tree, hf_edp_elsm_magic, tvb, offset, 2,
914 ENC_NA);
915 offset += 2;
917 return offset;
920 static void
921 dissect_elrp_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
923 proto_item *elrp_item;
924 proto_tree *elrp_tree;
926 elrp_item = proto_tree_add_protocol_format(tree, hf_edp_elrp,
927 tvb, offset, length, "ELRP");
929 elrp_tree = proto_item_add_subtree(elrp_item, ett_edp_elrp);
931 dissect_tlv_header(tvb, pinfo, offset, 4, elrp_tree);
932 offset += 4;
933 length -= 4;
935 proto_tree_add_item(elrp_tree, hf_edp_elrp_unknown, tvb, offset, length,
936 ENC_NA);
939 static void
940 dissect_link_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
942 proto_item *link_item;
943 proto_tree *link_tree;
945 link_item = proto_tree_add_protocol_format(tree, hf_edp_link,
946 tvb, offset, length, "Linkinfo");
948 link_tree = proto_item_add_subtree(link_item, ett_edp_link);
950 dissect_tlv_header(tvb, pinfo, offset, 4, link_tree);
951 offset += 4;
952 length -= 4;
954 /* TODO: Find out and decode the individual bits */
955 if ( length == 4 ) {
956 proto_item *flags_item;
957 proto_tree *flags_tree;
959 /* 0x80: Autonegotiation: 1: on, 0: off */
960 /* 0x40: Other side does EDP ??? */
961 /* 0x08: Flow Control: 1: Symmetric/on, 0: None/off */
962 flags_item = proto_tree_add_item(link_tree, hf_edp_link_flags, tvb, offset, 1, ENC_NA);
963 flags_tree = proto_item_add_subtree(flags_item, ett_edp_link_flags);
964 tree_expanded_set(ett_edp_link_flags, true);
965 proto_tree_add_item(flags_tree, hf_edp_link_flags_autoneg, tvb, offset, 1, ENC_NA);
966 proto_tree_add_item(flags_tree, hf_edp_link_flags_flowcontrol, tvb, offset, 1, ENC_NA);
967 proto_tree_add_item(flags_tree, hf_edp_link_flags_unknown, tvb, offset, 1, ENC_NA);
969 proto_tree_add_item(link_tree, hf_edp_link_conf, tvb, offset+1, 1, ENC_NA);
970 proto_tree_add_item(link_tree, hf_edp_link_actual, tvb, offset+2, 1, ENC_NA);
971 proto_tree_add_item(link_tree, hf_edp_link_zero, tvb, offset+3, 1, ENC_NA);
972 } else {
973 proto_tree_add_item(link_tree, hf_edp_link_unknown, tvb, offset, length, ENC_NA);
977 static void
978 dissect_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, proto_tree *tree)
980 proto_item *unknown_item;
981 proto_tree *unknown_tree;
982 uint8_t tlv_type;
984 tlv_type = tvb_get_uint8(tvb, offset + 1);
986 unknown_item = proto_tree_add_protocol_format(tree, hf_edp_unknown,
987 tvb, offset, length, "Unknown element [0x%02x]", tlv_type);
989 unknown_tree = proto_item_add_subtree(unknown_item, ett_edp_unknown);
991 dissect_tlv_header(tvb, pinfo, offset, 4, unknown_tree);
992 offset += 4;
993 length -= 4;
995 proto_tree_add_item(unknown_tree, hf_edp_unknown_data, tvb, offset, length,
996 ENC_NA);
999 static int
1000 dissect_edp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1002 proto_item *ti;
1003 proto_tree *edp_tree;
1004 uint32_t offset = 0;
1005 bool last = false;
1006 uint8_t tlv_type;
1007 uint16_t tlv_length;
1008 uint16_t data_length;
1009 uint16_t seqno;
1010 vec_t cksum_vec[1];
1012 col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME);
1013 col_set_str(pinfo->cinfo, COL_INFO, PROTO_SHORT_NAME ":");
1015 ti = proto_tree_add_item(tree, proto_edp, tvb, offset, -1,
1016 ENC_NA);
1017 edp_tree = proto_item_add_subtree(ti, ett_edp);
1019 proto_tree_add_item(edp_tree, hf_edp_version, tvb, offset, 1,
1020 ENC_BIG_ENDIAN);
1021 offset += 1;
1023 proto_tree_add_item(edp_tree, hf_edp_reserved, tvb, offset, 1,
1024 ENC_BIG_ENDIAN);
1025 offset += 1;
1027 data_length = tvb_get_ntohs(tvb, offset);
1028 proto_tree_add_uint(edp_tree, hf_edp_length, tvb, offset, 2,
1029 data_length);
1030 offset += 2;
1033 * If we have the entire ESP packet available, check the checksum.
1035 if (tvb_captured_length(tvb) >= data_length) {
1036 /* Checksum from version to null tlv */
1037 SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, data_length);
1039 proto_tree_add_checksum(edp_tree, tvb, offset, hf_edp_checksum, hf_edp_checksum_status, &ei_edp_checksum, pinfo, in_cksum(&cksum_vec[0], 1),
1040 ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
1041 } else {
1042 proto_tree_add_checksum(edp_tree, tvb, offset, hf_edp_checksum, hf_edp_checksum_status, &ei_edp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
1044 offset += 2;
1046 seqno = tvb_get_ntohs(tvb, offset);
1047 proto_tree_add_item(edp_tree, hf_edp_seqno, tvb, offset, 2,
1048 ENC_BIG_ENDIAN);
1049 offset += 2;
1051 /* Machine ID is 8 bytes, if it starts with 0000, the remaining
1052 6 bytes are a MAC */
1053 proto_tree_add_item(edp_tree, hf_edp_midtype, tvb, offset, 2,
1054 ENC_BIG_ENDIAN);
1055 offset += 2;
1057 proto_tree_add_item(edp_tree, hf_edp_midmac, tvb, offset, 6,
1058 ENC_NA);
1059 offset += 6;
1061 /* Decode the individual TLVs */
1062 while (offset < data_length && !last) {
1063 if (data_length - offset < 4) {
1064 proto_tree_add_expert_format(edp_tree, pinfo, &ei_edp_short_tlv, tvb, offset, 4,
1065 "Too few bytes left for TLV: %u (< 4)",
1066 data_length - offset);
1067 break;
1069 tlv_type = tvb_get_uint8(tvb, offset + 1);
1070 tlv_length = tvb_get_ntohs(tvb, offset + 2);
1072 if ((tlv_length < 4) || (tlv_length > (data_length - offset))) {
1073 proto_tree_add_expert_format(edp_tree, pinfo, &ei_edp_short_tlv, tvb, offset, 0,
1074 "TLV with invalid length: %u", tlv_length);
1075 break;
1077 if (tlv_type != EDP_TYPE_NULL)
1078 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
1079 val_to_str(tlv_type, edp_type_vals, "[0x%02x]"));
1081 switch (tlv_type) {
1082 case EDP_TYPE_NULL: /* Last TLV */
1083 dissect_null_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1084 last = true;
1085 break;
1086 case EDP_TYPE_DISPLAY: /* MIB II display string */
1087 dissect_display_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1088 break;
1089 case EDP_TYPE_INFO: /* Basic system information */
1090 dissect_info_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1091 break;
1092 case EDP_TYPE_VLAN: /* VLAN info */
1093 dissect_vlan_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1094 break;
1095 case EDP_TYPE_ESRP: /* Extreme Standby Router Protocol */
1096 dissect_esrp_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1097 break;
1098 case EDP_TYPE_EAPS: /* Ethernet Automatic Protection Switching */
1099 dissect_eaps_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1100 break;
1101 case EDP_TYPE_ESL: /* EAPS shared link */
1102 dissect_esl_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1103 break;
1104 case EDP_TYPE_ELSM: /* Extreme Link Status Monitoring */
1105 dissect_elsm_tlv(tvb, pinfo, offset, tlv_length, edp_tree, seqno);
1106 break;
1107 case EDP_TYPE_ELRP: /* Extreme Loop Recognition Protocol */
1108 dissect_elrp_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1109 break;
1110 case EDP_TYPE_LINK: /* Extreme Link Properties */
1111 dissect_link_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1112 break;
1113 default:
1114 dissect_unknown_tlv(tvb, pinfo, offset, tlv_length, edp_tree);
1115 break;
1117 offset += tlv_length;
1120 return tvb_captured_length(tvb);
1123 void
1124 proto_register_edp(void)
1126 static hf_register_info hf[] = {
1128 /* EDP header */
1129 { &hf_edp_version,
1130 { "Version", "edp.version", FT_UINT8, BASE_DEC, NULL,
1131 0x0, NULL, HFILL }},
1133 { &hf_edp_reserved,
1134 { "Reserved", "edp.reserved", FT_UINT8, BASE_DEC, NULL,
1135 0x0, NULL, HFILL }},
1137 { &hf_edp_length,
1138 { "Data length", "edp.length", FT_UINT16, BASE_DEC, NULL,
1139 0x0, NULL, HFILL }},
1141 { &hf_edp_checksum,
1142 { "EDP checksum", "edp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
1143 NULL, HFILL }},
1145 { &hf_edp_checksum_status,
1146 { "EDP checksum status", "edp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
1147 NULL, HFILL }},
1149 { &hf_edp_seqno,
1150 { "Sequence number", "edp.seqno", FT_UINT16, BASE_DEC, NULL,
1151 0x0, NULL, HFILL }},
1153 { &hf_edp_midtype,
1154 { "Machine ID type", "edp.midtype", FT_UINT16, BASE_DEC, VALS(edp_midtype_vals),
1155 0x0, NULL, HFILL }},
1157 { &hf_edp_midmac,
1158 { "Machine MAC", "edp.midmac", FT_ETHER, BASE_NONE, NULL,
1159 0x0, NULL, HFILL }},
1161 /* TLV header */
1162 { &hf_edp_tlv_marker,
1163 { "TLV Marker", "edp.tlv.marker", FT_UINT8, BASE_HEX, NULL,
1164 0x0, NULL, HFILL }},
1166 { &hf_edp_tlv_type,
1167 { "TLV type", "edp.tlv.type", FT_UINT8, BASE_DEC, VALS(edp_type_vals),
1168 0x0, NULL, HFILL }},
1170 { &hf_edp_tlv_length,
1171 { "TLV length", "edp.tlv.length", FT_UINT16, BASE_DEC, NULL,
1172 0x0, NULL, HFILL }},
1174 /* Display element */
1175 { &hf_edp_display,
1176 { "Display", "edp.display", FT_PROTOCOL, BASE_NONE, NULL,
1177 0x0, "Display element", HFILL }},
1179 { &hf_edp_display_string,
1180 { "Name", "edp.display.string", FT_STRING, BASE_NONE, NULL,
1181 0x0, "MIB II display string", HFILL }},
1183 /* Info element */
1184 { &hf_edp_info,
1185 { "Info", "edp.info", FT_PROTOCOL, BASE_NONE, NULL,
1186 0x0, "Info element", HFILL }},
1188 { &hf_edp_info_slot,
1189 { "Slot", "edp.info.slot", FT_UINT16, BASE_DEC, NULL,
1190 0x0, "Originating slot #", HFILL }},
1192 { &hf_edp_info_port,
1193 { "Port", "edp.info.port", FT_UINT16, BASE_DEC, NULL,
1194 0x0, "Originating port #", HFILL }},
1196 { &hf_edp_info_vchassid,
1197 { "Virt chassis", "edp.info.vchassid", FT_UINT16, BASE_DEC, NULL,
1198 0x0, "Virtual chassis ID", HFILL }},
1200 { &hf_edp_info_reserved,
1201 { "Reserved", "edp.info.reserved", FT_BYTES, BASE_NONE, NULL,
1202 0x0, NULL, HFILL }},
1204 { &hf_edp_info_version,
1205 { "Version", "edp.info.version", FT_UINT32, BASE_HEX, NULL,
1206 0x0, "Software version", HFILL }},
1208 { &hf_edp_info_version_major1,
1209 { "Version (major1)", "edp.info.version.major1", FT_UINT8, BASE_DEC, NULL,
1210 0x0, "Software version (major1)", HFILL }},
1212 { &hf_edp_info_version_major2,
1213 { "Version (major2)", "edp.info.version.major2", FT_UINT8, BASE_DEC, NULL,
1214 0x0, "Software version (major2)", HFILL }},
1216 { &hf_edp_info_version_sustaining,
1217 { "Version (sustaining)", "edp.info.version.sustaining", FT_UINT8, BASE_DEC, NULL,
1218 0x0, "Software version (sustaining)", HFILL }},
1220 { &hf_edp_info_version_internal,
1221 { "Version (internal)", "edp.info.version.internal", FT_UINT8, BASE_DEC, NULL,
1222 0x0, "Software version (internal)", HFILL }},
1224 { &hf_edp_info_vchassconn,
1225 { "Connections", "edp.info.vchassconn", FT_BYTES, BASE_NONE, NULL,
1226 0x0, "Virtual chassis connections", HFILL }},
1228 /* VLAN element */
1229 { &hf_edp_vlan,
1230 { "Vlan", "edp.vlan", FT_PROTOCOL, BASE_NONE, NULL,
1231 0x0, "Vlan element", HFILL }},
1233 { &hf_edp_vlan_flags,
1234 { "Flags", "edp.vlan.flags", FT_UINT8, BASE_HEX, NULL,
1235 0x0, NULL, HFILL }},
1237 { &hf_edp_vlan_flags_ip,
1238 { "Flags-IP", "edp.vlan.flags.ip", FT_BOOLEAN, 8, TFS(&tfs_set_notset),
1239 0x80, "Vlan has IP address configured", HFILL }},
1241 { &hf_edp_vlan_flags_reserved,
1242 { "Flags-reserved", "edp.vlan.flags.reserved", FT_UINT8, BASE_HEX, NULL,
1243 0x7e, NULL, HFILL }},
1245 { &hf_edp_vlan_flags_unknown,
1246 { "Flags-Unknown", "edp.vlan.flags.unknown", FT_BOOLEAN, 8, TFS(&tfs_set_notset),
1247 0x01, NULL, HFILL }},
1249 { &hf_edp_vlan_reserved1,
1250 { "Reserved1", "edp.vlan.reserved1", FT_BYTES, BASE_NONE, NULL,
1251 0x0, NULL, HFILL }},
1253 { &hf_edp_vlan_id,
1254 { "Vlan ID", "edp.vlan.id", FT_UINT16, BASE_DEC, NULL,
1255 0x0, NULL, HFILL }},
1257 { &hf_edp_vlan_reserved2,
1258 { "Reserved2", "edp.vlan.reserved2", FT_BYTES, BASE_NONE, NULL,
1259 0x0, NULL, HFILL }},
1261 { &hf_edp_vlan_ip,
1262 { "IP addr", "edp.vlan.ip", FT_IPv4, BASE_NONE, NULL,
1263 0x0, "VLAN IP address", HFILL }},
1265 { &hf_edp_vlan_name,
1266 { "Name", "edp.vlan.name", FT_STRING, BASE_NONE, NULL,
1267 0x0, "VLAN name", HFILL }},
1269 /* ESRP element */
1270 { &hf_edp_esrp,
1271 { "ESRP", "edp.esrp", FT_PROTOCOL, BASE_NONE, NULL,
1272 0x0, "Extreme Standby Router Protocol element", HFILL }},
1274 { &hf_edp_esrp_proto,
1275 { "Protocol", "edp.esrp.proto", FT_UINT8, BASE_DEC, VALS(esrp_proto_vals),
1276 0x0, NULL, HFILL }},
1278 { &hf_edp_esrp_group,
1279 { "Group", "edp.esrp.group", FT_UINT8, BASE_DEC, NULL,
1280 0x0, NULL, HFILL }},
1282 { &hf_edp_esrp_prio,
1283 { "Prio", "edp.esrp.prio", FT_UINT16, BASE_DEC, NULL,
1284 0x0, NULL, HFILL }},
1286 { &hf_edp_esrp_state,
1287 { "State", "edp.esrp.state", FT_UINT16, BASE_DEC, VALS(esrp_state_vals),
1288 0x0, NULL, HFILL }},
1290 { &hf_edp_esrp_ports,
1291 { "Ports", "edp.esrp.ports", FT_UINT16, BASE_DEC, NULL,
1292 0x0, "Number of active ports", HFILL }},
1294 { &hf_edp_esrp_virtip,
1295 { "VirtIP", "edp.esrp.virtip", FT_IPv4, BASE_NONE, NULL,
1296 0x0, "Virtual IP address", HFILL }},
1298 { &hf_edp_esrp_sysmac,
1299 { "Sys MAC", "edp.esrp.sysmac", FT_ETHER, BASE_NONE, NULL,
1300 0x0, "System MAC address", HFILL }},
1302 { &hf_edp_esrp_hello,
1303 { "Hello", "edp.esrp.hello", FT_UINT16, BASE_DEC, NULL,
1304 0x0, "Hello timer", HFILL }},
1306 { &hf_edp_esrp_reserved,
1307 { "Reserved", "edp.esrp.reserved", FT_BYTES, BASE_NONE, NULL,
1308 0x0, NULL, HFILL }},
1310 /* EAPS element */
1311 { &hf_edp_eaps,
1312 { "EAPS", "edp.eaps", FT_PROTOCOL, BASE_NONE, NULL,
1313 0x0, "Ethernet Automatic Protection Switching element", HFILL }},
1315 { &hf_edp_eaps_ver,
1316 { "Version", "edp.eaps.ver", FT_UINT8, BASE_DEC, NULL,
1317 0x0, NULL, HFILL }},
1319 { &hf_edp_eaps_type,
1320 { "Type", "edp.eaps.type", FT_UINT8, BASE_DEC, VALS(eaps_type_vals),
1321 0x0, NULL, HFILL }},
1323 { &hf_edp_eaps_ctrlvlanid,
1324 { "Vlan ID", "edp.eaps.vlanid", FT_UINT16, BASE_DEC, NULL,
1325 0x0, "Control Vlan ID", HFILL }},
1327 { &hf_edp_eaps_reserved0,
1328 { "Reserved0", "edp.eaps.reserved0", FT_BYTES, BASE_NONE, NULL,
1329 0x0, NULL, HFILL }},
1331 { &hf_edp_eaps_sysmac,
1332 { "Sys MAC", "edp.eaps.sysmac", FT_ETHER, BASE_NONE, NULL,
1333 0x0, "System MAC address", HFILL }},
1335 { &hf_edp_eaps_hello,
1336 { "Hello", "edp.eaps.hello", FT_UINT16, BASE_DEC, NULL,
1337 0x0, "Hello timer", HFILL }},
1339 { &hf_edp_eaps_fail,
1340 { "Fail", "edp.eaps.fail", FT_UINT16, BASE_DEC, NULL,
1341 0x0, "Fail timer", HFILL }},
1343 { &hf_edp_eaps_state,
1344 { "State", "edp.eaps.state", FT_UINT8, BASE_DEC, VALS(eaps_state_vals),
1345 0x0, NULL, HFILL }},
1347 { &hf_edp_eaps_reserved1,
1348 { "Reserved1", "edp.eaps.reserved1", FT_BYTES, BASE_NONE, NULL,
1349 0x0, NULL, HFILL }},
1351 { &hf_edp_eaps_helloseq,
1352 { "Helloseq", "edp.eaps.helloseq", FT_UINT16, BASE_DEC, NULL,
1353 0x0, "Hello sequence", HFILL }},
1355 { &hf_edp_eaps_reserved2,
1356 { "Reserved2", "edp.eaps.reserved2", FT_BYTES, BASE_NONE, NULL,
1357 0x0, NULL, HFILL }},
1359 /* ESL element (EAPS shared link) */
1360 { &hf_edp_esl,
1361 { "ESL", "edp.esl", FT_PROTOCOL, BASE_NONE, NULL,
1362 0x0, "EAPS shared link", HFILL }},
1364 { &hf_edp_esl_ver,
1365 { "Version", "edp.esl.ver", FT_UINT8, BASE_DEC, NULL,
1366 0x0, NULL, HFILL }},
1368 { &hf_edp_esl_type,
1369 { "Type", "edp.esl.type", FT_UINT8, BASE_DEC, VALS(esl_type_vals),
1370 0x0, NULL, HFILL }},
1372 { &hf_edp_esl_ctrlvlanid,
1373 { "Vlan ID", "edp.esl.vlanid", FT_UINT16, BASE_DEC, NULL,
1374 0x0, "Control Vlan ID", HFILL }},
1376 { &hf_edp_esl_reserved0,
1377 { "Reserved0", "edp.esl.reserved0", FT_BYTES, BASE_NONE, NULL,
1378 0x0, NULL, HFILL }},
1380 { &hf_edp_esl_sysmac,
1381 { "Sys MAC", "edp.esl.sysmac", FT_ETHER, BASE_NONE, NULL,
1382 0x0, "System MAC address", HFILL }},
1384 { &hf_edp_esl_reserved1,
1385 { "Reserved1", "edp.esl.reserved1", FT_BYTES, BASE_NONE, NULL,
1386 0x0, NULL, HFILL }},
1388 { &hf_edp_esl_state,
1389 { "State", "edp.esl.state", FT_UINT8, BASE_DEC, VALS(esl_state_vals),
1390 0x0, NULL, HFILL }},
1392 { &hf_edp_esl_linkrole,
1393 { "Role", "edp.esl.role", FT_UINT8, BASE_DEC, VALS(esl_role_vals),
1394 0x0, NULL, HFILL }},
1396 { &hf_edp_esl_linkid1,
1397 { "Link ID 1", "edp.esl.linkid1", FT_UINT16, BASE_DEC, NULL,
1398 0x0, "Shared link ID 1", HFILL }},
1400 { &hf_edp_esl_failed1,
1401 { "Failed ID 1", "edp.esl.failed1", FT_UINT16, BASE_DEC, NULL,
1402 0x0, "Failed link ID 1", HFILL }},
1404 { &hf_edp_esl_failed2,
1405 { "Failed ID 2", "edp.esl.failed2", FT_UINT16, BASE_DEC, NULL,
1406 0x0, "Failed link ID 2", HFILL }},
1408 { &hf_edp_esl_reserved4,
1409 { "Reserved4", "edp.esl.reserved4", FT_BYTES, BASE_NONE, NULL,
1410 0x0, NULL, HFILL }},
1412 { &hf_edp_esl_linkid2,
1413 { "Link ID 2", "edp.esl.linkid2", FT_UINT16, BASE_DEC, NULL,
1414 0x0, "Shared link ID 2", HFILL }},
1416 { &hf_edp_esl_reserved5,
1417 { "Reserved5", "edp.esl.reserved5", FT_BYTES, BASE_NONE, NULL,
1418 0x0, NULL, HFILL }},
1420 { &hf_edp_esl_numlinks,
1421 { "Num Shared Links", "edp.esl.numlinks", FT_UINT16, BASE_DEC, NULL,
1422 0x0, "Number of shared links in the network", HFILL }},
1424 { &hf_edp_esl_linklist,
1425 { "Link List", "edp.esl.linklist", FT_UINT16, BASE_DEC, NULL,
1426 0x0, "List of Shared Link IDs", HFILL }},
1428 { &hf_edp_esl_rest,
1429 { "Rest", "edp.esl.rest", FT_BYTES, BASE_NONE, NULL,
1430 0x0, NULL, HFILL }},
1432 /* ELSM element */
1433 { &hf_edp_elsm,
1434 { "ELSM", "edp.elsm", FT_PROTOCOL, BASE_NONE, NULL,
1435 0x0, "Extreme Link Status Monitoring element", HFILL }},
1437 { &hf_edp_elsm_type,
1438 { "Type", "edp.elsm.type", FT_UINT8, BASE_DEC, VALS(elsm_type_vals),
1439 0x0, NULL, HFILL }},
1441 { &hf_edp_elsm_subtype,
1442 { "Subtype", "edp.elsm.subtype", FT_UINT8, BASE_DEC, VALS(elsm_subtype_vals),
1443 0x0, NULL, HFILL }},
1445 { &hf_edp_elsm_magic,
1446 { "Magic", "edp.elsm.unknown", FT_BYTES, BASE_NONE, NULL,
1447 0x0, NULL, HFILL }},
1449 /* ELRP element */
1450 { &hf_edp_elrp,
1451 { "ELRP", "edp.elrp", FT_PROTOCOL, BASE_NONE, NULL,
1452 0x0, "Extreme Loop Recognition Protocol element", HFILL }},
1454 { &hf_edp_elrp_unknown,
1455 { "Unknown", "edp.elrp.unknown", FT_BYTES, BASE_NONE, NULL,
1456 0x0, NULL, HFILL }},
1458 /* Link element */
1459 { &hf_edp_link,
1460 { "Link", "edp.link", FT_PROTOCOL, BASE_NONE, NULL,
1461 0x0, "Link properties (physical)", HFILL }},
1463 { &hf_edp_link_flags,
1464 { "Flags", "edp.link.flags", FT_UINT8, BASE_HEX, NULL,
1465 0x0, NULL, HFILL }},
1467 { &hf_edp_link_flags_autoneg,
1468 { "Autonegotiation", "edp.link.flags.autoneg", FT_BOOLEAN, 8, TFS(&tfs_set_notset),
1469 0x80, NULL, HFILL }},
1471 { &hf_edp_link_flags_flowcontrol,
1472 { "Flow Control", "edp.link.flags.flowcontrol", FT_BOOLEAN, 8, TFS(&tfs_set_notset),
1473 0x08, NULL, HFILL }},
1475 { &hf_edp_link_flags_unknown,
1476 { "Unknown", "edp.link.flags.unknown", FT_UINT8, BASE_HEX, NULL,
1477 0x77, NULL, HFILL }},
1479 { &hf_edp_link_conf,
1480 { "Configured Speed", "edp.link.conf", FT_UINT8, BASE_HEX, VALS(link_speed_vals),
1481 0x0, NULL, HFILL }},
1483 { &hf_edp_link_actual,
1484 { "Actual Speed", "edp.link.actual", FT_UINT8, BASE_HEX, VALS(link_speed_vals),
1485 0x0, NULL, HFILL }},
1487 { &hf_edp_link_zero,
1488 { "Zero", "edp.link.zero", FT_UINT8, BASE_DEC, NULL,
1489 0x0, NULL, HFILL }},
1491 { &hf_edp_link_unknown,
1492 { "Unknown", "edp.link.unknown", FT_BYTES, BASE_NONE, NULL,
1493 0x0, NULL, HFILL }},
1495 /* Unknown element */
1496 { &hf_edp_unknown,
1497 { "Unknown", "edp.unknown", FT_PROTOCOL, BASE_NONE, NULL,
1498 0x0, "Element unknown to Wireshark", HFILL }},
1500 { &hf_edp_unknown_data,
1501 { "Unknown", "edp.unknown.data", FT_BYTES, BASE_NONE, NULL,
1502 0x0, NULL, HFILL }},
1504 /* Null element */
1505 { &hf_edp_null,
1506 { "End", "edp.null", FT_PROTOCOL, BASE_NONE, NULL,
1507 0x0, "Last element", HFILL }},
1510 static hf_register_info extreme_hf[] = {
1511 { &hf_llc_extreme_pid,
1512 { "PID", "llc.extreme_pid", FT_UINT16, BASE_HEX,
1513 VALS(extreme_pid_vals), 0x0, NULL, HFILL }
1517 static int *ett[] = {
1518 &ett_edp,
1519 &ett_edp_tlv_header,
1520 &ett_edp_vlan_flags,
1521 &ett_edp_display,
1522 &ett_edp_info,
1523 &ett_edp_info_version,
1524 &ett_edp_vlan,
1525 &ett_edp_esrp,
1526 &ett_edp_eaps,
1527 &ett_edp_esl,
1528 &ett_edp_elsm,
1529 &ett_edp_elrp,
1530 &ett_edp_link,
1531 &ett_edp_link_flags,
1532 &ett_edp_unknown,
1533 &ett_edp_null,
1536 static ei_register_info ei[] = {
1537 { &ei_edp_short_tlv, { "edp.short_tlv", PI_MALFORMED, PI_ERROR, "TLV is too short", EXPFILL }},
1538 { &ei_edp_checksum, { "edp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
1541 expert_module_t* expert_edp;
1543 proto_edp = proto_register_protocol(PROTO_LONG_NAME, PROTO_SHORT_NAME, "edp");
1544 edp_handle = register_dissector("edp", dissect_edp, proto_edp);
1545 proto_register_field_array(proto_edp, hf, array_length(hf));
1546 proto_register_subtree_array(ett, array_length(ett));
1547 expert_edp = expert_register_protocol(proto_edp);
1548 expert_register_field_array(expert_edp, ei, array_length(ei));
1550 llc_add_oui(OUI_EXTREME, "llc.extreme_pid", "LLC Extreme OUI PID", extreme_hf, proto_edp);
1554 void
1555 proto_reg_handoff_edp(void)
1557 dissector_add_uint("llc.extreme_pid", 0x00bb, edp_handle);
1561 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1563 * Local variables:
1564 * c-basic-offset: 8
1565 * tab-width: 8
1566 * indent-tabs-mode: t
1567 * End:
1569 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1570 * :indentSize=8:tabSize=8:noTabs=false: