diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2016-07-14 20:07:14 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-07-16 23:52:42 +0000 |
commit | 379c3c6fde8a35648b570e714fc8b2ea7eead22e (patch) | |
tree | 1c403a5cb9cf0a7b2d819b2decb79ac8edd0b6ea /epan/dissectors/packet-isis-lsp.c | |
parent | abd0033c7ed380750aa59e5979e85dc0884ca564 (diff) |
ISIS (LSP): Fix Malformed packet
Coming from fetch too longer bytes...
Rework the display for add some missing field (SubTLV indicator, prefix len) and for prefix IPv4 use the same code like BGP
Issue reported by Garri Djavadyan
Bug:12617
Change-Id: Ib40f1badf8e03fadacfbb0aff1ebd3eab8ca342b
Reviewed-on: https://code.wireshark.org/review/16436
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-isis-lsp.c')
-rw-r--r-- | epan/dissectors/packet-isis-lsp.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/epan/dissectors/packet-isis-lsp.c b/epan/dissectors/packet-isis-lsp.c index 8f7198127c..827c6c8b16 100644 --- a/epan/dissectors/packet-isis-lsp.c +++ b/epan/dissectors/packet-isis-lsp.c @@ -309,6 +309,8 @@ static int hf_isis_lsp_ext_is_reachability_len = -1; static int hf_isis_lsp_ext_is_reachability_value = -1; static int hf_isis_lsp_default_metric = -1; static int hf_isis_lsp_ext_ip_reachability_distribution = -1; +static int hf_isis_lsp_ext_ip_reachability_subtlv = -1; +static int hf_isis_lsp_ext_ip_reachability_prefix_length = -1; static int hf_isis_lsp_ext_ip_reachability_subclvs_len = -1; static int hf_isis_lsp_ext_ip_reachability_code = -1; static int hf_isis_lsp_ext_ip_reachability_len = -1; @@ -808,7 +810,10 @@ dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tre guint8 ctrl_info; guint bit_length; int byte_length; - guint8 prefix [4]; + union { + guint8 addr_bytes[4]; + guint32 addr; + } prefix; address prefix_addr; guint len,i; guint subclvs_len; @@ -817,7 +822,7 @@ dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tre while (length > 0) { ctrl_info = tvb_get_guint8(tvb, offset+4); bit_length = ctrl_info & 0x3f; - byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset+5, prefix, bit_length); + byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset+5, prefix.addr_bytes, bit_length); if (byte_length == -1) { proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_packet, tvb, offset, -1, "IPv4 prefix has an invalid length: %d bits", bit_length ); @@ -831,11 +836,14 @@ dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tre subtree = proto_tree_add_subtree(tree, tvb, offset, 5+byte_length+subclvs_len, ett_isis_lsp_part_of_clv_ext_ip_reachability, NULL, "Ext. IP Reachability"); - set_address(&prefix_addr, AT_IPv4, 4, prefix); - proto_tree_add_ipv4_format_value(subtree, hf_isis_lsp_ext_ip_reachability_ipv4_prefix, tvb, offset+5, byte_length, - tvb_get_ntohl(tvb, offset+5), "%s/%u", address_to_str(wmem_packet_scope(), &prefix_addr), bit_length); + set_address(&prefix_addr, AT_IPv4, 4, prefix.addr_bytes); + proto_tree_add_item(subtree, hf_isis_lsp_ext_ip_reachability_metric, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_item(subtree, hf_isis_lsp_ext_ip_reachability_distribution, tvb, offset+4, 1, ENC_NA); + proto_tree_add_item(subtree, hf_isis_lsp_ext_ip_reachability_subtlv, tvb, offset+4, 1, ENC_NA); + proto_tree_add_item(subtree, hf_isis_lsp_ext_ip_reachability_prefix_length, tvb, offset+4, 1, ENC_NA); + + proto_tree_add_ipv4(subtree, hf_isis_lsp_ext_ip_reachability_ipv4_prefix, tvb, offset + 5, byte_length, prefix.addr); len = 5 + byte_length; if ((ctrl_info & 0x40) != 0) { @@ -863,7 +871,7 @@ dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tre } len += 1 + subclvs_len; } else { - proto_tree_add_uint_format(subtree, hf_isis_lsp_ext_ip_reachability_subclvs_len, tvb, offset, len, 0, "no sub-TLVs present"); + proto_tree_add_uint_format(subtree, hf_isis_lsp_ext_ip_reachability_subclvs_len, tvb, offset+len, 0, 0, "no sub-TLVs present"); } offset += len; @@ -4154,6 +4162,16 @@ proto_register_isis_lsp(void) FT_BOOLEAN, 8, TFS(&tfs_up_down), 0x80, NULL, HFILL } }, + { &hf_isis_lsp_ext_ip_reachability_subtlv, + { "Sub-TLV", "isis.lsp.ext_ip_reachability.subtlv", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, + NULL, HFILL } + }, + { &hf_isis_lsp_ext_ip_reachability_prefix_length, + { "Prefix Length", "isis.lsp.ext_ip_reachability.prefix_length", + FT_UINT8, BASE_DEC, NULL, 0x3F, + NULL, HFILL } + }, { &hf_isis_lsp_grp_macaddr_length, { "Length", "isis.lsp.grp_macaddr.length", FT_UINT8, BASE_DEC, NULL, 0x0, |