forked from osmocom/wireshark
hpfeeds: restore channel name in tree.
The channel name is also set in pinfo->match_string to be printed by the json subdissector. Change-Id: I9a1c4576ce6d253ef415bda7392b37f2c063c2db Reviewed-on: https://code.wireshark.org/review/18560 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
parent
b86d72a0d1
commit
c9b5b6c13b
|
@ -179,6 +179,8 @@ dissect_hpfeeds_publish_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
guint8 len = 0;
|
||||
heur_dtbl_entry_t *hdtbl_entry;
|
||||
tvbuff_t *next_tvb;
|
||||
const guint8 *channelname = NULL;
|
||||
const char* save_match_string = NULL;
|
||||
|
||||
len = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_item(tree, hf_hpfeeds_ident_len, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
|
@ -187,15 +189,27 @@ dissect_hpfeeds_publish_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
offset += len;
|
||||
len = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_item(tree, hf_hpfeeds_chan_len, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += len + 1;
|
||||
offset += 1;
|
||||
|
||||
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
||||
/* get the channel name as ephemeral string to pass it to the heuristic decoders */
|
||||
proto_tree_add_item_ret_string(tree, hf_hpfeeds_channel, tvb, offset, len, ENC_ASCII|ENC_NA,
|
||||
wmem_packet_scope(), &channelname);
|
||||
offset += len;
|
||||
|
||||
/* try the heuristic dissectors */
|
||||
if (try_heuristic) {
|
||||
/* save the current match_string before calling the subdissectors */
|
||||
if (pinfo->match_string)
|
||||
save_match_string = pinfo->match_string;
|
||||
pinfo->match_string = channelname;
|
||||
|
||||
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
||||
|
||||
if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
pinfo->match_string = save_match_string;
|
||||
}
|
||||
|
||||
/* heuristic failed. Print remaining bytes as flat payload */
|
||||
|
|
Loading…
Reference in New Issue