diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2015-06-24 12:21:42 -0700 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-06-25 00:10:13 +0000 |
commit | cdc7d2500469fe9cfe84d805957b8c3644cc27a1 (patch) | |
tree | 21d29e9a312dab0c72b7f9f82f23b56c015d7cf6 /epan/dissectors/packet-dtls.c | |
parent | f5b09f2c8af8d3f21adc89b2f19c47cdff65f775 (diff) |
Add ability to export PDUs for heuristic dissectors also
Change-Id: I1bf1aa9794f9b4f106edffd4986fc0b1014522fa
Reviewed-on: https://code.wireshark.org/review/9099
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-dtls.c')
-rw-r--r-- | epan/dissectors/packet-dtls.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c index 59334cc449..cd9da7db20 100644 --- a/epan/dissectors/packet-dtls.c +++ b/epan/dissectors/packet-dtls.c @@ -636,8 +636,21 @@ decrypt_dtls_record(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, return ret; } +static void +export_pdu_packet(tvbuff_t *tvb, packet_info *pinfo, guint tag, const gchar *name) +{ + exp_pdu_data_t *exp_pdu_data; + guint8 tags = EXP_PDU_TAG_IP_SRC_BIT | EXP_PDU_TAG_IP_DST_BIT | EXP_PDU_TAG_SRC_PORT_BIT | + EXP_PDU_TAG_DST_PORT_BIT | EXP_PDU_TAG_ORIG_FNO_BIT; + exp_pdu_data = load_export_pdu_tags(pinfo, tag, name, &tags, 1); + exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb); + exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb); + exp_pdu_data->pdu_tvb = tvb; + + tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data); +} /********************************************************************* @@ -931,18 +944,8 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo, ssl_print_data("decrypted app data",appl_data->plain_data.data, appl_data->plain_data.data_len); if (have_tap_listener(exported_pdu_tap)) { - exp_pdu_data_t *exp_pdu_data; - guint8 tags = EXP_PDU_TAG_IP_SRC_BIT | EXP_PDU_TAG_IP_DST_BIT | EXP_PDU_TAG_SRC_PORT_BIT | - EXP_PDU_TAG_DST_PORT_BIT | EXP_PDU_TAG_ORIG_FNO_BIT; - - exp_pdu_data = load_export_pdu_tags(pinfo, dissector_handle_get_dissector_name(session->app_handle), -1, - &tags, 1); - - exp_pdu_data->tvb_captured_length = tvb_captured_length(next_tvb); - exp_pdu_data->tvb_reported_length = tvb_reported_length(next_tvb); - exp_pdu_data->pdu_tvb = next_tvb; - - tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data); + export_pdu_packet(next_tvb, pinfo, EXP_PDU_TAG_PROTO_NAME, + dissector_handle_get_dissector_name(session->app_handle)); } dissected = call_dissector_only(session->app_handle, next_tvb, pinfo, top_tree, NULL); @@ -950,6 +953,11 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo, else { /* try heuristic subdissectors */ dissected = dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, top_tree, &hdtbl_entry, NULL); + if (dissected && have_tap_listener(exported_pdu_tap)) { + gchar *name = wmem_strconcat(wmem_packet_scope(), hdtbl_entry->list_name, "##", + proto_get_protocol_short_name(hdtbl_entry->protocol), NULL); + export_pdu_packet(next_tvb, pinfo, EXP_PDU_TAG_HEUR_PROTO_NAME, name); + } } pinfo->match_uint = saved_match_port; if (dissected) |