diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2021-08-19 08:19:24 +0200 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-08-20 08:12:44 +0000 |
commit | 1807d3874a4efc673fec89448209f426a0301f7f (patch) | |
tree | 20e4b5624071dfc6a31d9e90736a3d1426a97322 /epan/dissectors/packet-coap.c | |
parent | 487445c596271e28ef0aced5f296357426fdf38d (diff) |
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
Diffstat (limited to 'epan/dissectors/packet-coap.c')
-rw-r--r-- | epan/dissectors/packet-coap.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/epan/dissectors/packet-coap.c b/epan/dissectors/packet-coap.c index 8569b77a81..a8bc32660a 100644 --- a/epan/dissectors/packet-coap.c +++ b/epan/dissectors/packet-coap.c @@ -665,6 +665,24 @@ dissect_coap_opt_ctype(tvbuff_t *tvb, proto_item *head_item, proto_tree *subtree } 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) { guint8 val = 0; @@ -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, |