Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-vtp.c
blob3022d395743cf8631b9ce7aed43aa18450fe40c2
1 /* packet-vtp.c
2 * Routines for the disassembly of Cisco's VLAN Trunking Protocol
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #include "config.h"
13 #include <epan/packet.h>
14 #include <epan/expert.h>
15 #include <epan/cisco_pid.h>
18 * See
20 * http://www.cisco.com/en/US/tech/tk389/tk689/technologies_tech_note09186a0080094c52.shtml
22 * for some information on VTP.
24 void proto_register_vtp(void);
25 void proto_reg_handoff_vtp(void);
27 static dissector_handle_t vtp_handle;
29 static int proto_vtp;
30 static int hf_vtp_version;
31 static int hf_vtp_code;
32 static int hf_vtp_followers;
33 static int hf_vtp_md_len;
34 static int hf_vtp_md;
35 static int hf_vtp_conf_rev_num;
36 static int hf_vtp_upd_id;
37 static int hf_vtp_upd_ts;
38 static int hf_vtp_md5_digest;
39 static int hf_vtp_seq_num;
40 static int hf_vtp_start_value;
41 static int hf_vtp_vlan_info_len;
42 static int hf_vtp_vlan_status;
43 static int hf_vtp_vlan_status_vlan_susp;
44 static int hf_vtp_vlan_type;
45 static int hf_vtp_vlan_name_len;
46 static int hf_vtp_isl_vlan_id;
47 static int hf_vtp_mtu_size;
48 static int hf_vtp_802_10_index;
49 static int hf_vtp_vlan_name;
50 static int hf_vtp_vlan_tlvtype;
51 static int hf_vtp_vlan_tlvlength;
52 static int hf_vtp_pruning_first_vid;
53 static int hf_vtp_pruning_last_vid;
54 static int hf_vtp_pruning_active_vid;
55 static int hf_vtp_vlan_src_route_ring_num;
56 static int hf_vtp_vlan_src_route_bridge_num;
57 static int hf_vtp_vlan_stp_type;
58 static int hf_vtp_vlan_parent_vlan;
59 static int hf_vtp_vlan_translationally_bridged_vlans;
60 static int hf_vtp_vlan_pruning;
61 static int hf_vtp_vlan_bridge_type;
62 static int hf_vtp_vlan_max_are_hop_count;
63 static int hf_vtp_vlan_max_ste_hop_count;
64 static int hf_vtp_vlan_backup_crf_mode;
65 static int hf_vtp_vlan_data;
66 static int hf_vtp_reserved;
68 static int ett_vtp;
69 static int ett_vtp_vlan_info;
70 static int ett_vtp_vlan_status;
71 static int ett_vtp_tlv;
72 static int ett_vtp_pruning;
74 static expert_field ei_vtp_vlan_tlvlength_bad;
76 static int
77 dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree);
78 static void
79 dissect_vlan_info_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length,
80 proto_tree *tree, proto_item *ti, uint8_t type);
82 #define SUMMARY_ADVERT 0x01
83 #define SUBSET_ADVERT 0x02
84 #define ADVERT_REQUEST 0x03
85 #define JOIN_MSG 0x04
87 static const value_string type_vals[] = {
88 { SUMMARY_ADVERT, "Summary Advertisement" },
89 { SUBSET_ADVERT, "Subset Advertisement" },
90 { ADVERT_REQUEST, "Advertisement Request" },
91 { JOIN_MSG, "Join/Prune Message" },
92 { 0, NULL },
95 static void
96 set_vtp_info_col(tvbuff_t *tvb, packet_info *pinfo)
98 switch (tvb_get_uint8(tvb, 1)) {
100 case SUMMARY_ADVERT:
101 col_add_fstr(pinfo->cinfo, COL_INFO,
102 "Summary Advertisement, Revision: %u", tvb_get_ntohl(tvb, 36));
104 if (tvb_get_uint8(tvb, 2) > 0) {
105 col_append_fstr(pinfo->cinfo, COL_INFO,
106 ", Followers: %u", tvb_get_uint8(tvb, 2));
109 break;
111 case SUBSET_ADVERT:
112 col_add_fstr(pinfo->cinfo, COL_INFO,
113 "Subset Advertisement, Revision: %u, Seq: %u",
114 tvb_get_ntohl(tvb, 36), tvb_get_uint8(tvb, 2));
115 break;
117 case ADVERT_REQUEST:
118 col_set_str(pinfo->cinfo, COL_INFO, "Advertisement Request");
119 break;
121 case JOIN_MSG:
122 col_set_str(pinfo->cinfo, COL_INFO, "Join");
123 break;
125 default:
126 col_set_str(pinfo->cinfo, COL_INFO, "Unrecognized VTP message");
127 break;
131 static int
132 dissect_vtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
134 proto_item *ti;
135 proto_tree *vtp_tree = NULL, *vtp_pruning_tree = NULL;
136 int offset = 0;
137 uint8_t code;
138 uint8_t *upd_timestamp;
139 int vlan_info_len;
140 int pruning_vlan_id;
141 int yy, mm, dd, hh, _mm, ss;
142 char *display;
144 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VTP");
145 set_vtp_info_col(tvb, pinfo);
147 ti = proto_tree_add_item(tree, proto_vtp, tvb, offset, -1, ENC_NA);
148 vtp_tree = proto_item_add_subtree(ti, ett_vtp);
150 proto_tree_add_item(vtp_tree, hf_vtp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
151 offset += 1;
153 code = tvb_get_uint8(tvb, offset);
154 proto_tree_add_item(vtp_tree, hf_vtp_code, tvb, offset, 1, ENC_BIG_ENDIAN);
155 offset += 1;
157 switch (code) {
159 case SUMMARY_ADVERT:
160 proto_tree_add_item(vtp_tree, hf_vtp_followers, tvb, offset, 1, ENC_BIG_ENDIAN);
161 offset += 1;
163 proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
164 offset += 1;
166 proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII);
167 offset += 32;
169 proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num, tvb, offset, 4, ENC_BIG_ENDIAN);
170 offset += 4;
172 proto_tree_add_item(vtp_tree, hf_vtp_upd_id, tvb, offset, 4, ENC_BIG_ENDIAN);
173 offset += 4;
175 upd_timestamp = display = tvb_get_string_enc(pinfo->pool, tvb, offset, 12, ENC_ASCII);
176 if (sscanf(upd_timestamp, "%2d%2d%2d%2d%2d%2d", &yy, &mm, &dd, &hh, &_mm, &ss) == 6) {
177 display = wmem_strdup_printf(pinfo->pool, "%02d-%02d-%02d %02d:%02d:%02d",
178 yy, mm, dd, hh, _mm, ss);
180 proto_tree_add_string_format_value(vtp_tree, hf_vtp_upd_ts, tvb,
181 offset, 12, upd_timestamp, "%s", display);
182 offset += 12;
184 proto_tree_add_item(vtp_tree, hf_vtp_md5_digest, tvb, offset, 16, ENC_NA);
185 break;
187 case SUBSET_ADVERT:
188 proto_tree_add_item(vtp_tree, hf_vtp_seq_num, tvb, offset, 1, ENC_BIG_ENDIAN);
189 offset += 1;
191 proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
192 offset += 1;
194 proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII);
195 offset += 32;
197 proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num, tvb, offset, 4, ENC_BIG_ENDIAN);
198 offset += 4;
200 while (tvb_reported_length_remaining(tvb, offset) > 0) {
201 vlan_info_len =
202 dissect_vlan_info(tvb, pinfo, offset, vtp_tree);
203 if (vlan_info_len <= 0)
204 break;
205 offset += vlan_info_len;
207 break;
209 case ADVERT_REQUEST:
210 proto_tree_add_item(vtp_tree, hf_vtp_reserved, tvb, offset, 1, ENC_NA);
211 offset += 1;
213 proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
214 offset += 1;
216 proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII);
217 offset += 32;
219 proto_tree_add_item(vtp_tree, hf_vtp_start_value, tvb, offset, 2, ENC_BIG_ENDIAN);
220 break;
222 case JOIN_MSG:
223 proto_tree_add_item(vtp_tree, hf_vtp_reserved, tvb, offset, 1, ENC_NA);
224 offset += 1;
226 proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
227 offset += 1;
229 proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII);
230 offset += 32;
232 proto_tree_add_item(vtp_tree, hf_vtp_pruning_first_vid, tvb, offset, 2, ENC_BIG_ENDIAN);
233 pruning_vlan_id = tvb_get_ntohs(tvb, offset);
234 offset += 2;
236 proto_tree_add_item(vtp_tree, hf_vtp_pruning_last_vid, tvb, offset,
237 2, ENC_BIG_ENDIAN);
238 offset += 2;
240 vtp_pruning_tree = proto_tree_add_subtree(vtp_tree, tvb, offset, -1,
241 ett_vtp_pruning, NULL, "Advertised active (i.e. not pruned) VLANs");
243 while (tvb_reported_length_remaining(tvb, offset) > 0) {
244 uint8_t vlan_usage_bitmap;
245 int shift;
247 vlan_usage_bitmap = tvb_get_uint8(tvb, offset);
249 for (shift = 0; shift < 8; shift++) {
250 if (vlan_usage_bitmap & (1<<7)) {
251 proto_tree_add_uint(vtp_pruning_tree, hf_vtp_pruning_active_vid,
252 tvb, offset, 1, pruning_vlan_id);
255 pruning_vlan_id += 1;
256 vlan_usage_bitmap <<= 1;
259 offset += 1;
262 break;
264 return tvb_captured_length(tvb);
267 #define VLAN_SUSPENDED 0x01
269 static const value_string vlan_type_vals[] = {
270 { 0x01, "Ethernet" },
271 { 0x02, "FDDI" },
272 { 0x03, "TrCRF" },
273 { 0x04, "FDDI-net" },
274 { 0x05, "TrBRF" },
275 { 0, NULL },
278 #define SR_RING_NUM 0x01
279 #define SR_BRIDGE_NUM 0x02
280 #define STP_TYPE 0x03
281 #define PARENT_VLAN 0x04
282 #define TR_BRIDGED_VLANS 0x05
283 #define PRUNING 0x06
284 #define BRIDGE_TYPE 0x07
285 #define MAX_ARE_HOP_CNT 0x08
286 #define MAX_STE_HOP_CNT 0x09
287 #define BACKUP_CRF_MODE 0x0A
289 static const value_string vlan_tlv_type_vals[] = {
290 { SR_RING_NUM, "Source-Routing Ring Number" },
291 { SR_BRIDGE_NUM, "Source-Routing Bridge Number" },
292 { STP_TYPE, "Spanning-Tree Protocol Type" },
293 { PARENT_VLAN, "Parent VLAN" },
294 { TR_BRIDGED_VLANS, "Translationally Bridged VLANs" },
295 { PRUNING, "Pruning" },
296 { BRIDGE_TYPE, "Bridge Type" },
297 { MAX_ARE_HOP_CNT, "Max ARE Hop Count" },
298 { MAX_STE_HOP_CNT, "Max STE Hop Count" },
299 { BACKUP_CRF_MODE, "Backup CRF Mode" },
300 { 0, NULL },
303 static int
304 dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree)
306 proto_item *ti;
307 proto_tree *vlan_info_tree;
308 proto_tree *status_tree;
309 uint8_t vlan_info_len;
310 int vlan_info_left;
311 uint8_t status;
312 uint8_t vlan_name_len;
313 uint8_t type;
314 int length;
315 proto_tree *tlv_tree;
317 vlan_info_len = tvb_get_uint8(tvb, offset);
318 vlan_info_tree = proto_tree_add_subtree(tree, tvb, offset, vlan_info_len,
319 ett_vtp_vlan_info, NULL, "VLAN Information");
320 vlan_info_left = vlan_info_len;
322 proto_tree_add_uint(vlan_info_tree, hf_vtp_vlan_info_len, tvb, offset, 1,
323 vlan_info_len);
324 offset += 1;
325 vlan_info_left -= 1;
327 status = tvb_get_uint8(tvb, offset);
328 ti = proto_tree_add_uint(vlan_info_tree, hf_vtp_vlan_status, tvb, offset, 1, status);
329 if (status & VLAN_SUSPENDED)
330 proto_item_append_text(ti, " (VLAN suspended)");
331 status_tree = proto_item_add_subtree(ti, ett_vtp_vlan_status);
332 proto_tree_add_boolean(status_tree, hf_vtp_vlan_status_vlan_susp, tvb, offset, 1,
333 status);
334 offset += 1;
335 vlan_info_left -= 1;
337 proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_type, tvb, offset, 1, ENC_BIG_ENDIAN);
338 offset += 1;
339 vlan_info_left -= 1;
341 vlan_name_len = tvb_get_uint8(tvb, offset);
342 proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_name_len, tvb, offset, 1, ENC_BIG_ENDIAN);
343 offset += 1;
344 vlan_info_left -= 1;
346 proto_tree_add_item(vlan_info_tree, hf_vtp_isl_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
347 offset += 2;
348 vlan_info_left -= 2;
350 proto_tree_add_item(vlan_info_tree, hf_vtp_mtu_size, tvb, offset, 2, ENC_BIG_ENDIAN);
351 offset += 2;
352 vlan_info_left -= 2;
354 proto_tree_add_item(vlan_info_tree, hf_vtp_802_10_index, tvb, offset, 4, ENC_BIG_ENDIAN);
355 offset += 4;
356 vlan_info_left -= 4;
358 /* VLAN name length appears to be rounded up to a multiple of 4. */
359 vlan_name_len = 4*((vlan_name_len + 3)/4);
360 proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_name, tvb, offset, vlan_name_len, ENC_ASCII);
361 offset += vlan_name_len;
362 vlan_info_left -= vlan_name_len;
364 while (vlan_info_left > 0) {
365 type = tvb_get_uint8(tvb, offset + 0);
366 length = tvb_get_uint8(tvb, offset + 1);
368 tlv_tree = proto_tree_add_subtree(vlan_info_tree, tvb, offset,
369 2 + length*2, ett_vtp_tlv, &ti,
370 val_to_str(type, vlan_tlv_type_vals,
371 "Unknown TLV type: 0x%02x"));
372 proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvtype, tvb, offset, 1, ENC_BIG_ENDIAN);
373 proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvlength, tvb, offset+1, 1, ENC_BIG_ENDIAN);
374 offset += 2;
375 vlan_info_left -= 2;
376 if (length > 0) {
377 dissect_vlan_info_tlv(tvb, pinfo, offset, length*2, tlv_tree,
378 ti, type);
380 offset += length*2;
381 vlan_info_left -= length*2;
384 return vlan_info_len;
387 static const value_string stp_type_vals[] = {
388 { 1, "SRT" },
389 { 2, "SRB" },
390 { 3, "Auto" },
391 { 0, NULL },
394 static const value_string pruning_vals[] = {
395 { 1, "Enabled" },
396 { 2, "Disabled" },
397 { 0, NULL },
400 static const value_string bridge_type_vals[] = {
401 { 1, "SRT" },
402 { 2, "SRB" },
403 { 0, NULL },
406 static const value_string backup_crf_mode_vals[] = {
407 { 1, "TrCRF is configured as a backup" },
408 { 2, "TrCRF is not configured as a backup" },
409 { 0, NULL },
412 static void
413 dissect_vlan_info_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length,
414 proto_tree *tree, proto_item *ti, uint8_t type)
416 switch (type) {
418 case SR_RING_NUM:
419 if (length == 2) {
420 proto_tree_add_item(tree, hf_vtp_vlan_src_route_ring_num, tvb, offset, 2, ENC_BIG_ENDIAN);
421 } else {
422 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Source-Routing Ring Number: Bad length %u", length);
424 break;
426 case SR_BRIDGE_NUM:
427 if (length == 2) {
428 proto_tree_add_item(tree, hf_vtp_vlan_src_route_bridge_num, tvb, offset, 2, ENC_BIG_ENDIAN);
429 } else {
430 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Source-Routing Bridge Number: Bad length %u", length);
432 break;
434 case STP_TYPE:
435 if (length == 2) {
436 proto_tree_add_item(tree, hf_vtp_vlan_stp_type, tvb, offset, 2, ENC_BIG_ENDIAN);
437 } else {
438 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Spanning-Tree Protocol Type: Bad length %u", length);
440 break;
442 case PARENT_VLAN:
443 if (length == 2) {
444 proto_tree_add_item(tree, hf_vtp_vlan_parent_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
445 } else {
446 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Parent VLAN: Bad length %u", length);
448 break;
450 case TR_BRIDGED_VLANS:
451 if (length == 2) {
452 proto_tree_add_item(tree, hf_vtp_vlan_translationally_bridged_vlans, tvb, offset, 2, ENC_BIG_ENDIAN);
453 } else {
454 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Translationally Bridged VLANs: Bad length %u", length);
456 break;
458 case PRUNING:
459 if (length == 2) {
460 proto_tree_add_item(tree, hf_vtp_vlan_pruning, tvb, offset, 2, ENC_BIG_ENDIAN);
461 } else {
462 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Pruning: Bad length %u", length);
464 break;
466 case BRIDGE_TYPE:
467 if (length == 2) {
468 proto_tree_add_item(tree, hf_vtp_vlan_bridge_type, tvb, offset, 2, ENC_BIG_ENDIAN);
469 } else {
470 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Bridge Type: Bad length %u", length);
472 break;
474 case MAX_ARE_HOP_CNT:
475 if (length == 2) {
476 proto_tree_add_item(tree, hf_vtp_vlan_max_are_hop_count, tvb, offset, 2, ENC_BIG_ENDIAN);
477 } else {
478 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Max ARE Hop Count: Bad length %u", length);
480 break;
482 case MAX_STE_HOP_CNT:
483 if (length == 2) {
484 proto_tree_add_item(tree, hf_vtp_vlan_max_ste_hop_count, tvb, offset, 2, ENC_BIG_ENDIAN);
485 } else {
486 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Max STE Hop Count: Bad length %u", length);
488 break;
490 case BACKUP_CRF_MODE:
491 if (length == 2) {
492 proto_tree_add_item(tree, hf_vtp_vlan_backup_crf_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
493 } else {
494 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Backup CRF Mode: Bad length %u", length);
496 break;
498 default:
499 proto_tree_add_item(tree, hf_vtp_vlan_data, tvb, offset, length, ENC_NA);
500 break;
504 void
505 proto_register_vtp(void)
507 static hf_register_info hf[] = {
508 { &hf_vtp_version,
509 { "Version", "vtp.version", FT_UINT8, BASE_HEX, NULL, 0x0,
510 NULL, HFILL }},
512 { &hf_vtp_code,
513 { "Code", "vtp.code", FT_UINT8, BASE_HEX, VALS(type_vals), 0x0,
514 NULL, HFILL }},
516 { &hf_vtp_followers,
517 { "Followers", "vtp.followers", FT_UINT8, BASE_DEC, NULL, 0x0,
518 "Number of following Subset-Advert messages", HFILL }},
520 { &hf_vtp_md_len,
521 { "Management Domain Length", "vtp.md_len", FT_UINT8, BASE_DEC, NULL, 0x0,
522 "Length of management domain string", HFILL }},
524 { &hf_vtp_md,
525 { "Management Domain", "vtp.md", FT_STRING, BASE_NONE, NULL, 0,
526 NULL, HFILL }},
528 { &hf_vtp_conf_rev_num,
529 { "Configuration Revision Number", "vtp.conf_rev_num", FT_UINT32, BASE_DEC, NULL, 0x0,
530 "Revision number of the configuration information", HFILL }},
532 { &hf_vtp_upd_id,
533 { "Updater Identity", "vtp.upd_id", FT_IPv4, BASE_NONE, NULL, 0x0,
534 "IP address of the updater", HFILL }},
536 { &hf_vtp_upd_ts,
537 { "Update Timestamp", "vtp.upd_ts", FT_STRING, BASE_NONE, NULL, 0,
538 "Time stamp of the current configuration revision", HFILL }},
540 { &hf_vtp_md5_digest,
541 { "MD5 Digest", "vtp.md5_digest", FT_BYTES, BASE_NONE, NULL, 0x0,
542 NULL, HFILL }},
544 { &hf_vtp_seq_num,
545 { "Sequence Number", "vtp.seq_num", FT_UINT8, BASE_DEC, NULL, 0x0,
546 "Order of this frame in the sequence of Subset-Advert frames", HFILL }},
548 { &hf_vtp_start_value,
549 { "Start Value", "vtp.start_value", FT_UINT16, BASE_HEX, NULL, 0x0,
550 "Virtual LAN ID of first VLAN for which information is requested", HFILL }},
552 { &hf_vtp_vlan_info_len,
553 { "VLAN Information Length", "vtp.vlan_info.len", FT_UINT8, BASE_DEC, NULL, 0x0,
554 "Length of the VLAN information field", HFILL }},
556 { &hf_vtp_vlan_status,
557 { "Status", "vtp.vlan_info.status", FT_UINT8, BASE_HEX, NULL, 0x0,
558 NULL, HFILL }},
560 { &hf_vtp_vlan_status_vlan_susp,
561 { "VLAN suspended", "vtp.vlan_info.status.vlan_susp", FT_BOOLEAN, 8, NULL, VLAN_SUSPENDED,
562 NULL, HFILL }},
564 { &hf_vtp_vlan_type,
565 { "VLAN Type", "vtp.vlan_info.vlan_type", FT_UINT8, BASE_HEX, VALS(vlan_type_vals), 0x0,
566 "Type of VLAN", HFILL }},
568 { &hf_vtp_vlan_name_len,
569 { "VLAN Name Length", "vtp.vlan_info.vlan_name_len", FT_UINT8, BASE_DEC, NULL, 0x0,
570 "Length of VLAN name string", HFILL }},
572 { &hf_vtp_isl_vlan_id,
573 { "ISL VLAN ID", "vtp.vlan_info.isl_vlan_id", FT_UINT16, BASE_HEX, NULL, 0x0,
574 "ID of this VLAN on ISL trunks", HFILL }},
576 { &hf_vtp_mtu_size,
577 { "MTU Size", "vtp.vlan_info.mtu_size", FT_UINT16, BASE_DEC, NULL, 0x0,
578 "MTU for this VLAN", HFILL }},
580 { &hf_vtp_802_10_index,
581 { "802.10 Index", "vtp.vlan_info.802_10_index", FT_UINT32, BASE_HEX, NULL, 0x0,
582 "IEEE 802.10 security association identifier for this VLAN", HFILL }},
584 { &hf_vtp_vlan_name,
585 { "VLAN Name", "vtp.vlan_info.vlan_name", FT_STRING, BASE_NONE, NULL, 0,
586 NULL, HFILL }},
588 { &hf_vtp_vlan_tlvtype,
589 { "Type", "vtp.vlan_info.tlv_type", FT_UINT8, BASE_HEX, VALS(vlan_tlv_type_vals), 0x0,
590 NULL, HFILL }},
592 { &hf_vtp_vlan_tlvlength,
593 { "Length", "vtp.vlan_info.tlv_len", FT_UINT8, BASE_DEC, NULL, 0x0,
594 NULL, HFILL }},
596 { &hf_vtp_pruning_first_vid,
597 { "First VLAN ID", "vtp.pruning.first", FT_UINT16, BASE_DEC, NULL, 0x0,
598 "First VLAN ID for which pruning information is present", HFILL }},
600 { &hf_vtp_pruning_last_vid,
601 { "Last VLAN ID", "vtp.pruning.last", FT_UINT16, BASE_DEC, NULL, 0x0,
602 "Last VLAN ID for which pruning information is present", HFILL }},
604 { &hf_vtp_pruning_active_vid,
605 { "VLAN", "vtp.pruning.active", FT_UINT16, BASE_DEC, NULL, 0x0,
606 "Active advertised VLAN ID", HFILL }},
608 { &hf_vtp_vlan_src_route_ring_num,
609 { "Source-Routing Ring Number", "vtp.vlan_info.src_route_ring_num", FT_UINT16, BASE_HEX, NULL, 0x0,
610 NULL, HFILL }},
612 { &hf_vtp_vlan_src_route_bridge_num,
613 { "Source-Routing Bridge Number", "vtp.vlan_info.src_route_bridge_num", FT_UINT16, BASE_HEX, NULL, 0x0,
614 NULL, HFILL }},
616 { &hf_vtp_vlan_stp_type,
617 { "Spanning-Tree Protocol Type", "vtp.vlan_info.stp_type", FT_UINT16, BASE_HEX, VALS(stp_type_vals), 0x0,
618 NULL, HFILL }},
620 { &hf_vtp_vlan_parent_vlan,
621 { "Parent VLAN", "vtp.vlan_info.parent_vlan", FT_UINT16, BASE_HEX, NULL, 0x0,
622 NULL, HFILL }},
624 { &hf_vtp_vlan_translationally_bridged_vlans,
625 { "Translationally Bridged VLANs", "vtp.vlan_info.translationally_bridged_vlans", FT_UINT16, BASE_HEX, NULL, 0x0,
626 NULL, HFILL }},
628 { &hf_vtp_vlan_pruning,
629 { "Pruning", "vtp.vlan_info.pruning", FT_UINT16, BASE_HEX, VALS(pruning_vals), 0x0,
630 NULL, HFILL }},
632 { &hf_vtp_vlan_bridge_type,
633 { "Bridge Type", "vtp.vlan_info.bridge_type", FT_UINT16, BASE_HEX, VALS(bridge_type_vals), 0x0,
634 NULL, HFILL }},
636 { &hf_vtp_vlan_max_are_hop_count,
637 { "Max ARE Hop Count", "vtp.vlan_info.max_are_hop_count", FT_UINT16, BASE_DEC, NULL, 0x0,
638 NULL, HFILL }},
640 { &hf_vtp_vlan_max_ste_hop_count,
641 { "Max STE Hop Count", "vtp.vlan_info.max_ste_hop_count", FT_UINT16, BASE_DEC, NULL, 0x0,
642 NULL, HFILL }},
644 { &hf_vtp_vlan_backup_crf_mode,
645 { "Backup CRF Mode", "vtp.vlan_info.backup_crf_mode", FT_UINT16, BASE_HEX, VALS(backup_crf_mode_vals), 0x0,
646 NULL, HFILL }},
648 { &hf_vtp_vlan_data,
649 { "Data", "vtp.vlan_info.data", FT_BYTES, BASE_NONE, NULL, 0x0,
650 NULL, HFILL }},
652 { &hf_vtp_reserved,
653 { "Reserved", "vtp.reserved", FT_BYTES, BASE_NONE, NULL, 0,
654 NULL, HFILL }},
657 static int *ett[] = {
658 &ett_vtp,
659 &ett_vtp_vlan_info,
660 &ett_vtp_vlan_status,
661 &ett_vtp_tlv,
662 &ett_vtp_pruning,
665 static ei_register_info ei[] = {
666 { &ei_vtp_vlan_tlvlength_bad, { "vtp.vlan_info.tlv_len.bad", PI_PROTOCOL, PI_WARN, "Bad length for TLV length", EXPFILL }},
669 expert_module_t* expert_vtp;
671 proto_vtp = proto_register_protocol("VLAN Trunking Protocol", "VTP", "vtp");
672 proto_register_field_array(proto_vtp, hf, array_length(hf));
673 proto_register_subtree_array(ett, array_length(ett));
674 expert_vtp = expert_register_protocol(proto_vtp);
675 expert_register_field_array(expert_vtp, ei, array_length(ei));
676 vtp_handle = register_dissector("vtp", dissect_vtp, proto_vtp);
679 void
680 proto_reg_handoff_vtp(void)
682 dissector_add_uint("llc.cisco_pid", CISCO_PID_VTP, vtp_handle);
686 * Editor modelines - https://www.wireshark.org/tools/modelines.html
688 * Local variables:
689 * c-basic-offset: 8
690 * tab-width: 8
691 * indent-tabs-mode: t
692 * End:
694 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
695 * :indentSize=8:tabSize=8:noTabs=false: