forked from osmocom/wireshark
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>
This commit is contained in:
parent
38bda830d3
commit
2dcf32bc9c
|
@ -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",
|
||||
|
|
|
@ -113,6 +113,7 @@ typedef struct coap_common_dissect {
|
|||
|
||||
struct {
|
||||
/* Generic expert info for malformed packets. */
|
||||
expert_field opt_unknown_number;
|
||||
expert_field opt_invalid_number;
|
||||
expert_field opt_invalid_range;
|
||||
expert_field opt_length_bad;
|
||||
|
@ -142,7 +143,7 @@ coap_common_dissect_t name = { \
|
|||
-1, -1, \
|
||||
}, \
|
||||
/* ei */ { \
|
||||
EI_INIT, EI_INIT, EI_INIT, EI_INIT, \
|
||||
EI_INIT, EI_INIT, EI_INIT, EI_INIT, EI_INIT, \
|
||||
}, \
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -360,6 +361,10 @@ coap_common_dissect_t name = { \
|
|||
|
||||
/* {{{ */
|
||||
#define COAP_COMMON_EI_LIST(name, prefix) \
|
||||
{ & name .ei.opt_unknown_number, \
|
||||
{ prefix ".unknown_option_number", PI_UNDECODED, PI_WARN, \
|
||||
"Unknown Option Number", EXPFILL } \
|
||||
}, \
|
||||
{ & name .ei.opt_invalid_number, \
|
||||
{ prefix ".invalid_option_number", PI_MALFORMED, PI_WARN, \
|
||||
"Invalid Option Number", EXPFILL } \
|
||||
|
|
Loading…
Reference in New Issue