aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2011-05-12 03:18:34 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2011-05-12 03:18:34 +0000
commit009156289f5af6d6abe25c0b24f0b439bc996f47 (patch)
treec103eac46fa0a63a2535c91386947715c15589e6
parent995d748f0561867b02682d2468fb7ae935866de3 (diff)
Fix the test.sh failures based on Guy's suggestion in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5445#c15 :
Add a new tap flag to indicate that a tap listener is just a "dissector helper", that is, a tap which is used by a dissector to help it do its dissection but does not, itself, require dissection. Use this new flag in the dissectors which register taps. Remove the (now-unused) have_tap_listeners() function. svn path=/trunk/; revision=37069
-rw-r--r--epan/dissectors/packet-btl2cap.c34
-rw-r--r--epan/dissectors/packet-btrfcomm.c40
-rw-r--r--epan/dissectors/packet-smb.c2
-rw-r--r--epan/dissectors/packet-smb2.c4
-rw-r--r--epan/libwireshark.def2
-rw-r--r--epan/tap.c17
-rw-r--r--epan/tap.h11
-rw-r--r--tshark.c6
8 files changed, 65 insertions, 51 deletions
diff --git a/epan/dissectors/packet-btl2cap.c b/epan/dissectors/packet-btl2cap.c
index c90a3f50f6..b385314403 100644
--- a/epan/dissectors/packet-btl2cap.c
+++ b/epan/dissectors/packet-btl2cap.c
@@ -417,7 +417,7 @@ dissect_movechanrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
{
guint16 icid;
guint8 ctrl_id;
-
+
icid = tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btl2cap_icid, tvb, offset, 2, TRUE);
offset+=2;
@@ -427,7 +427,7 @@ dissect_movechanrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
offset+=1;
col_append_fstr(pinfo->cinfo, COL_INFO, " (ICID: 0x%04x, move to %s)", icid, val_to_str(ctrl_id, ctrl_id_code_vals, "Unknown controller"));
-
+
return offset;
}
@@ -581,7 +581,7 @@ dissect_configrequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_t
offset+=2;
col_append_fstr(pinfo->cinfo, COL_INFO, " (DCID: 0x%04x)", dcid);
-
+
proto_tree_add_item(tree, hf_btl2cap_continuation_flag, tvb, offset, 2, TRUE);
offset+=2;
@@ -604,7 +604,7 @@ static int
dissect_inforequest(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
guint16 info_type;
-
+
info_type=tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btl2cap_info_type, tvb, offset, 2, TRUE);
offset+=2;
@@ -632,7 +632,7 @@ dissect_inforesponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr
col_append_fstr(pinfo->cinfo, COL_INFO, " (%s, %s)",
val_to_str(info_type, info_type_vals, "Unknown type"),
val_to_str(result, info_result_vals, "Unknown result"));
-
+
if(tvb_length_remaining(tvb, offset)) {
switch(info_type){
case 0x0001: /* Connectionless MTU */
@@ -728,7 +728,7 @@ dissect_configresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_
offset+=2;
col_append_fstr(pinfo->cinfo, COL_INFO, " - %s (SCID: 0x%04x)", val_to_str(result, configuration_result_vals, "Unknown"), scid);
-
+
if(tvb_length_remaining(tvb, offset)){
if (psm_data)
if(pinfo->p2p_dir==P2P_DIR_RECV)
@@ -770,7 +770,7 @@ dissect_connresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
else {
col_append_fstr(pinfo->cinfo, COL_INFO, " - %s (SCID: 0x%04x)", val_to_str(result, result_vals, "Unknown"), scid);
}
-
+
if (pinfo->fd->flags.visited == 0) {
if((psm_data=se_tree_lookup32(cid_to_psm_table, scid|((pinfo->p2p_dir==P2P_DIR_RECV)?0x0000:0x8000)))){
se_tree_insert32(cid_to_psm_table, dcid|((pinfo->p2p_dir == P2P_DIR_RECV)?0x8000:0x0000), psm_data);
@@ -790,7 +790,7 @@ static int
dissect_movechanresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
guint16 icid, result;
-
+
icid = tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btl2cap_icid, tvb, offset, 2, TRUE);
offset+=2;
@@ -800,7 +800,7 @@ dissect_movechanresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, prot
offset+=2;
col_append_fstr(pinfo->cinfo, COL_INFO, " (ICID: 0x%04x, %s)", icid, val_to_str(result, move_result_vals, "Unknown result"));
-
+
return offset;
}
@@ -808,7 +808,7 @@ static int
dissect_movechanconfirmation(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
guint16 icid, result;
-
+
icid = tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btl2cap_icid, tvb, offset, 2, TRUE);
offset+=2;
@@ -826,7 +826,7 @@ static int
dissect_movechanconfirmationresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
guint16 icid;
-
+
icid = tvb_get_letohs(tvb, offset);
proto_tree_add_item(tree, hf_btl2cap_icid, tvb, offset, 2, TRUE);
offset+=2;
@@ -849,7 +849,7 @@ dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo _U_
offset+=2;
col_append_fstr(pinfo->cinfo, COL_INFO, " (SCID: 0x%04x, DCID: 0x%04x)", scid, dcid);
-
+
return offset;
}
@@ -1164,7 +1164,7 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
cmd_str = val_to_str(cmd_code, command_code_vals, "Unknown cmd");
proto_item_append_text(ti_command,"%s", cmd_str);
col_append_fstr(pinfo->cinfo, COL_INFO, "%s", cmd_str);
-
+
switch(cmd_code) {
case 0x01: /* Command Reject */
offset=dissect_comrej(tvb, offset, pinfo, btl2cap_cmd_tree);
@@ -1255,7 +1255,7 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* not a known fixed PSM, try to find a registered service to a dynamic PSM */
guint32 *service;
service=se_tree_lookup32(psm_to_service_table, ((pinfo->p2p_dir==P2P_DIR_RECV)?0x80000000:0) | psm);
-
+
if(!service || !dissector_try_uint(l2cap_service_dissector_table, *service, next_tvb, pinfo, tree)) {
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, TRUE);
@@ -1401,7 +1401,7 @@ proto_register_btl2cap(void)
},
{ &hf_btl2cap_psm_dynamic,
{ "Dynamic PSM", "btl2cap.psm",
- FT_UINT16, BASE_HEX, NULL, 0x0,
+ FT_UINT16, BASE_HEX, NULL, 0x0,
"Dynamic Protocol/Service Multiplexer", HFILL }
},
{ &hf_btl2cap_scid,
@@ -1780,13 +1780,13 @@ proto_register_btl2cap(void)
}
-void
+void
proto_reg_handoff_btl2cap(void)
{
/* tap into the btsdp dissector to look for l2cap PSM infomation that
helps us determine the type of l2cap payload, i.e. which service is
using the PSM channel so we know which sub-dissector to call */
- register_tap_listener("btsdp", NULL, NULL, 0, NULL, btl2cap_sdp_tap_packet, NULL);
+ register_tap_listener("btsdp", NULL, NULL, TL_IS_DISSECTOR_HELPER, NULL, btl2cap_sdp_tap_packet, NULL);
}
diff --git a/epan/dissectors/packet-btrfcomm.c b/epan/dissectors/packet-btrfcomm.c
index 1eeade23b9..bfaabeabe5 100644
--- a/epan/dissectors/packet-btrfcomm.c
+++ b/epan/dissectors/packet-btrfcomm.c
@@ -288,12 +288,12 @@ dissect_ctrl_pn(packet_info *pinfo, proto_tree *t, tvbuff_t *tvb, int offset, in
if(!pinfo->fd->flags.visited){
guint32 token;
-
+
if( pinfo->p2p_dir == cr_flag )
token = dlci | 0x01; /* local service */
else
token = dlci;
-
+
dlci_state=se_tree_lookup32(dlci_table, token);
if(!dlci_state){
dlci_state=se_alloc0(sizeof(dlci_state_t));
@@ -539,10 +539,10 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset=dissect_btrfcomm_Control(tvb, offset, rfcomm_tree, &pf_flag, &frame_type);
/* payload length */
offset=dissect_btrfcomm_PayloadLen(tvb, offset, rfcomm_tree, &frame_len);
-
+
if (dlci && (frame_len || (frame_type == 0xef) || (frame_type == 0x2f) )) {
guint32 token;
-
+
if( pinfo->p2p_dir == cr_flag )
token = dlci | 0x01; /* local service */
else
@@ -554,7 +554,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
se_tree_insert32(dlci_table, token, dlci_state);
}
}
-
+
if ((check_col(pinfo->cinfo, COL_INFO))){
col_append_fstr(pinfo->cinfo, COL_INFO, "%s DLCI=%d ", val_to_str(frame_type, vs_frame_type_short, "Unknown"), dlci);
if(dlci && (frame_type == 0x2f))
@@ -632,7 +632,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
rfcomm_data.cid = l2cap_data->cid;
rfcomm_data.dlci = dlci;
- if(!dissector_try_uint(rfcomm_service_dissector_table, dlci_state->service,
+ if(!dissector_try_uint(rfcomm_service_dissector_table, dlci_state->service,
next_tvb, pinfo, tree)){
/* unknown service, let the data dissector handle it */
call_dissector(data_handle, next_tvb, pinfo, tree);
@@ -792,7 +792,7 @@ proto_register_btrfcomm(void)
proto_register_subtree_array(ett, array_length(ett));
rfcomm_service_dissector_table = register_dissector_table("btrfcomm.service", "RFCOMM SERVICE", FT_UINT16, BASE_HEX);
-
+
dlci_table=se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "RFCOMM dlci table");
}
@@ -827,11 +827,11 @@ proto_reg_handoff_btrfcomm(void)
dissector_add_uint("btl2cap.psm", BTL2CAP_PSM_RFCOMM, btrfcomm_handle);
data_handle = find_dissector("data");
-
+
/* tap into the btsdp dissector to look for rfcomm channel infomation that
helps us determine the type of rfcomm payload, i.e. which service is
using the channels so we know which sub-dissector to call */
- register_tap_listener("btsdp", NULL, NULL, 0, NULL, btrfcomm_sdp_tap_packet, NULL);
+ register_tap_listener("btsdp", NULL, NULL, TL_IS_DISSECTOR_HELPER, NULL, btrfcomm_sdp_tap_packet, NULL);
}
/* Bluetooth Handsfree (HF) profile dissection */
@@ -881,9 +881,9 @@ void
proto_reg_handoff_bthf(void)
{
dissector_handle_t bthf_handle;
-
+
bthf_handle = create_dissector_handle(dissect_bthf, proto_bthf);
-
+
dissector_add_uint("btrfcomm.service", BTSDP_HFP_SERVICE_UUID, bthf_handle);
dissector_add_uint("btrfcomm.service", BTSDP_HFP_GW_SERVICE_UUID, bthf_handle);
}
@@ -918,14 +918,14 @@ dissect_btdun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
else {
/* ... or raw PPP */
- if( ppp_handle )
- call_dissector(ppp_handle, tvb, pinfo, tree);
+ if( ppp_handle )
+ call_dissector(ppp_handle, tvb, pinfo, tree);
else {
/* TODO: remove the above 'if' and this 'else-body' when "ppp_raw_hdlc" is available, requires that it is
made non-anonymous in ppp dissector to use */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPP");
col_add_fstr(pinfo->cinfo, COL_INFO, "%s <PPP frame>", pinfo->p2p_dir==P2P_DIR_SENT?"Sent":"Rcvd");
-
+
call_dissector(data_handle, tvb, pinfo, tree);
}
}
@@ -958,12 +958,12 @@ void
proto_reg_handoff_btdun(void)
{
dissector_handle_t btdun_handle;
-
+
btdun_handle = create_dissector_handle(dissect_btdun, proto_btdun);
-
+
dissector_add_uint("btrfcomm.service", BTSDP_DUN_SERVICE_UUID, btdun_handle);
- ppp_handle = find_dissector("ppp_raw_hdlc");
+ ppp_handle = find_dissector("ppp_raw_hdlc");
}
/* Bluetooth Serial Port profile (SPP) dissection */
@@ -979,7 +979,7 @@ dissect_btspp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(tree, proto_btspp, tvb, 0, -1, FALSE);
st = proto_item_add_subtree(ti, ett_btspp);
-
+
length = MIN(length,60);
ascii_only = TRUE;
for(i=0;i<length && ascii_only;i++) {
@@ -1022,9 +1022,9 @@ void
proto_reg_handoff_btspp(void)
{
dissector_handle_t btspp_handle;
-
+
btspp_handle = create_dissector_handle(dissect_btspp, proto_btspp);
-
+
dissector_add_uint("btrfcomm.service", BTSDP_SPP_SERVICE_UUID, btspp_handle);
}
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index 9241a2fb52..4e63034d8e 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -6974,7 +6974,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree
* we exit from this dissector.
*/
error_string=register_tap_listener("ntlmssp", NULL, NULL,
- 0, NULL, NULL, NULL);
+ TL_IS_DISSECTOR_HELPER, NULL, NULL, NULL);
if(!error_string){
ntlmssp_tap_id=find_tap_id("ntlmssp");
}
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c
index af89ad3d58..320112a134 100644
--- a/epan/dissectors/packet-smb2.c
+++ b/epan/dissectors/packet-smb2.c
@@ -2025,7 +2025,7 @@ dissect_smb2_session_setup_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree
* we exit from this dissector.
*/
error_string=register_tap_listener("ntlmssp", NULL, NULL,
- 0, NULL, NULL, NULL);
+ TL_IS_DISSECTOR_HELPER, NULL, NULL, NULL);
if(!error_string){
ntlmssp_tap_id=find_tap_id("ntlmssp");
}
@@ -3678,7 +3678,7 @@ dissect_smb2_write_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* flags */
proto_tree_add_bitmask(tree, tvb, offset, hf_smb2_write_flags, ett_smb2_write_flags, f_fields, TRUE);
offset += 4;
-
+
/* data or dcerpc ?*/
if(length && si->tree && si->tree->share_type == SMB2_SHARE_TYPE_PIPE){
offset = dissect_file_data_dcerpc(tvb, pinfo, tree, offset, length, si->top_tree);
diff --git a/epan/libwireshark.def b/epan/libwireshark.def
index c12a542977..1bad5dea64 100644
--- a/epan/libwireshark.def
+++ b/epan/libwireshark.def
@@ -603,7 +603,6 @@ h248_register_package
has_global_profiles
have_custom_cols
have_filtering_tap_listeners
-have_tap_listeners
heur_dissector_add
heur_dissector_delete
hex_str_to_bytes
@@ -1018,6 +1017,7 @@ tap_build_interesting
tap_queue_init
tap_queue_packet
tcp_dissect_pdus
+tap_listeners_require_dissection
test_for_directory
test_for_fifo
tfs_accept_reject DATA
diff --git a/epan/tap.c b/epan/tap.c
index 1e356bcda5..7518e5050c 100644
--- a/epan/tap.c
+++ b/epan/tap.c
@@ -508,12 +508,23 @@ remove_tap_listener(void *tapdata)
}
/*
- * Return TRUE if we have tap listeners, FALSE otherwise.
+ * Return TRUE if we have one or more tap listeners that require dissection,
+ * FALSE otherwise.
*/
gboolean
-have_tap_listeners(void)
+tap_listeners_require_dissection(void)
{
- return tap_listener_queue != NULL;
+ volatile tap_listener_t *tap_queue = tap_listener_queue;
+
+ while(tap_queue) {
+ if(!(tap_queue->flags & TL_IS_DISSECTOR_HELPER))
+ return TRUE;
+
+ tap_queue = tap_queue->next;
+ }
+
+ return FALSE;
+
}
/* Returns TRUE there is an active tap listener for the specified tap id. */
diff --git a/epan/tap.h b/epan/tap.h
index 4624a5fe92..48a5c834af 100644
--- a/epan/tap.h
+++ b/epan/tap.h
@@ -6,17 +6,17 @@
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -37,6 +37,9 @@ typedef void (*tap_draw_cb)(void *tapdata);
#define TL_REQUIRES_NOTHING 0x00000000 /**< nothing */
#define TL_REQUIRES_PROTO_TREE 0x00000001 /**< full protocol tree */
#define TL_REQUIRES_COLUMNS 0x00000002 /**< columns */
+/* Flags to indicate what the tap listener does */
+#define TL_IS_DISSECTOR_HELPER 0x00000004 /** tap helps a dissector do work
+ ** but does not, itself, require dissection */
extern void tap_init(void);
extern int register_tap(const char *name);
@@ -52,7 +55,7 @@ extern GString *register_tap_listener(const char *tapname, void *tapdata,
tap_packet_cb tap_packet, tap_draw_cb tap_draw);
extern GString *set_tap_dfilter(void *tapdata, const char *fstring);
extern void remove_tap_listener(void *tapdata);
-extern gboolean have_tap_listeners(void);
+extern gboolean tap_listeners_require_dissection(void);
extern gboolean have_tap_listener(int tap_id);
extern gboolean have_filtering_tap_listeners(void);
extern guint union_of_tap_listener_flags(void);
diff --git a/tshark.c b/tshark.c
index 8a79128f2e..38964e75d8 100644
--- a/tshark.c
+++ b/tshark.c
@@ -1605,7 +1605,7 @@ main(int argc, char *argv[])
if we're writing to a pipe. */
if (global_capture_opts.saving_to_file &&
global_capture_opts.output_to_pipe) {
- if (have_tap_listeners()) {
+ if (tap_listeners_require_dissection()) {
cmdarg_err("Taps aren't supported when saving to a pipe.");
return 1;
}
@@ -1680,8 +1680,8 @@ main(int argc, char *argv[])
we're using a read filter on the packets;
- we're using any taps. */
- do_dissection = print_packet_info || rfcode || have_tap_listeners();
+ we're using any taps that need dissection. */
+ do_dissection = print_packet_info || rfcode || tap_listeners_require_dissection();
if (cf_name) {
/*