From 200c15e96dd84bdc8d6f856b262d726d752594d4 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 16 Jun 2015 10:51:47 -0700 Subject: [PATCH] Pass the pseudo-header to wtap_encap dissectors via the "data" argument. Have the "data" argument to dissectors registered in thw wtap_encap dissector table point to the pseudo-header for the packet. Use that argument in the Bluetooth dissector. Change-Id: I022bbfb796ef51d95df09fb952a149960170d631 Reviewed-on: https://code.wireshark.org/review/8951 Reviewed-by: Guy Harris --- epan/dissectors/packet-bluetooth.c | 8 ++++---- epan/dissectors/packet-frame.c | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/epan/dissectors/packet-bluetooth.c b/epan/dissectors/packet-bluetooth.c index c3f5f1e580..f994576722 100644 --- a/epan/dissectors/packet-bluetooth.c +++ b/epan/dissectors/packet-bluetooth.c @@ -1380,10 +1380,10 @@ dissect_bluetooth_bthci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree); /* - * Point to the bthci pseudo-header. + * data points to a struct bthci_phdr. */ bluetooth_data->previous_protocol_data_type = BT_PD_BTHCI; - bluetooth_data->previous_protocol_data.bthci = &pinfo->pseudo_header->bthci; + bluetooth_data->previous_protocol_data.bthci = (struct bthci_phdr *)data; if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE, bluetooth_data)) { call_dissector(data_handle, tvb, pinfo, tree); @@ -1403,10 +1403,10 @@ dissect_bluetooth_btmon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi bluetooth_data = dissect_bluetooth_common(tvb, pinfo, tree); /* - * Point to the btmon pseudo-header. + * data points to a struct btmon_phdr. */ bluetooth_data->previous_protocol_data_type = BT_PD_BTMON; - bluetooth_data->previous_protocol_data.btmon = &pinfo->pseudo_header->btmon; + bluetooth_data->previous_protocol_data.btmon = (struct btmon_phdr *)data; if (!dissector_try_uint_new(bluetooth_table, pinfo->phdr->pkt_encap, tvb, pinfo, tree, TRUE, bluetooth_data)) { call_dissector(data_handle, tvb, pinfo, tree); diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index df9258073b..3e03074f77 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -491,15 +491,20 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* case REC_TYPE_PACKET: if ((force_docsis_encap) && (docsis_handle)) { - call_dissector(docsis_handle, tvb, pinfo, parent_tree); + call_dissector_with_data(docsis_handle, + tvb, pinfo, parent_tree, + (void *)pinfo->pseudo_header); } else { - if (!dissector_try_uint(wtap_encap_dissector_table, pinfo->fd->lnk_t, - tvb, pinfo, parent_tree)) { - + if (!dissector_try_uint_new(wtap_encap_dissector_table, + pinfo->fd->lnk_t, tvb, pinfo, + parent_tree, TRUE, + (void *)pinfo->pseudo_header)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP_ENCAP = %d", pinfo->fd->lnk_t); - call_dissector(data_handle,tvb, pinfo, parent_tree); + call_dissector_with_data(data_handle, + tvb, pinfo, parent_tree, + (void *)pinfo->pseudo_header); } } break; @@ -514,8 +519,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* } if (!dissector_try_uint(wtap_fts_rec_dissector_table, file_type_subtype, - tvb, pinfo, parent_tree)) { - + tvb, pinfo, parent_tree)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP_ENCAP = %d", file_type_subtype);