Bluetooth: Make Source/Destination BD_ADDRs and names filterable

Source/Destination BD_ADDRs and name are filterable.
Also simplify code around wmem trees, and enable commented "data"
field in unreassembled case and fix btl2cap offsets
(discovered by enabling "data" field).

Change-Id: Ic28c9bf19bcd6281b652be538b221da74df4bb76
Reviewed-on: https://code.wireshark.org/review/471
Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
Michal Labedzki 2014-03-03 08:50:53 +01:00 committed by Anders Broman
parent 248c284622
commit c9dd46c278
2 changed files with 149 additions and 136 deletions

View File

@ -1,12 +1,10 @@
/* TODO mix direction bit into the chandle tree lookup so we can handle when fragments sent in both directions simultaneously on the same chandle */
/* packet-bthci_acl.c
* Routines for the Bluetooth ACL dissection
* Copyright 2002, Christoph Scholz <scholz@cs.uni-bonn.de>
* From: http://affix.sourceforge.net/archive/ethereal_affix-3.patch
*
* Refactored for wireshark checkin
* Ronnie Sahlberg 2006
* - from: http://affix.sourceforge.net/archive/ethereal_affix-3.patch
* Copyright 2006, Ronnie Sahlberg
* - refactored for Wireshark checkin
* Copyright 2014, Michal Labedzki for Tieto Corporation
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
@ -43,9 +41,13 @@ static int hf_bthci_acl_chandle = -1;
static int hf_bthci_acl_pb_flag = -1;
static int hf_bthci_acl_bc_flag = -1;
static int hf_bthci_acl_length = -1;
/* static int hf_bthci_acl_data = -1; */
static int hf_bthci_acl_data = -1;
static int hf_bthci_acl_continuation_to = -1;
static int hf_bthci_acl_reassembled_in = -1;
static int hf_bthci_acl_src_bd_addr = -1;
static int hf_bthci_acl_src_name = -1;
static int hf_bthci_acl_dst_bd_addr = -1;
static int hf_bthci_acl_dst_name = -1;
/* Initialize the subtree pointers */
static gint ett_bthci_acl = -1;
@ -64,9 +66,6 @@ typedef struct _multi_fragment_pdu_t {
typedef struct _chandle_data_t {
wmem_tree_t *start_fragments; /* indexed by pinfo->fd->num */
guint32 interface_id;
guint32 adapter_id;
guint32 chandle;
} chandle_data_t;
static wmem_tree_t *chandle_tree = NULL;
@ -94,6 +93,7 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
{
proto_item *ti;
proto_tree *bthci_acl_tree;
proto_item *sub_item;
guint16 flags;
guint16 length;
gboolean fragmented;
@ -103,11 +103,13 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
bthci_acl_data_t *acl_data;
chandle_data_t *chandle_data;
hci_data_t *hci_data;
wmem_tree_key_t key[5];
guint32 k_connection_handle;
guint32 k_frame_number;
guint32 k_interface_id;
guint32 k_adapter_id;
wmem_tree_t *subtree;
wmem_tree_key_t key[6];
guint32 interface_id;
guint32 adapter_id;
guint32 connection_handle;
guint32 direction;
guint32 frame_number;
remote_bdaddr_t *remote_bdaddr;
const gchar *localhost_name;
guint8 localhost_bdaddr[6];
@ -116,6 +118,13 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
gint localhost_length;
localhost_bdaddr_entry_t *localhost_bdaddr_entry;
localhost_name_entry_t *localhost_name_entry;
const guint8 unknown_bd_addr[6] = {0, 0, 0, 0, 0, 0};
const guint8 *src_bd_addr = &unknown_bd_addr[0];
const gchar *src_name = "";
const gchar *src_addr_name = "";
const guint8 *dst_bd_addr = &unknown_bd_addr[0];
const gchar *dst_name = "";
const gchar *dst_addr_name = "";
/* Reject the packet if data is NULL */
if (data == NULL)
@ -147,35 +156,32 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
proto_tree_add_item(bthci_acl_tree, hf_bthci_acl_bc_flag, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
acl_data = wmem_new(wmem_packet_scope(), bthci_acl_data_t);
interface_id = hci_data->interface_id;
adapter_id = hci_data->adapter_id;
connection_handle = flags & 0x0fff;
direction = pinfo->p2p_dir;
frame_number = pinfo->fd->num;
acl_data->interface_id = hci_data->interface_id;
acl_data->adapter_id = hci_data->adapter_id;
acl_data->chandle = flags & 0x0fff;
acl_data = wmem_new(wmem_packet_scope(), bthci_acl_data_t);
acl_data->interface_id = interface_id;
acl_data->adapter_id = adapter_id;
acl_data->chandle = connection_handle;
acl_data->remote_bd_addr_oui = 0;
acl_data->remote_bd_addr_id = 0;
k_interface_id = hci_data->interface_id;
k_adapter_id = hci_data->adapter_id;
k_connection_handle = flags & 0x0fff;
k_frame_number = pinfo->fd->num;
key[0].length = 1;
key[0].key = &k_interface_id;
key[0].key = &interface_id;
key[1].length = 1;
key[1].key = &k_adapter_id;
key[1].key = &adapter_id;
key[2].length = 1;
key[2].key = &k_connection_handle;
key[3].length = 1;
key[3].key = &k_frame_number;
key[4].length = 0;
key[4].key = NULL;
key[2].key = &connection_handle;
key[3].length = 0;
key[3].key = NULL;
/* remote bdaddr and name */
remote_bdaddr = (remote_bdaddr_t *)wmem_tree_lookup32_array_le(hci_data->chandle_to_bdaddr_table, key);
if (remote_bdaddr && remote_bdaddr->interface_id == hci_data->interface_id &&
remote_bdaddr->adapter_id == hci_data->adapter_id &&
remote_bdaddr->chandle == (flags & 0x0fff)) {
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(hci_data->chandle_to_bdaddr_table, key);
remote_bdaddr = (subtree) ? (remote_bdaddr_t *) wmem_tree_lookup32_le(subtree, pinfo->fd->num) : NULL;
if (remote_bdaddr) {
guint32 k_bd_addr_oui;
guint32 k_bd_addr_id;
guint32 bd_addr_oui;
@ -194,19 +200,17 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
k_bd_addr_oui = bd_addr_oui;
k_bd_addr_id = bd_addr_id;
k_frame_number = pinfo->fd->num;
key[0].length = 1;
key[0].key = &k_bd_addr_id;
key[1].length = 1;
key[1].key = &k_bd_addr_oui;
key[2].length = 1;
key[2].key = &k_frame_number;
key[3].length = 0;
key[3].key = NULL;
key[2].length = 0;
key[2].key = NULL;
device_name = (device_name_t *)wmem_tree_lookup32_array_le(hci_data->bdaddr_to_name_table, key);
if (device_name && device_name->bd_addr_oui == bd_addr_oui && device_name->bd_addr_id == bd_addr_id)
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(hci_data->bdaddr_to_name_table, key);
device_name = (subtree) ? (device_name_t *) wmem_tree_lookup32_le(subtree, pinfo->fd->num) : NULL;
if (device_name)
remote_name = device_name->name;
else
remote_name = "";
@ -218,56 +222,44 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
g_snprintf(remote_addr_name, remote_length, "%s (%s)", remote_ether_addr, remote_name);
if (pinfo->p2p_dir == P2P_DIR_RECV) {
SET_ADDRESS(&pinfo->net_src, AT_STRINGZ, (int)strlen(remote_name) + 1, remote_name);
SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, remote_bdaddr->bd_addr);
SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(remote_addr_name) + 1, remote_addr_name);
src_bd_addr = remote_bdaddr->bd_addr;
src_name = remote_name;
src_addr_name = remote_addr_name;
} else if (pinfo->p2p_dir == P2P_DIR_SENT) {
SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, (int)strlen(remote_name) + 1, remote_name);
SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, remote_bdaddr->bd_addr);
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(remote_addr_name) + 1, remote_addr_name);
dst_bd_addr = remote_bdaddr->bd_addr;
dst_name = remote_name;
dst_addr_name = remote_addr_name;
}
} else {
if (pinfo->p2p_dir == P2P_DIR_RECV) {
SET_ADDRESS(&pinfo->net_src, AT_STRINGZ, 1, "");
SET_ADDRESS(&pinfo->dl_src, AT_STRINGZ, 1, "");
SET_ADDRESS(&pinfo->src, AT_STRINGZ, 10, "remote ()");
} else if (pinfo->p2p_dir == P2P_DIR_SENT) {
SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, 1, "");
SET_ADDRESS(&pinfo->dl_dst, AT_STRINGZ, 1, "");
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, 10, "remote ()");
}
if (pinfo->p2p_dir == P2P_DIR_RECV)
src_addr_name = "remote ()";
else if (pinfo->p2p_dir == P2P_DIR_SENT)
dst_addr_name = "remote ()";
}
k_interface_id = hci_data->interface_id;
k_adapter_id = hci_data->adapter_id;
k_frame_number = pinfo->fd->num;
/* localhost bdaddr and name */
key[0].length = 1;
key[0].key = &k_interface_id;
key[0].key = &interface_id;
key[1].length = 1;
key[1].key = &k_adapter_id;
key[2].length = 1;
key[2].key = &k_frame_number;
key[3].length = 0;
key[3].key = NULL;
key[1].key = &adapter_id;
key[2].length = 0;
key[2].key = NULL;
localhost_bdaddr_entry = (localhost_bdaddr_entry_t *)wmem_tree_lookup32_array_le(hci_data->localhost_bdaddr, key);
if (localhost_bdaddr_entry && localhost_bdaddr_entry->interface_id == hci_data->interface_id &&
localhost_bdaddr_entry->adapter_id == hci_data->adapter_id) {
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(hci_data->localhost_bdaddr, key);
localhost_bdaddr_entry = (subtree) ? (localhost_bdaddr_entry_t *) wmem_tree_lookup32_le(subtree, pinfo->fd->num) : NULL;
if (localhost_bdaddr_entry) {
localhost_ether_addr = get_ether_name(localhost_bdaddr_entry->bd_addr);
memcpy(localhost_bdaddr, localhost_bdaddr_entry->bd_addr, 6);
} else {
localhost_ether_addr = "localhost";
/* XXX - is this the right value to use? */
memset(localhost_bdaddr, 0, 6);
memcpy(localhost_bdaddr, unknown_bd_addr, 6);
}
localhost_name_entry = (localhost_name_entry_t *)wmem_tree_lookup32_array_le(hci_data->localhost_name, key);
if (localhost_name_entry && localhost_name_entry->interface_id == hci_data->interface_id &&
localhost_name_entry->adapter_id == hci_data->adapter_id)
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(hci_data->localhost_name, key);
localhost_name_entry = (subtree) ? (localhost_name_entry_t *) wmem_tree_lookup32_le(subtree, pinfo->fd->num) : NULL;
if (localhost_name_entry)
localhost_name = localhost_name_entry->name;
else
localhost_name = "";
@ -278,57 +270,45 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
g_snprintf(localhost_addr_name, localhost_length, "%s (%s)", localhost_ether_addr, localhost_name);
if (pinfo->p2p_dir == P2P_DIR_RECV) {
SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, (int)strlen(localhost_name) + 1, localhost_name);
SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, localhost_bdaddr);
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(localhost_addr_name) + 1, localhost_addr_name);
dst_bd_addr = localhost_bdaddr;
dst_name = localhost_name;
dst_addr_name = localhost_addr_name;
} else if (pinfo->p2p_dir == P2P_DIR_SENT) {
SET_ADDRESS(&pinfo->net_src, AT_STRINGZ, (int)strlen(localhost_name) + 1, localhost_name);
SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, localhost_bdaddr);
SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(localhost_addr_name) + 1, localhost_addr_name);
src_bd_addr = localhost_bdaddr;
src_name = localhost_name;
src_addr_name = localhost_addr_name;
}
/* find the chandle_data structure associated with this chandle */
k_interface_id = hci_data->interface_id;
k_adapter_id = hci_data->adapter_id;
k_connection_handle = flags & 0x0fff;
k_frame_number = pinfo->fd->num;
key[0].length = 1;
key[0].key = &k_interface_id;
key[0].key = &interface_id;
key[1].length = 1;
key[1].key = &k_adapter_id;
key[1].key = &adapter_id;
key[2].length = 1;
key[2].key = &k_connection_handle;
key[2].key = &connection_handle;
key[3].length = 1;
key[3].key = &k_frame_number;
key[3].key = &direction;
key[4].length = 0;
key[4].key = NULL;
chandle_data = (chandle_data_t *)wmem_tree_lookup32_array_le(chandle_tree, key);
if (!(chandle_data && chandle_data->interface_id == hci_data->interface_id &&
chandle_data->adapter_id == hci_data->adapter_id &&
chandle_data->chandle == (flags & 0x0fff))) {
k_interface_id = hci_data->interface_id;
k_adapter_id = hci_data->adapter_id;
k_connection_handle = flags & 0x0fff;
k_frame_number = pinfo->fd->num;
subtree = (wmem_tree_t *) wmem_tree_lookup32_array(chandle_tree, key);
chandle_data = (subtree) ? (chandle_data_t *) wmem_tree_lookup32_le(subtree, pinfo->fd->num) : NULL;
if (!pinfo->fd->flags.visited && !chandle_data) {
key[0].length = 1;
key[0].key = &k_interface_id;
key[0].key = &interface_id;
key[1].length = 1;
key[1].key = &k_adapter_id;
key[1].key = &adapter_id;
key[2].length = 1;
key[2].key = &k_connection_handle;
key[2].key = &connection_handle;
key[3].length = 1;
key[3].key = &k_frame_number;
key[4].length = 0;
key[4].key = NULL;
key[3].key = &direction;
key[4].length = 1;
key[4].key = &frame_number;
key[5].length = 0;
key[5].key = NULL;
chandle_data = (chandle_data_t *)wmem_alloc(wmem_file_scope(), sizeof(chandle_data_t));
chandle_data->start_fragments = wmem_tree_new(wmem_file_scope());
chandle_data->interface_id = hci_data->interface_id;
chandle_data->adapter_id = hci_data->adapter_id;
chandle_data->chandle = flags & 0x0fff;
wmem_tree_insert32_array(chandle_tree, key, chandle_data);
}
@ -357,15 +337,9 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
/* call L2CAP dissector for PDUs that are not fragmented
* also for the first fragment if reassembly is disabled
*/
next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
if (btl2cap_handle) {
call_dissector_with_data(btl2cap_handle, next_tvb, pinfo, tree, acl_data);
}
return offset;
}
if (fragmented && acl_reassembly) {
next_tvb = tvb_new_subset(tvb, offset, tvb_captured_length_remaining(tvb, offset), length);
offset += call_dissector_with_data(btl2cap_handle, next_tvb, pinfo, tree, acl_data);
} else if (fragmented && acl_reassembly) {
multi_fragment_pdu_t *mfp = NULL;
gint len;
@ -376,7 +350,7 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
mfp->last_frame = 0;
mfp->tot_len = l2cap_length + 4;
mfp->reassembled = (char *) wmem_alloc(wmem_file_scope(), mfp->tot_len);
len = tvb_length_remaining(tvb, offset);
len = tvb_captured_length_remaining(tvb, offset);
if (len <= mfp->tot_len) {
tvb_memcpy(tvb, (guint8 *) mfp->reassembled, offset, len);
mfp->cur_off = len;
@ -396,7 +370,7 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
if (pb_flag == 0x01) { /* continuation fragment */
mfp = (multi_fragment_pdu_t *)wmem_tree_lookup32_le(chandle_data->start_fragments, pinfo->fd->num);
if (!pinfo->fd->flags.visited) {
len = tvb_length_remaining(tvb, offset);
len = tvb_captured_length_remaining(tvb, offset);
if (mfp != NULL && !mfp->last_frame && (mfp->tot_len >= mfp->cur_off + len)) {
tvb_memcpy(tvb, (guint8 *) mfp->reassembled + mfp->cur_off, offset, len);
mfp->cur_off += len;
@ -416,15 +390,35 @@ dissect_bthci_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
next_tvb = tvb_new_child_real_data(tvb, (guint8 *) mfp->reassembled, mfp->tot_len, mfp->tot_len);
add_new_data_source(pinfo, next_tvb, "Reassembled BTHCI ACL");
/* call L2CAP dissector */
if (btl2cap_handle) {
call_dissector_with_data(btl2cap_handle, next_tvb, pinfo, tree, acl_data);
}
offset += call_dissector_with_data(btl2cap_handle, next_tvb, pinfo, tree, acl_data);
}
}
}
return offset;
if (tvb_captured_length_remaining(tvb, offset) > 0)
proto_tree_add_item(bthci_acl_tree, hf_bthci_acl_data, tvb, offset, -1, ENC_NA);
SET_ADDRESS(&pinfo->net_src, AT_STRINGZ, (int)strlen(src_name) + 1, src_name);
SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src_bd_addr);
SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(src_addr_name) + 1, src_addr_name);
SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, (int)strlen(dst_name) + 1, dst_name);
SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst_bd_addr);
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(dst_addr_name) + 1, dst_addr_name);
sub_item = proto_tree_add_ether(bthci_acl_tree, hf_bthci_acl_src_bd_addr, tvb, 0, 0, src_bd_addr);
PROTO_ITEM_SET_GENERATED(sub_item);
sub_item = proto_tree_add_string(bthci_acl_tree, hf_bthci_acl_src_name, tvb, 0, 0, src_name);
PROTO_ITEM_SET_GENERATED(sub_item);
sub_item = proto_tree_add_ether(bthci_acl_tree, hf_bthci_acl_dst_bd_addr, tvb, 0, 0, dst_bd_addr);
PROTO_ITEM_SET_GENERATED(sub_item);
sub_item = proto_tree_add_string(bthci_acl_tree, hf_bthci_acl_dst_name, tvb, 0, 0, dst_name);
PROTO_ITEM_SET_GENERATED(sub_item);
return tvb_captured_length(tvb);
}
@ -454,13 +448,11 @@ proto_register_bthci_acl(void)
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#if 0
{ &hf_bthci_acl_data,
{ "Data", "bthci_acl.data",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
#endif
{ &hf_bthci_acl_continuation_to,
{ "This is a continuation to the PDU in frame", "bthci_acl.continuation_to",
FT_FRAMENUM, BASE_NONE, NULL, 0x0,
@ -471,6 +463,26 @@ proto_register_bthci_acl(void)
FT_FRAMENUM, BASE_NONE, NULL, 0x0,
"This PDU is reassembled in frame #", HFILL }
},
{ &hf_bthci_acl_src_bd_addr,
{ "Source BD_ADDR", "bthci_acl.src.bd_addr",
FT_ETHER, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_bthci_acl_src_name,
{ "Source Device Name", "bthci_acl.src.name",
FT_STRINGZ, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_bthci_acl_dst_bd_addr,
{ "Destination BD_ADDR", "bthci_acl.dst.bd_addr",
FT_ETHER, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_bthci_acl_dst_name,
{ "Destination Device Name", "bthci_acl.dst.name",
FT_STRINGZ, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
};
/* Setup protocol subtree array */

View File

@ -1404,12 +1404,11 @@ dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
}
}
offset += tvb_length_remaining(tvb, offset);
offset = tvb_captured_length(tvb);
} else {
if (!dissector_try_uint_new(l2cap_cid_dissector_table, (guint32) cid, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
if (!dissector_try_uint_new(l2cap_cid_dissector_table, (guint32) cid, next_tvb, pinfo, tree, TRUE, l2cap_data))
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
offset += tvb_length_remaining(tvb, offset);
}
offset = tvb_captured_length(tvb);
}
return offset;
}
@ -1825,13 +1824,14 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
}
offset = tvb_captured_length(tvb);
}
}
else if (cid <= BTL2CAP_FIXED_CID_LAST) {
if (cid == BTL2CAP_FIXED_CID_AMP_MAN) {
control = tvb_get_letohs(tvb, offset);
if (control & 0x1) {
dissect_s_frame(tvb, pinfo, tree, btl2cap_tree, 0 /* unused */, length, offset, NULL /* unused */);
offset = dissect_s_frame(tvb, pinfo, tree, btl2cap_tree, 0 /* unused */, length, offset, NULL /* unused */);
} else {
proto_item* ti_control;
proto_tree* ti_control_subtree;
@ -1863,6 +1863,7 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* unknown protocol. declare as data */
proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, tvb, offset, length, ENC_NA);
}
offset = tvb_captured_length(tvb);
}
else /* if (cid > BTL2CAP_FIXED_CID_LAST) */ { /* Connection oriented channel */
wmem_tree_key_t key[6];
@ -1933,18 +1934,18 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
else
config_data = &(psm_data->out);
if (config_data->mode == 0) {
dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, cid, psm, psm_data->local_service, length, offset, l2cap_data);
offset = dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, cid, psm, psm_data->local_service, length, offset, l2cap_data);
} else {
control = tvb_get_letohs(tvb, offset);
if (control & 0x1) {
dissect_s_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset, config_data);
offset = dissect_s_frame(tvb, pinfo, tree, btl2cap_tree, psm, length, offset, config_data);
} else {
dissect_i_frame(tvb, pinfo, tree, btl2cap_tree, psm_data, length, offset, config_data, l2cap_data);
offset = dissect_i_frame(tvb, pinfo, tree, btl2cap_tree, psm_data, length, offset, config_data, l2cap_data);
}
}
} else {
psm = 0;
dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, cid, psm, FALSE, length, offset, l2cap_data);
offset = dissect_b_frame(tvb, pinfo, tree, btl2cap_tree, cid, psm, FALSE, length, offset, l2cap_data);
}
}