diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2020-06-26 10:10:14 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-06-27 13:48:16 +0000 |
commit | 2dcf32bc9cfc53f558928738c672726d0dd60d94 (patch) | |
tree | 1cce54218932e7b6b16379d2e004abc786150e45 /epan/dissectors/packet-coap.c | |
parent | 38bda830d37b0c5f3bc3a975d61dfcd769a533e1 (diff) |
coap: Mark private and vendor-specific options as unknown
Any private or vendor-specific options are not invalid, so mark them
as unknown. Move expert info to option entry. Add the unknown option
number to the item.
Change-Id: I567c397787d4afddffdca407a8c2e39db828ab83
Reviewed-on: https://code.wireshark.org/review/37562
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-coap.c')
-rw-r--r-- | epan/dissectors/packet-coap.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/epan/dissectors/packet-coap.c b/epan/dissectors/packet-coap.c index 0a21ad551b..3f001a5bc3 100644 --- a/epan/dissectors/packet-coap.c +++ b/epan/dissectors/packet-coap.c @@ -361,8 +361,14 @@ coap_opt_check(packet_info *pinfo, proto_tree *subtree, guint opt_num, gint opt_ break; } if (i == (int)(array_length(coi))) { - expert_add_info_format(pinfo, subtree, &dissect_hf->ei.opt_invalid_number, - "Invalid Option Number %u", opt_num); + if (opt_num >= 2048 && opt_num <= 65535) { + /* private, vendor-specific or reserved for experiments */ + expert_add_info_format(pinfo, subtree, &dissect_hf->ei.opt_unknown_number, + "Unknown Option Number %u", opt_num); + } else { + expert_add_info_format(pinfo, subtree, &dissect_hf->ei.opt_invalid_number, + "Invalid Option Number %u", opt_num); + } return -1; } if (opt_length < coi[i].min || opt_length > coi[i].max) { @@ -816,15 +822,15 @@ dissect_coap_options_main(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tr return -1; } - coap_opt_check(pinfo, coap_tree, *opt_num, opt_length, dissect_hf); - g_snprintf(strbuf, sizeof(strbuf), - "#%u: %s", opt_count, val_to_str_const(*opt_num, vals_opt_type, - *opt_num % 14 == 0 ? "No-Op" : "Unknown Option")); + "#%u: %s", opt_count, val_to_str(*opt_num, vals_opt_type, + *opt_num % 14 == 0 ? "No-Op" : "Unknown Option (%d)")); item = proto_tree_add_string(coap_tree, dissect_hf->hf.opt_name, tvb, orig_offset, offset - orig_offset + opt_length, strbuf); subtree = proto_item_add_subtree(item, dissect_hf->ett.option); + coap_opt_check(pinfo, subtree, *opt_num, opt_length, dissect_hf); + g_snprintf(strbuf, sizeof(strbuf), "Type %u, %s, %s%s", *opt_num, (*opt_num & 1) ? "Critical" : "Elective", |