forked from osmocom/wireshark
Minor improvements to VTP dissector.
1. More items "filterable" through proto_tree_add_item and expert_add_info_format_text 2. Update protocol spec reference 3. Remove some length checks to allow for malformed packets within dissect_vlan_info since the entire "vlan info structure" is necessary. svn path=/trunk/; revision=50262
This commit is contained in:
parent
7fa41b815c
commit
8723265c1d
|
@ -32,12 +32,9 @@
|
|||
/*
|
||||
* See
|
||||
*
|
||||
* http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm
|
||||
* http://www.cisco.com/en/US/tech/tk389/tk689/technologies_tech_note09186a0080094c52.shtml
|
||||
*
|
||||
* for some information on VTP.
|
||||
*
|
||||
* It's incomplete, and it appears to be inaccurate in a number of places,
|
||||
* but it's all I could find....
|
||||
*/
|
||||
|
||||
static int proto_vtp = -1;
|
||||
|
@ -62,9 +59,19 @@ static int hf_vtp_802_10_index = -1;
|
|||
static int hf_vtp_vlan_name = -1;
|
||||
static int hf_vtp_vlan_tlvtype = -1;
|
||||
static int hf_vtp_vlan_tlvlength = -1;
|
||||
static gint hf_vtp_pruning_first_vid = -1;
|
||||
static gint hf_vtp_pruning_last_vid = -1;
|
||||
static gint hf_vtp_pruning_active_vid = -1;
|
||||
static int hf_vtp_pruning_first_vid = -1;
|
||||
static int hf_vtp_pruning_last_vid = -1;
|
||||
static int hf_vtp_pruning_active_vid = -1;
|
||||
static int hf_vtp_vlan_src_route_ring_num = -1;
|
||||
static int hf_vtp_vlan_src_route_bridge_num = -1;
|
||||
static int hf_vtp_vlan_stp_type = -1;
|
||||
static int hf_vtp_vlan_parent_vlan = -1;
|
||||
static int hf_vtp_vlan_translationally_bridged_vlans = -1;
|
||||
static int hf_vtp_vlan_pruning = -1;
|
||||
static int hf_vtp_vlan_bridge_type = -1;
|
||||
static int hf_vtp_vlan_max_are_hop_count = -1;
|
||||
static int hf_vtp_vlan_max_ste_hop_count = -1;
|
||||
static int hf_vtp_vlan_backup_crf_mode = -1;
|
||||
|
||||
static gint ett_vtp = -1;
|
||||
static gint ett_vtp_vlan_info = -1;
|
||||
|
@ -72,6 +79,8 @@ static gint ett_vtp_vlan_status = -1;
|
|||
static gint ett_vtp_tlv = -1;
|
||||
static gint ett_vtp_pruning = -1;
|
||||
|
||||
static expert_field ei_vtp_vlan_tlvlength_bad = EI_INIT;
|
||||
|
||||
static int
|
||||
dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree);
|
||||
static void
|
||||
|
@ -134,52 +143,42 @@ dissect_vtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree *vtp_tree = NULL, *vtp_pruning_tree = NULL;
|
||||
int offset = 0;
|
||||
guint8 code;
|
||||
guint8 md_len;
|
||||
const guint8 *upd_timestamp;
|
||||
guint8 *upd_timestamp;
|
||||
int vlan_info_len;
|
||||
int pruning_vlan_id;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "VTP");
|
||||
set_vtp_info_col(tvb, pinfo);
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_vtp, tvb, offset, -1,
|
||||
ENC_NA);
|
||||
ti = proto_tree_add_item(tree, proto_vtp, tvb, offset, -1, ENC_NA);
|
||||
vtp_tree = proto_item_add_subtree(ti, ett_vtp);
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_version, tvb, offset, 1,
|
||||
ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
code = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(vtp_tree, hf_vtp_code, tvb, offset, 1,
|
||||
code);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_code, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
switch (code) {
|
||||
|
||||
case SUMMARY_ADVERT:
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_followers, tvb, offset,
|
||||
1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_followers, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
md_len = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(vtp_tree, hf_vtp_md_len, tvb, offset,
|
||||
1, md_len);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset,
|
||||
32, ENC_ASCII|ENC_NA);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII|ENC_NA);
|
||||
offset += 32;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num, tvb,
|
||||
offset, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += 4;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_upd_id, tvb,
|
||||
offset, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_upd_id, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += 4;
|
||||
|
||||
upd_timestamp = tvb_get_ptr(tvb, offset, 12);
|
||||
upd_timestamp = tvb_get_ephemeral_string(tvb, offset, 12);
|
||||
proto_tree_add_string_format(vtp_tree, hf_vtp_upd_ts, tvb,
|
||||
offset, 12, (gchar*)upd_timestamp,
|
||||
"Update Timestamp: %.2s-%.2s-%.2s %.2s:%.2s:%.2s",
|
||||
|
@ -187,26 +186,20 @@ dissect_vtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
&upd_timestamp[6], &upd_timestamp[8], &upd_timestamp[10]);
|
||||
offset += 12;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md5_digest, tvb,
|
||||
offset, 16, ENC_NA);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md5_digest, tvb, offset, 16, ENC_NA);
|
||||
break;
|
||||
|
||||
case SUBSET_ADVERT:
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_seq_num, tvb, offset,
|
||||
1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_seq_num, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
md_len = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(vtp_tree, hf_vtp_md_len, tvb, offset,
|
||||
1, md_len);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset,
|
||||
32, ENC_ASCII|ENC_NA);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII|ENC_NA);
|
||||
offset += 32;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num, tvb,
|
||||
offset, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_conf_rev_num, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += 4;
|
||||
|
||||
while (tvb_reported_length_remaining(tvb, offset) > 0) {
|
||||
|
@ -221,33 +214,25 @@ dissect_vtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
case ADVERT_REQUEST:
|
||||
offset += 1; /* skip reserved field */
|
||||
|
||||
md_len = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(vtp_tree, hf_vtp_md_len, tvb, offset,
|
||||
1, md_len);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset,
|
||||
32, ENC_ASCII|ENC_NA);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII|ENC_NA);
|
||||
offset += 32;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_start_value, tvb,
|
||||
offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_start_value, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
|
||||
case JOIN_MSG:
|
||||
offset += 1; /* skip reserved/unused field */
|
||||
|
||||
md_len = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(vtp_tree, hf_vtp_md_len, tvb, offset,
|
||||
1, md_len);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md_len, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset,
|
||||
32, ENC_ASCII|ENC_NA);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_md, tvb, offset, 32, ENC_ASCII|ENC_NA);
|
||||
offset += 32;
|
||||
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_pruning_first_vid, tvb, offset,
|
||||
2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vtp_tree, hf_vtp_pruning_first_vid, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
pruning_vlan_id = tvb_get_ntohs(tvb, offset);
|
||||
offset += 2;
|
||||
|
||||
|
@ -266,13 +251,13 @@ dissect_vtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
vlan_usage_bitmap = tvb_get_guint8(tvb, offset);
|
||||
|
||||
for (shift = 0; shift < 8; shift++) {
|
||||
if (vlan_usage_bitmap & (1<<7)) {
|
||||
proto_tree_add_uint(vtp_pruning_tree, hf_vtp_pruning_active_vid,
|
||||
tvb, offset, 1, pruning_vlan_id);
|
||||
}
|
||||
if (vlan_usage_bitmap & (1<<7)) {
|
||||
proto_tree_add_uint(vtp_pruning_tree, hf_vtp_pruning_active_vid,
|
||||
tvb, offset, 1, pruning_vlan_id);
|
||||
}
|
||||
|
||||
pruning_vlan_id += 1;
|
||||
vlan_usage_bitmap <<= 1;
|
||||
pruning_vlan_id += 1;
|
||||
vlan_usage_bitmap <<= 1;
|
||||
}
|
||||
|
||||
offset += 1;
|
||||
|
@ -343,8 +328,6 @@ dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tre
|
|||
offset += 1;
|
||||
vlan_info_left -= 1;
|
||||
|
||||
if (vlan_info_left < 1)
|
||||
return -1;
|
||||
status = tvb_get_guint8(tvb, offset);
|
||||
ti = proto_tree_add_text(vlan_info_tree, tvb, offset, 1,
|
||||
"Status: 0x%02x%s", status,
|
||||
|
@ -355,48 +338,30 @@ dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tre
|
|||
offset += 1;
|
||||
vlan_info_left -= 1;
|
||||
|
||||
if (vlan_info_left < 1)
|
||||
return -1;
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_type, tvb, offset, 1,
|
||||
ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
vlan_info_left -= 1;
|
||||
|
||||
if (vlan_info_left < 1)
|
||||
return -1;
|
||||
vlan_name_len = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(vlan_info_tree, hf_vtp_vlan_name_len, tvb, offset, 1,
|
||||
vlan_name_len);
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_name_len, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
vlan_info_left -= 1;
|
||||
|
||||
if (vlan_info_left < 2)
|
||||
return -1;
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_isl_vlan_id, tvb, offset, 2,
|
||||
ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_isl_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
vlan_info_left -= 2;
|
||||
|
||||
if (vlan_info_left < 2)
|
||||
return -1;
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_mtu_size, tvb, offset, 2,
|
||||
ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_mtu_size, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
vlan_info_left -= 2;
|
||||
|
||||
if (vlan_info_left < 4)
|
||||
return -1;
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_802_10_index, tvb, offset, 4,
|
||||
ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_802_10_index, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += 4;
|
||||
vlan_info_left -= 4;
|
||||
|
||||
/* VLAN name length appears to be rounded up to a multiple of 4. */
|
||||
vlan_name_len = 4*((vlan_name_len + 3)/4);
|
||||
if (vlan_info_left < vlan_name_len)
|
||||
return -1;
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_name, tvb, offset,
|
||||
vlan_name_len, ENC_ASCII|ENC_NA);
|
||||
proto_tree_add_item(vlan_info_tree, hf_vtp_vlan_name, tvb, offset, vlan_name_len, ENC_ASCII|ENC_NA);
|
||||
offset += vlan_name_len;
|
||||
vlan_info_left -= vlan_name_len;
|
||||
|
||||
|
@ -409,10 +374,8 @@ dissect_vlan_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tre
|
|||
val_to_str(type, vlan_tlv_type_vals,
|
||||
"Unknown TLV type: 0x%02x"));
|
||||
tlv_tree = proto_item_add_subtree(ti, ett_vtp_tlv);
|
||||
proto_tree_add_uint(tlv_tree, hf_vtp_vlan_tlvtype, tvb, offset,
|
||||
1, type);
|
||||
proto_tree_add_uint(tlv_tree, hf_vtp_vlan_tlvlength, tvb, offset+1,
|
||||
1, length);
|
||||
proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvtype, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tlv_tree, hf_vtp_vlan_tlvlength, tvb, offset+1, 1, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
vlan_info_left -= 2;
|
||||
if (length > 0) {
|
||||
|
@ -459,139 +422,81 @@ dissect_vlan_info_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length,
|
|||
|
||||
case SR_RING_NUM:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Source-Routing Ring Number: 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Source-Routing Ring Number: 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_src_route_ring_num, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Source-Routing Ring Number: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Source-Routing Ring Number: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
case SR_BRIDGE_NUM:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Source-Routing Bridge Number: 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Source-Routing Bridge Number: 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_src_route_bridge_num, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Source-Routing Bridge Number: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Source-Routing Bridge Number: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
case STP_TYPE:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Spanning-Tree Protocol Type: %s",
|
||||
val_to_str(tvb_get_ntohs(tvb, offset), stp_type_vals,
|
||||
"Unknown (0x%04x)"));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Spanning-Tree Protocol Type: %s",
|
||||
val_to_str(tvb_get_ntohs(tvb, offset), stp_type_vals,
|
||||
"Unknown (0x%04x)"));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_stp_type, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Spanning-Tree Protocol Type: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Spanning-Tree Protocol Type: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
case PARENT_VLAN:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Parent VLAN: 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Parent VLAN: 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_parent_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Parent VLAN: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Parent VLAN: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
case TR_BRIDGED_VLANS:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Translationally Bridged VLANs: 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Translationally Bridged VLANs: 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_translationally_bridged_vlans, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Translationally Bridged VLANs: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Translationally Bridged VLANs: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
case PRUNING:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Pruning: %s",
|
||||
val_to_str(tvb_get_ntohs(tvb, offset), pruning_vals,
|
||||
"Unknown (0x%04x)"));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Pruning: %s",
|
||||
val_to_str(tvb_get_ntohs(tvb, offset), pruning_vals,
|
||||
"Unknown (0x%04x)"));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_pruning, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Pruning: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Pruning: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
case BRIDGE_TYPE:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Bridge Type: %s",
|
||||
val_to_str(tvb_get_ntohs(tvb, offset), bridge_type_vals,
|
||||
"Unknown (0x%04x)"));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Bridge Type: %s",
|
||||
val_to_str(tvb_get_ntohs(tvb, offset), bridge_type_vals,
|
||||
"Unknown (0x%04x)"));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_bridge_type, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Bridge Type: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Bridge Type: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
case MAX_ARE_HOP_CNT:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Max ARE Hop Count: %u",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Max ARE Hop Count: %u",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_max_are_hop_count, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Max ARE Hop Count: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Max ARE Hop Count: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
case MAX_STE_HOP_CNT:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Max STE Hop Count: %u",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Max STE Hop Count: %u",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_max_ste_hop_count, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Max STE Hop Count: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Max STE Hop Count: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
case BACKUP_CRF_MODE:
|
||||
if (length == 2) {
|
||||
proto_item_set_text(ti,
|
||||
"Backup CRF Mode: %s",
|
||||
val_to_str(tvb_get_ntohs(tvb, offset), backup_crf_mode_vals,
|
||||
"Unknown (0x%04x)"));
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"Backup CRF Mode: %s",
|
||||
val_to_str(tvb_get_ntohs(tvb, offset), backup_crf_mode_vals,
|
||||
"Unknown (0x%04x)"));
|
||||
proto_tree_add_item(tree, hf_vtp_vlan_backup_crf_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "Backup CRF Mode: Bad length %u", length);
|
||||
expert_add_info_format_text(pinfo, ti, &ei_vtp_vlan_tlvlength_bad, "Backup CRF Mode: Bad length %u", length);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -701,6 +606,45 @@ proto_register_vtp(void)
|
|||
{ "VLAN", "vtp.pruning.active", FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
"Active advertised VLAN ID", HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_src_route_ring_num,
|
||||
{ "Source-Routing Ring Number", "vtp.vlan_info.src_route_ring_num", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_src_route_bridge_num,
|
||||
{ "Source-Routing Bridge Number", "vtp.vlan_info.src_route_bridge_num", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_stp_type,
|
||||
{ "Spanning-Tree Protocol Type", "vtp.vlan_info.stp_type", FT_UINT16, BASE_HEX, VALS(stp_type_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_parent_vlan,
|
||||
{ "Parent VLAN", "vtp.vlan_info.parent_vlan", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_translationally_bridged_vlans,
|
||||
{ "Translationally Bridged VLANs", "vtp.vlan_info.translationally_bridged_vlans", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_pruning,
|
||||
{ "Pruning", "vtp.vlan_info.pruning", FT_UINT16, BASE_HEX, VALS(pruning_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_bridge_type,
|
||||
{ "Bridge Type", "vtp.vlan_info.bridge_type", FT_UINT16, BASE_HEX, VALS(bridge_type_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_max_are_hop_count,
|
||||
{ "Max ARE Hop Count", "vtp.vlan_info.max_are_hop_count", FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_max_ste_hop_count,
|
||||
{ "Max STE Hop Count", "vtp.vlan_info.max_ste_hop_count", FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_vtp_vlan_backup_crf_mode,
|
||||
{ "Backup CRF Mode", "vtp.vlan_info.backup_crf_mode", FT_UINT16, BASE_HEX, VALS(backup_crf_mode_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_vtp,
|
||||
|
@ -710,10 +654,17 @@ proto_register_vtp(void)
|
|||
&ett_vtp_pruning,
|
||||
};
|
||||
|
||||
proto_vtp = proto_register_protocol("VLAN Trunking Protocol",
|
||||
"VTP", "vtp");
|
||||
proto_register_field_array(proto_vtp, hf, array_length(hf));
|
||||
static ei_register_info ei[] = {
|
||||
{ &ei_vtp_vlan_tlvlength_bad, { "vtp.vlan_info.tlv_len.bad", PI_PROTOCOL, PI_WARN, "Bad length for TLV length", EXPFILL }},
|
||||
};
|
||||
|
||||
expert_module_t* expert_vtp;
|
||||
|
||||
proto_vtp = proto_register_protocol("VLAN Trunking Protocol", "VTP", "vtp");
|
||||
proto_register_field_array(proto_vtp, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
expert_vtp = expert_register_protocol(proto_vtp);
|
||||
expert_register_field_array(expert_vtp, ei, array_length(ei));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue