HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-vtp.c
blobef476ed492b55dfcab3e17b1f387838706927f92
1 /* packet-vtp.c
2 * Routines for the disassembly of Cisco's VLAN Trunking Protocol
4 * $Id$
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "config.h"
27 #include <glib.h>
29 #include <epan/packet.h>
30 #include <epan/expert.h>
33 * See
35 * http://www.cisco.com/en/US/tech/tk389/tk689/technologies_tech_note09186a0080094c52.shtml
37 * for some information on VTP.
40 static int proto_vtp = -1;
41 static int hf_vtp_version = -1;
42 static int hf_vtp_code = -1;
43 static int hf_vtp_followers = -1;
44 static int hf_vtp_md_len = -1;
45 static int hf_vtp_md = -1;
46 static int hf_vtp_conf_rev_num = -1;
47 static int hf_vtp_upd_id = -1;
48 static int hf_vtp_upd_ts = -1;
49 static int hf_vtp_md5_digest = -1;
50 static int hf_vtp_seq_num = -1;
51 static int hf_vtp_start_value = -1;
52 static int hf_vtp_vlan_info_len = -1;
53 static int hf_vtp_vlan_status_vlan_susp = -1;
54 static int hf_vtp_vlan_type = -1;
55 static int hf_vtp_vlan_name_len = -1;
56 static int hf_vtp_isl_vlan_id = -1;
57 static int hf_vtp_mtu_size = -1;
58 static int hf_vtp_802_10_index = -1;
59 static int hf_vtp_vlan_name = -1;
60 static int hf_vtp_vlan_tlvtype = -1;
61 static int hf_vtp_vlan_tlvlength = -1;
62 static int hf_vtp_pruning_first_vid = -1;
63 static int hf_vtp_pruning_last_vid = -1;
64 static int hf_vtp_pruning_active_vid = -1;
65 static int hf_vtp_vlan_src_route_ring_num = -1;
66 static int hf_vtp_vlan_src_route_bridge_num = -1;
67 static int hf_vtp_vlan_stp_type = -1;
68 static int hf_vtp_vlan_parent_vlan = -1;
69 static int hf_vtp_vlan_translationally_bridged_vlans = -1;
70 static int hf_vtp_vlan_pruning = -1;
71 static int hf_vtp_vlan_bridge_type = -1;
72 static int hf_vtp_vlan_max_are_hop_count = -1;
73 static int hf_vtp_vlan_max_ste_hop_count = -1;
74 static int hf_vtp_vlan_backup_crf_mode = -1;
76 static gint ett_vtp = -1;
77 static gint ett_vtp_vlan_info = -1;
78 static gint ett_vtp_vlan_status = -1;
79 static gint ett_vtp_tlv = -1;
80 static gint ett_vtp_pruning = -1;
82 static expert_field ei_vtp_vlan_tlvlength_bad = EI_INIT;
84 static int
85 dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree);
86 static void
87 dissect_vlan_info_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length,
88 proto_tree *tree, proto_item *ti, guint8 type);
90 #define SUMMARY_ADVERT 0x01
91 #define SUBSET_ADVERT 0x02
92 #define ADVERT_REQUEST 0x03
93 #define JOIN_MSG 0x04
95 static const value_string type_vals[] = {
96 { SUMMARY_ADVERT, "Summary Advertisement" },
97 { SUBSET_ADVERT, "Subset Advertisement" },
98 { ADVERT_REQUEST, "Advertisement Request" },
99 { JOIN_MSG, "Join/Prune Message" },
100 { 0, NULL },
103 static void
104 set_vtp_info_col(tvbuff_t *tvb, packet_info *pinfo)
106 switch (tvb_get_guint8(tvb, 1)) {
108 case SUMMARY_ADVERT:
109 col_add_fstr(pinfo->cinfo, COL_INFO,
110 "Summary Advertisement, Revision: %u", tvb_get_ntohl(tvb, 36));
112 if (tvb_get_guint8(tvb, 2) > 0) {
113 col_append_fstr(pinfo->cinfo, COL_INFO,
114 ", Followers: %u", tvb_get_guint8(tvb, 2));
117 break;
119 case SUBSET_ADVERT:
120 col_add_fstr(pinfo->cinfo, COL_INFO,
121 "Subset Advertisement, Revision: %u, Seq: %u",
122 tvb_get_ntohl(tvb, 36), tvb_get_guint8(tvb, 2));
123 break;
125 case ADVERT_REQUEST:
126 col_set_str(pinfo->cinfo, COL_INFO, "Advertisement Request");
127 break;
129 case JOIN_MSG:
130 col_set_str(pinfo->cinfo, COL_INFO, "Join");
131 break;
133 default:
134 col_set_str(pinfo->cinfo, COL_INFO, "Unrecognized VTP message");
135 break;
139 static void
140 dissect_vtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
142 proto_item *ti;
143 proto_tree *vtp_tree = NULL, *vtp_pruning_tree = NULL;
144 int offset = 0;
145 guint8 code;
146 guint8 *upd_timestamp;
147 int vlan_info_len;
148 int pruning_vlan_id;
150 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VTP");
151 set_vtp_info_col(tvb, pinfo);
153 ti = proto_tree_add_item(tree, proto_vtp, tvb, offset, -1, ENC_NA);
154 vtp_tree = proto_item_add_subtree(ti, ett_vtp);
156 proto_tree_add_item(vtp_tree, hf_vtp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
157 offset += 1;
159 code = tvb_get_guint8(tvb, offset);
160 proto_tree_add_item(vtp_tree, hf_vtp_code, tvb, offset, 1, ENC_BIG_ENDIAN);
161 offset += 1;
163 switch (code) {
165 case SUMMARY_ADVERT:
166 proto_tree_add_item(vtp_tree, hf_vtp_followers, tvb, offset, 1, ENC_BIG_ENDIAN);
167 offset += 1;
169 proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
170 offset += 1;
172 proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII|ENC_NA);
173 offset += 32;
175 proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num, tvb, offset, 4, ENC_BIG_ENDIAN);
176 offset += 4;
178 proto_tree_add_item(vtp_tree, hf_vtp_upd_id, tvb, offset, 4, ENC_BIG_ENDIAN);
179 offset += 4;
181 upd_timestamp = tvb_get_string(wmem_packet_scope(), tvb, offset, 12);
182 proto_tree_add_string_format_value(vtp_tree, hf_vtp_upd_ts, tvb,
183 offset, 12, (gchar*)upd_timestamp,
184 "%.2s-%.2s-%.2s %.2s:%.2s:%.2s",
185 &upd_timestamp[0], &upd_timestamp[2], &upd_timestamp[4],
186 &upd_timestamp[6], &upd_timestamp[8], &upd_timestamp[10]);
187 offset += 12;
189 proto_tree_add_item(vtp_tree, hf_vtp_md5_digest, tvb, offset, 16, ENC_NA);
190 break;
192 case SUBSET_ADVERT:
193 proto_tree_add_item(vtp_tree, hf_vtp_seq_num, tvb, offset, 1, ENC_BIG_ENDIAN);
194 offset += 1;
196 proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
197 offset += 1;
199 proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII|ENC_NA);
200 offset += 32;
202 proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num, tvb, offset, 4, ENC_BIG_ENDIAN);
203 offset += 4;
205 while (tvb_reported_length_remaining(tvb, offset) > 0) {
206 vlan_info_len =
207 dissect_vlan_info(tvb, pinfo, offset, vtp_tree);
208 if (vlan_info_len <= 0)
209 break;
210 offset += vlan_info_len;
212 break;
214 case ADVERT_REQUEST:
215 offset += 1; /* skip reserved field */
217 proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
218 offset += 1;
220 proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII|ENC_NA);
221 offset += 32;
223 proto_tree_add_item(vtp_tree, hf_vtp_start_value, tvb, offset, 2, ENC_BIG_ENDIAN);
224 break;
226 case JOIN_MSG:
227 offset += 1; /* skip reserved/unused field */
229 proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
230 offset += 1;
232 proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII|ENC_NA);
233 offset += 32;
235 proto_tree_add_item(vtp_tree, hf_vtp_pruning_first_vid, tvb, offset, 2, ENC_BIG_ENDIAN);
236 pruning_vlan_id = tvb_get_ntohs(tvb, offset);
237 offset += 2;
239 proto_tree_add_item(vtp_tree, hf_vtp_pruning_last_vid, tvb, offset,
240 2, ENC_BIG_ENDIAN);
241 offset += 2;
243 ti = proto_tree_add_text (vtp_tree, tvb, offset, -1,
244 "Advertised active (i.e. not pruned) VLANs");
245 vtp_pruning_tree = proto_item_add_subtree(ti, ett_vtp_pruning);
247 while (tvb_reported_length_remaining(tvb, offset) > 0) {
248 guint8 vlan_usage_bitmap;
249 int shift;
251 vlan_usage_bitmap = tvb_get_guint8(tvb, offset);
253 for (shift = 0; shift < 8; shift++) {
254 if (vlan_usage_bitmap & (1<<7)) {
255 proto_tree_add_uint(vtp_pruning_tree, hf_vtp_pruning_active_vid,
256 tvb, offset, 1, pruning_vlan_id);
259 pruning_vlan_id += 1;
260 vlan_usage_bitmap <<= 1;
263 offset += 1;
266 break;
270 #define VLAN_SUSPENDED 0x01
272 static const value_string vlan_type_vals[] = {
273 { 0x01, "Ethernet" },
274 { 0x02, "FDDI" },
275 { 0x03, "TrCRF" },
276 { 0x04, "FDDI-net" },
277 { 0x05, "TrBRF" },
278 { 0, NULL },
281 #define SR_RING_NUM 0x01
282 #define SR_BRIDGE_NUM 0x02
283 #define STP_TYPE 0x03
284 #define PARENT_VLAN 0x04
285 #define TR_BRIDGED_VLANS 0x05
286 #define PRUNING 0x06
287 #define BRIDGE_TYPE 0x07
288 #define MAX_ARE_HOP_CNT 0x08
289 #define MAX_STE_HOP_CNT 0x09
290 #define BACKUP_CRF_MODE 0x0A
292 static const value_string vlan_tlv_type_vals[] = {
293 { SR_RING_NUM, "Source-Routing Ring Number" },
294 { SR_BRIDGE_NUM, "Source-Routing Bridge Number" },
295 { STP_TYPE, "Spanning-Tree Protocol Type" },
296 { PARENT_VLAN, "Parent VLAN" },
297 { TR_BRIDGED_VLANS, "Translationally Bridged VLANs" },
298 { PRUNING, "Pruning" },
299 { BRIDGE_TYPE, "Bridge Type" },
300 { MAX_ARE_HOP_CNT, "Max ARE Hop Count" },
301 { MAX_STE_HOP_CNT, "Max STE Hop Count" },
302 { BACKUP_CRF_MODE, "Backup CRF Mode" },
303 { 0, NULL },
306 static int
307 dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree)
309 proto_item *ti;
310 proto_tree *vlan_info_tree;
311 proto_tree *status_tree;
312 guint8 vlan_info_len;
313 int vlan_info_left;
314 guint8 status;
315 guint8 vlan_name_len;
316 guint8 type;
317 int length;
318 proto_tree *tlv_tree;
320 vlan_info_len = tvb_get_guint8(tvb, offset);
321 ti = proto_tree_add_text(tree, tvb, offset, vlan_info_len,
322 "VLAN Information");
323 vlan_info_tree = proto_item_add_subtree(ti, ett_vtp_vlan_info);
324 vlan_info_left = vlan_info_len;
326 proto_tree_add_uint(vlan_info_tree, hf_vtp_vlan_info_len, tvb, offset, 1,
327 vlan_info_len);
328 offset += 1;
329 vlan_info_left -= 1;
331 status = tvb_get_guint8(tvb, offset);
332 ti = proto_tree_add_text(vlan_info_tree, tvb, offset, 1,
333 "Status: 0x%02x%s", status,
334 (status & VLAN_SUSPENDED) ? "(VLAN suspended)" : "");
335 status_tree = proto_item_add_subtree(ti, ett_vtp_vlan_status);
336 proto_tree_add_boolean(status_tree, hf_vtp_vlan_status_vlan_susp, tvb, offset, 1,
337 status);
338 offset += 1;
339 vlan_info_left -= 1;
341 proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_type, tvb, offset, 1, ENC_BIG_ENDIAN);
342 offset += 1;
343 vlan_info_left -= 1;
345 vlan_name_len = tvb_get_guint8(tvb, offset);
346 proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_name_len, tvb, offset, 1, ENC_BIG_ENDIAN);
347 offset += 1;
348 vlan_info_left -= 1;
350 proto_tree_add_item(vlan_info_tree, hf_vtp_isl_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
351 offset += 2;
352 vlan_info_left -= 2;
354 proto_tree_add_item(vlan_info_tree, hf_vtp_mtu_size, tvb, offset, 2, ENC_BIG_ENDIAN);
355 offset += 2;
356 vlan_info_left -= 2;
358 proto_tree_add_item(vlan_info_tree, hf_vtp_802_10_index, tvb, offset, 4, ENC_BIG_ENDIAN);
359 offset += 4;
360 vlan_info_left -= 4;
362 /* VLAN name length appears to be rounded up to a multiple of 4. */
363 vlan_name_len = 4*((vlan_name_len + 3)/4);
364 proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_name, tvb, offset, vlan_name_len, ENC_ASCII|ENC_NA);
365 offset += vlan_name_len;
366 vlan_info_left -= vlan_name_len;
368 while (vlan_info_left > 0) {
369 type = tvb_get_guint8(tvb, offset + 0);
370 length = tvb_get_guint8(tvb, offset + 1);
372 ti = proto_tree_add_text(vlan_info_tree, tvb, offset,
373 2 + length*2, "%s",
374 val_to_str(type, vlan_tlv_type_vals,
375 "Unknown TLV type: 0x%02x"));
376 tlv_tree = proto_item_add_subtree(ti, ett_vtp_tlv);
377 proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvtype, tvb, offset, 1, ENC_BIG_ENDIAN);
378 proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvlength, tvb, offset+1, 1, ENC_BIG_ENDIAN);
379 offset += 2;
380 vlan_info_left -= 2;
381 if (length > 0) {
382 dissect_vlan_info_tlv(tvb, pinfo, offset, length*2, tlv_tree,
383 ti, type);
385 offset += length*2;
386 vlan_info_left -= length*2;
389 return vlan_info_len;
392 static const value_string stp_type_vals[] = {
393 { 1, "SRT" },
394 { 2, "SRB" },
395 { 3, "Auto" },
396 { 0, NULL },
399 static const value_string pruning_vals[] = {
400 { 1, "Enabled" },
401 { 2, "Disabled" },
402 { 0, NULL },
405 static const value_string bridge_type_vals[] = {
406 { 1, "SRT" },
407 { 2, "SRB" },
408 { 0, NULL },
411 static const value_string backup_crf_mode_vals[] = {
412 { 1, "TrCRF is configured as a backup" },
413 { 2, "TrCRF is not configured as a backup" },
414 { 0, NULL },
417 static void
418 dissect_vlan_info_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length,
419 proto_tree *tree, proto_item *ti, guint8 type)
421 switch (type) {
423 case SR_RING_NUM:
424 if (length == 2) {
425 proto_tree_add_item(tree, hf_vtp_vlan_src_route_ring_num, tvb, offset, 2, ENC_BIG_ENDIAN);
426 } else {
427 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Source-Routing Ring Number: Bad length %u", length);
429 break;
431 case SR_BRIDGE_NUM:
432 if (length == 2) {
433 proto_tree_add_item(tree, hf_vtp_vlan_src_route_bridge_num, tvb, offset, 2, ENC_BIG_ENDIAN);
434 } else {
435 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Source-Routing Bridge Number: Bad length %u", length);
437 break;
439 case STP_TYPE:
440 if (length == 2) {
441 proto_tree_add_item(tree, hf_vtp_vlan_stp_type, tvb, offset, 2, ENC_BIG_ENDIAN);
442 } else {
443 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Spanning-Tree Protocol Type: Bad length %u", length);
445 break;
447 case PARENT_VLAN:
448 if (length == 2) {
449 proto_tree_add_item(tree, hf_vtp_vlan_parent_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
450 } else {
451 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Parent VLAN: Bad length %u", length);
453 break;
455 case TR_BRIDGED_VLANS:
456 if (length == 2) {
457 proto_tree_add_item(tree, hf_vtp_vlan_translationally_bridged_vlans, tvb, offset, 2, ENC_BIG_ENDIAN);
458 } else {
459 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Translationally Bridged VLANs: Bad length %u", length);
461 break;
463 case PRUNING:
464 if (length == 2) {
465 proto_tree_add_item(tree, hf_vtp_vlan_pruning, tvb, offset, 2, ENC_BIG_ENDIAN);
466 } else {
467 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Pruning: Bad length %u", length);
469 break;
471 case BRIDGE_TYPE:
472 if (length == 2) {
473 proto_tree_add_item(tree, hf_vtp_vlan_bridge_type, tvb, offset, 2, ENC_BIG_ENDIAN);
474 } else {
475 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Bridge Type: Bad length %u", length);
477 break;
479 case MAX_ARE_HOP_CNT:
480 if (length == 2) {
481 proto_tree_add_item(tree, hf_vtp_vlan_max_are_hop_count, tvb, offset, 2, ENC_BIG_ENDIAN);
482 } else {
483 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Max ARE Hop Count: Bad length %u", length);
485 break;
487 case MAX_STE_HOP_CNT:
488 if (length == 2) {
489 proto_tree_add_item(tree, hf_vtp_vlan_max_ste_hop_count, tvb, offset, 2, ENC_BIG_ENDIAN);
490 } else {
491 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Max STE Hop Count: Bad length %u", length);
493 break;
495 case BACKUP_CRF_MODE:
496 if (length == 2) {
497 proto_tree_add_item(tree, hf_vtp_vlan_backup_crf_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
498 } else {
499 expert_add_info_format(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Backup CRF Mode: Bad length %u", length);
501 break;
503 default:
504 proto_tree_add_text(tree, tvb, offset, length, "Data");
505 break;
509 void
510 proto_register_vtp(void)
512 static hf_register_info hf[] = {
513 { &hf_vtp_version,
514 { "Version", "vtp.version", FT_UINT8, BASE_HEX, NULL, 0x0,
515 NULL, HFILL }},
517 { &hf_vtp_code,
518 { "Code", "vtp.code", FT_UINT8, BASE_HEX, VALS(type_vals), 0x0,
519 NULL, HFILL }},
521 { &hf_vtp_followers,
522 { "Followers", "vtp.followers", FT_UINT8, BASE_DEC, NULL, 0x0,
523 "Number of following Subset-Advert messages", HFILL }},
525 { &hf_vtp_md_len,
526 { "Management Domain Length", "vtp.md_len", FT_UINT8, BASE_DEC, NULL, 0x0,
527 "Length of management domain string", HFILL }},
529 { &hf_vtp_md,
530 { "Management Domain", "vtp.md", FT_STRING, BASE_NONE, NULL, 0,
531 NULL, HFILL }},
533 { &hf_vtp_conf_rev_num,
534 { "Configuration Revision Number", "vtp.conf_rev_num", FT_UINT32, BASE_DEC, NULL, 0x0,
535 "Revision number of the configuration information", HFILL }},
537 { &hf_vtp_upd_id,
538 { "Updater Identity", "vtp.upd_id", FT_IPv4, BASE_NONE, NULL, 0x0,
539 "IP address of the updater", HFILL }},
541 { &hf_vtp_upd_ts,
542 { "Update Timestamp", "vtp.upd_ts", FT_STRING, BASE_NONE, NULL, 0,
543 "Time stamp of the current configuration revision", HFILL }},
545 { &hf_vtp_md5_digest,
546 { "MD5 Digest", "vtp.md5_digest", FT_BYTES, BASE_NONE, NULL, 0x0,
547 NULL, HFILL }},
549 { &hf_vtp_seq_num,
550 { "Sequence Number", "vtp.seq_num", FT_UINT8, BASE_DEC, NULL, 0x0,
551 "Order of this frame in the sequence of Subset-Advert frames", HFILL }},
553 { &hf_vtp_start_value,
554 { "Start Value", "vtp.start_value", FT_UINT16, BASE_HEX, NULL, 0x0,
555 "Virtual LAN ID of first VLAN for which information is requested", HFILL }},
557 { &hf_vtp_vlan_info_len,
558 { "VLAN Information Length", "vtp.vlan_info.len", FT_UINT8, BASE_DEC, NULL, 0x0,
559 "Length of the VLAN information field", HFILL }},
561 { &hf_vtp_vlan_status_vlan_susp,
562 { "VLAN suspended", "vtp.vlan_info.status.vlan_susp", FT_BOOLEAN, 8, NULL, VLAN_SUSPENDED,
563 NULL, HFILL }},
565 { &hf_vtp_vlan_type,
566 { "VLAN Type", "vtp.vlan_info.vlan_type", FT_UINT8, BASE_HEX, VALS(vlan_type_vals), 0x0,
567 "Type of VLAN", HFILL }},
569 { &hf_vtp_vlan_name_len,
570 { "VLAN Name Length", "vtp.vlan_info.vlan_name_len", FT_UINT8, BASE_DEC, NULL, 0x0,
571 "Length of VLAN name string", HFILL }},
573 { &hf_vtp_isl_vlan_id,
574 { "ISL VLAN ID", "vtp.vlan_info.isl_vlan_id", FT_UINT16, BASE_HEX, NULL, 0x0,
575 "ID of this VLAN on ISL trunks", HFILL }},
577 { &hf_vtp_mtu_size,
578 { "MTU Size", "vtp.vlan_info.mtu_size", FT_UINT16, BASE_DEC, NULL, 0x0,
579 "MTU for this VLAN", HFILL }},
581 { &hf_vtp_802_10_index,
582 { "802.10 Index", "vtp.vlan_info.802_10_index", FT_UINT32, BASE_HEX, NULL, 0x0,
583 "IEEE 802.10 security association identifier for this VLAN", HFILL }},
585 { &hf_vtp_vlan_name,
586 { "VLAN Name", "vtp.vlan_info.vlan_name", FT_STRING, BASE_NONE, NULL, 0,
587 NULL, HFILL }},
589 { &hf_vtp_vlan_tlvtype,
590 { "Type", "vtp.vlan_info.tlv_type", FT_UINT8, BASE_HEX, VALS(vlan_tlv_type_vals), 0x0,
591 NULL, HFILL }},
593 { &hf_vtp_vlan_tlvlength,
594 { "Length", "vtp.vlan_info.tlv_len", FT_UINT8, BASE_DEC, NULL, 0x0,
595 NULL, HFILL }},
597 { &hf_vtp_pruning_first_vid,
598 { "First VLAN ID", "vtp.pruning.first", FT_UINT16, BASE_DEC, NULL, 0x0,
599 "First VLAN ID for which pruning information is present", HFILL }},
601 { &hf_vtp_pruning_last_vid,
602 { "Last VLAN ID", "vtp.pruning.last", FT_UINT16, BASE_DEC, NULL, 0x0,
603 "Last VLAN ID for which pruning information is present", HFILL }},
605 { &hf_vtp_pruning_active_vid,
606 { "VLAN", "vtp.pruning.active", FT_UINT16, BASE_DEC, NULL, 0x0,
607 "Active advertised VLAN ID", HFILL }},
609 { &hf_vtp_vlan_src_route_ring_num,
610 { "Source-Routing Ring Number", "vtp.vlan_info.src_route_ring_num", FT_UINT16, BASE_HEX, NULL, 0x0,
611 NULL, HFILL }},
613 { &hf_vtp_vlan_src_route_bridge_num,
614 { "Source-Routing Bridge Number", "vtp.vlan_info.src_route_bridge_num", FT_UINT16, BASE_HEX, NULL, 0x0,
615 NULL, HFILL }},
617 { &hf_vtp_vlan_stp_type,
618 { "Spanning-Tree Protocol Type", "vtp.vlan_info.stp_type", FT_UINT16, BASE_HEX, VALS(stp_type_vals), 0x0,
619 NULL, HFILL }},
621 { &hf_vtp_vlan_parent_vlan,
622 { "Parent VLAN", "vtp.vlan_info.parent_vlan", FT_UINT16, BASE_HEX, NULL, 0x0,
623 NULL, HFILL }},
625 { &hf_vtp_vlan_translationally_bridged_vlans,
626 { "Translationally Bridged VLANs", "vtp.vlan_info.translationally_bridged_vlans", FT_UINT16, BASE_HEX, NULL, 0x0,
627 NULL, HFILL }},
629 { &hf_vtp_vlan_pruning,
630 { "Pruning", "vtp.vlan_info.pruning", FT_UINT16, BASE_HEX, VALS(pruning_vals), 0x0,
631 NULL, HFILL }},
633 { &hf_vtp_vlan_bridge_type,
634 { "Bridge Type", "vtp.vlan_info.bridge_type", FT_UINT16, BASE_HEX, VALS(bridge_type_vals), 0x0,
635 NULL, HFILL }},
637 { &hf_vtp_vlan_max_are_hop_count,
638 { "Max ARE Hop Count", "vtp.vlan_info.max_are_hop_count", FT_UINT16, BASE_DEC, NULL, 0x0,
639 NULL, HFILL }},
641 { &hf_vtp_vlan_max_ste_hop_count,
642 { "Max STE Hop Count", "vtp.vlan_info.max_ste_hop_count", FT_UINT16, BASE_DEC, NULL, 0x0,
643 NULL, HFILL }},
645 { &hf_vtp_vlan_backup_crf_mode,
646 { "Backup CRF Mode", "vtp.vlan_info.backup_crf_mode", FT_UINT16, BASE_HEX, VALS(backup_crf_mode_vals), 0x0,
647 NULL, HFILL }},
649 static gint *ett[] = {
650 &ett_vtp,
651 &ett_vtp_vlan_info,
652 &ett_vtp_vlan_status,
653 &ett_vtp_tlv,
654 &ett_vtp_pruning,
657 static ei_register_info ei[] = {
658 { &ei_vtp_vlan_tlvlength_bad, { "vtp.vlan_info.tlv_len.bad", PI_PROTOCOL, PI_WARN, "Bad length for TLV length", EXPFILL }},
661 expert_module_t* expert_vtp;
663 proto_vtp = proto_register_protocol("VLAN Trunking Protocol", "VTP", "vtp");
664 proto_register_field_array(proto_vtp, hf, array_length(hf));
665 proto_register_subtree_array(ett, array_length(ett));
666 expert_vtp = expert_register_protocol(proto_vtp);
667 expert_register_field_array(expert_vtp, ei, array_length(ei));
670 void
671 proto_reg_handoff_vtp(void)
673 dissector_handle_t vtp_handle;
675 vtp_handle = create_dissector_handle(dissect_vtp, proto_vtp);
676 dissector_add_uint("llc.cisco_pid", 0x2003, vtp_handle);