diff options
author | Marian Durkovic <md@bts.sk> | 2014-08-17 07:38:43 +0200 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-08-17 19:08:38 +0000 |
commit | 2d2ecfbab296b360f3e7c93b70609defe79aa89a (patch) | |
tree | 50ccc1ade6e8a2ef82b34f113b27c212e12bae0f /epan/dissectors/packet-isis-lsp.c | |
parent | e1449a80609f80e3b1f26d68da3b5afd94c8900d (diff) |
Fix TRILL LSP dissector
- correctly compute length/offset in all SubTLVs
- initialize variable before while() loop
- fix VLAN_GROUP SubTLV according to RFC7176 sec. 2.3.7
Change-Id: Ib5cc4ce82f63ad39e83c8b1f4a630708f8a8aa88
Reviewed-on: https://code.wireshark.org/review/3667
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-isis-lsp.c')
-rw-r--r-- | epan/dissectors/packet-isis-lsp.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/epan/dissectors/packet-isis-lsp.c b/epan/dissectors/packet-isis-lsp.c index 17b5d5e57d..e92d0e5288 100644 --- a/epan/dissectors/packet-isis-lsp.c +++ b/epan/dissectors/packet-isis-lsp.c @@ -163,7 +163,6 @@ static int hf_isis_lsp_rt_capable_nickname_length = -1; static int hf_isis_lsp_ip_reachability_ipv4_prefix = -1; static int hf_isis_lsp_grp_address_topology_id = -1; static int hf_isis_lsp_ext_is_reachability_ipv4_neighbor_address = -1; -static int hf_isis_lsp_rt_capable_vlan_group_nth_secondary_vlan_id = -1; static int hf_isis_lsp_ipv6_reachability_reserved_bits = -1; static int hf_isis_lsp_eis_neighbors_default_metric = -1; static int hf_isis_lsp_mt_cap_spb_instance_cist_root_identifier = -1; @@ -779,7 +778,6 @@ dissect_isis_rt_capable_clv(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rt_tree; gint root_id = 1; /* To display the root id */ - gint sec_vlan_id = 1; /* To display the seconadary VLAN id */ length = length - 5; /* Ignoring the 5 reserved bytes */ offset = offset + 5; @@ -842,11 +840,15 @@ dissect_isis_rt_capable_clv(tvbuff_t *tvb, packet_info* pinfo _U_, len = tvb_get_guint8(tvb, offset); proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_tree_root_id_length, tvb, offset, 1, ENC_NA); - proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_tree_root_id_starting_tree_no, tvb, offset+1, 2, ENC_BIG_ENDIAN); + length--; + offset++; + + proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_tree_root_id_starting_tree_no, tvb, offset, 2, ENC_BIG_ENDIAN); len -= 2; length -= 2; offset += 2; + root_id = 1; while (len>1) { rt_block = tvb_get_ntohs(tvb, offset); @@ -865,9 +867,10 @@ dissect_isis_rt_capable_clv(tvbuff_t *tvb, packet_info* pinfo _U_, length--; offset++; - len = tvb_get_guint8(tvb, offset); + len = tvb_get_guint8(tvb, offset); proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_nickname_length, tvb, offset, 1, ENC_NA); + length--; offset++; @@ -900,7 +903,6 @@ dissect_isis_rt_capable_clv(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_interested_vlans_length, tvb, offset, 1, ENC_NA); length--; offset++; - len--; proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_interested_vlans_nickname, tvb, offset, 2, ENC_BIG_ENDIAN); len -= 2; @@ -943,18 +945,21 @@ dissect_isis_rt_capable_clv(tvbuff_t *tvb, packet_info* pinfo _U_, len = tvb_get_guint8(tvb, offset); proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_tree_used_id_length, tvb, offset, 1, ENC_NA); - proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_tree_used_id_starting_tree_no, tvb, offset+1, 2, ENC_BIG_ENDIAN); + length--; + offset++; + + proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_tree_used_id_starting_tree_no, tvb, offset, 2, ENC_BIG_ENDIAN); + len -= 2; - length += 2; - offset += 3; + length -= 2; + offset += 2; root_id = 1; - while (len>0) { + while (len>1) { rt_block = tvb_get_ntohs(tvb, offset); proto_tree_add_uint_format(rt_tree, hf_isis_lsp_rt_capable_tree_used_id_nickname, tvb, offset,2, rt_block, "Nickname(%dth root): %d", root_id, rt_block); root_id++; - len -= 2; offset += 2; length -= 2; @@ -971,7 +976,6 @@ dissect_isis_rt_capable_clv(tvbuff_t *tvb, packet_info* pinfo _U_, len = tvb_get_guint8(tvb, offset); proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_vlan_group_length, tvb, offset, 1, ENC_NA); - len--; length--; offset++; @@ -981,22 +985,12 @@ dissect_isis_rt_capable_clv(tvbuff_t *tvb, packet_info* pinfo _U_, offset += 2; length -= 2; - proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_vlan_group_secondary_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN); - - len -= 2; - offset += 2; - length -= 2; - sec_vlan_id = 1; - - while (len>0) { - rt_block = tvb_get_ntohs(tvb, offset); + while (len>1) { - proto_tree_add_uint_format(rt_tree, hf_isis_lsp_rt_capable_vlan_group_nth_secondary_vlan_id, tvb, offset, 2, - rt_block, "%dth secondary vlan id: %x", sec_vlan_id, rt_block); + proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_vlan_group_secondary_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN); length -= 2; offset += 2; - sec_vlan_id++; len -= 2; } break; @@ -3061,11 +3055,6 @@ proto_register_isis_lsp(void) FT_UINT16, BASE_DEC, NULL, 0x0fff, NULL, HFILL } }, - { &hf_isis_lsp_rt_capable_vlan_group_nth_secondary_vlan_id, - { "%dth secondary vlan id", "isis.lsp.rt_capable.vlan_group.nth_secondary_vlan_id", - FT_UINT16, BASE_HEX, NULL, 0x0, - NULL, HFILL } - }, { &hf_isis_lsp_ipv6_reachability_ipv6_prefix, { "IPv6 prefix", "isis.lsp.ipv6_reachability.ipv6_prefix", FT_IPv6, BASE_NONE, NULL, 0x0, |