coap: Do not handle Accept as Content-Format

Only use value of Content-Format to dissect the content in the
current packet. Accept is used to tell which format is expected
in the reply.

Fixes: #17536
This commit is contained in:
Stig Bjørlykke 2021-08-19 08:19:24 +02:00 committed by Wireshark GitLab Utility
parent 487445c596
commit 1807d3874a
1 changed files with 20 additions and 2 deletions

View File

@ -664,6 +664,24 @@ dissect_coap_opt_ctype(tvbuff_t *tvb, proto_item *head_item, proto_tree *subtree
proto_item_append_text(head_item, ": %s", coinfo->ctype_str);
}
static void
dissect_coap_opt_accept(tvbuff_t *tvb, proto_item *head_item, proto_tree *subtree, gint offset, gint opt_length, int hf)
{
const guint8 *str = NULL;
if (opt_length == 0) {
str = nullstr;
} else {
guint value = coap_get_opt_uint(tvb, offset, opt_length);
str = val_to_str(value, vals_ctype, "Unknown Type %u");
}
proto_tree_add_string(subtree, hf, tvb, offset, opt_length, str);
/* add info to the head of the packet detail */
proto_item_append_text(head_item, ": %s", str);
}
static void
dissect_coap_opt_block(tvbuff_t *tvb, proto_item *head_item, proto_tree *subtree, gint offset, gint opt_length, coap_info *coinfo, coap_common_dissect_t *dissect_hf)
{
@ -923,8 +941,8 @@ dissect_coap_options_main(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tr
opt_length, dissect_hf->hf.opt_hop_limit);
break;
case COAP_OPT_ACCEPT:
dissect_coap_opt_ctype(tvb, item, subtree, offset,
opt_length, dissect_hf->hf.opt_accept, coinfo);
dissect_coap_opt_accept(tvb, item, subtree, offset,
opt_length, dissect_hf->hf.opt_accept);
break;
case COAP_OPT_IF_MATCH:
dissect_coap_opt_hex_string(tvb, pinfo, item, subtree, offset,