diff options
author | Anders Broman <anders.broman@ericsson.com> | 2014-01-20 20:03:49 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2014-01-20 20:03:49 +0000 |
commit | 6402d8590ea0fe7bfb6fbc8d530cce64a0080183 (patch) | |
tree | 18e03a06ea9d03b1a6f1d618f0ea9b378caeeb04 /epan/dissectors | |
parent | 77e4a2f09c4e9f2e70184954f1b1a979a6df5c0b (diff) |
Add generic dissection of unknown vendor sub options.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9594
svn path=/trunk/; revision=54859
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-bootp.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index f9c82aac5f..a1e080f81c 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -448,7 +448,8 @@ static int hf_bootp_option_6RD_border_relay_ip = -1; /* 212 */ static int hf_bootp_option_private_proxy_autodiscovery = -1; /* 252 */ static int hf_bootp_option_end = -1; /* 255 */ static int hf_bootp_option_end_overload = -1; /* 255 (with overload)*/ - +static int hf_bootp_vendor_unknown_suboption = -1; +static int hf_bootp_suboption_data = -1; @@ -802,6 +803,8 @@ static int dissect_packetcable_ietf_ccc(packet_info *pinfo, proto_item *v_ti, pr tvbuff_t *tvb, int optoff, int optend, int revision); static int dissect_vendor_cl_suboption(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree, tvbuff_t *tvb, int optoff, int optend); +static int dissect_vendor_generic_suboption(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree, + tvbuff_t *tvb, int optoff, int optend); #define OPT53_DISCOVER "Discover" /* http://www.iana.org/assignments/bootp-dhcp-parameters */ @@ -2565,8 +2568,18 @@ bootp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, int voff, break; default: - /* skip over the data and look for next enterprise number */ - optoff += s_option_len; + s_end = optoff + s_option_len; + if ( s_end > optend ) { + expert_add_info_format(pinfo, vti, &ei_bootp_option125_enterprise_malformed, "no room left in option for enterprise %u data", enterprise); + break; + } + + e_tree = proto_item_add_subtree(vti, ett_bootp_option); + while (optoff < s_end) { + + optoff = dissect_vendor_generic_suboption(pinfo, vti, e_tree, tvb, optoff, s_end); + } + break; } optleft -= s_option_len; @@ -3275,6 +3288,29 @@ dissect_vendor_cablelabs_suboption(packet_info *pinfo, proto_item *v_ti, proto_t return optoff; } + +static int +dissect_vendor_generic_suboption(packet_info *pinfo, proto_item *v_ti, proto_tree *v_tree, + tvbuff_t *tvb, int optoff, int optend) +{ + int suboptoff = optoff; + guint8 subopt_len; + proto_item *item; + proto_tree *sub_tree; + + item = proto_tree_add_item(v_tree, hf_bootp_vendor_unknown_suboption, tvb, optoff, 1, ENC_BIG_ENDIAN); + suboptoff+=1; + + sub_tree = proto_item_add_subtree(item, ett_bootp_option125_suboption); + subopt_len = tvb_get_guint8(tvb,suboptoff); + proto_tree_add_item(sub_tree, hf_bootp_suboption_length, tvb, suboptoff, 1, ENC_BIG_ENDIAN); + suboptoff++; + proto_tree_add_item(sub_tree, hf_bootp_suboption_data, tvb, suboptoff, subopt_len, ENC_BIG_ENDIAN); + suboptoff+= subopt_len; + + return suboptoff; + +} static const value_string option43_alcatel_suboption_vals[] = { { 0, "Padding" }, { 58, "Voice VLAN ID" }, @@ -6848,6 +6884,15 @@ proto_register_bootp(void) FT_UINT8, BASE_DEC, NULL, 0x0, "Option 255: End (Overload)", HFILL }}, + { &hf_bootp_vendor_unknown_suboption, + { "Option 125 Suboption", "bootp.vendor.suboption", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_bootp_suboption_data, + { "Data", "bootp.vendor.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; static uat_field_t bootp_uat_flds[] = { |