aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-28 18:11:02 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-28 18:11:02 +0000
commit8dab82556c2a4799800b09a111dab61cb9935883 (patch)
tree8d58b8edafc5053ada1654af6955dffa1b9753b4
parent30ae01c73bee0443409e29141ff23bc4629ef736 (diff)
Bluetooth improvements. Bug 9446 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9446)
From Michal Labedzki. 1. Bluetooth: HFP: Fix recognizing roles. There is need to check which side SDP record is, then it is possible to recognize roles. 2. Bluetooth: RFCOMM/HFP: Fix recognizing services and roles. Direction bit means only that device is initiator of connection or not. But need information who is owner of connection (remote device or localhost), so use this information from L2CAP. 3. Bluetooth: HFP: Fix unexpected expert info 4. Bluetooth: HCI: Set addresses to host/controller. Also optimize a little handing of dissectors handles. svn path=/trunk/; revision=53628
-rw-r--r--epan/dissectors/packet-bthci_cmd.c9
-rw-r--r--epan/dissectors/packet-bthci_evt.c9
-rw-r--r--epan/dissectors/packet-bthfp.c12
-rw-r--r--epan/dissectors/packet-btl2cap.h1
-rw-r--r--epan/dissectors/packet-btrfcomm.c3
-rw-r--r--epan/dissectors/packet-btrfcomm.h15
6 files changed, 29 insertions, 20 deletions
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index ef2f0888ba..5beea2fe52 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -410,6 +410,8 @@ static gint ett_eir_subtree = -1;
static gint ett_eir_struct_subtree = -1;
static gint ett_flow_spec_subtree = -1;
+static dissector_handle_t bthci_cmd_handle;
+
extern value_string_ext ext_usb_vendors_vals;
extern value_string_ext ext_usb_products_vals;
extern value_string_ext did_vendor_id_source_vals_ext;
@@ -3237,6 +3239,9 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
}
+ SET_ADDRESS(&pinfo->src, AT_STRINGZ, 5, "host");
+ SET_ADDRESS(&pinfo->dst, AT_STRINGZ, 11, "controller");
+
opcode = tvb_get_letohs(tvb, offset);
ocf = opcode & 0x03ff;
ogf = (guint8) (opcode >> 10);
@@ -5146,7 +5151,7 @@ proto_register_bthci_cmd(void)
/* Register the protocol name and description */
proto_bthci_cmd = proto_register_protocol("Bluetooth HCI Command", "HCI_CMD", "bthci_cmd");
- new_register_dissector("bthci_cmd", dissect_bthci_cmd, proto_bthci_cmd);
+ bthci_cmd_handle = new_register_dissector("bthci_cmd", dissect_bthci_cmd, proto_bthci_cmd);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_bthci_cmd, hf, array_length(hf));
@@ -5169,8 +5174,6 @@ proto_register_bthci_cmd(void)
void
proto_reg_handoff_bthci_cmd(void)
{
- dissector_handle_t bthci_cmd_handle;
- bthci_cmd_handle = find_dissector("bthci_cmd");
dissector_add_uint("hci_h4.type", HCI_H4_TYPE_CMD, bthci_cmd_handle);
dissector_add_uint("hci_h1.type", BTHCI_CHANNEL_COMMAND, bthci_cmd_handle);
}
diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c
index f1dbc04073..f79b8701cd 100644
--- a/epan/dissectors/packet-bthci_evt.c
+++ b/epan/dissectors/packet-bthci_evt.c
@@ -44,6 +44,7 @@
#include "packet-sdp.h"
static dissector_handle_t bthci_cmd_handle;
+static dissector_handle_t bthci_evt_handle;
/* Initialize the protocol and registered fields */
static int proto_bthci_evt = -1;
@@ -3662,6 +3663,9 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
}
+ SET_ADDRESS(&pinfo->src, AT_STRINGZ, 11, "controller");
+ SET_ADDRESS(&pinfo->dst, AT_STRINGZ, 5, "host");
+
hci_data = (hci_data_t *) data;
DISSECTOR_ASSERT(hci_data);
@@ -5845,7 +5849,7 @@ proto_register_bthci_evt(void)
/* Register the protocol name and description */
proto_bthci_evt = proto_register_protocol("Bluetooth HCI Event",
"HCI_EVT", "bthci_evt");
- new_register_dissector("bthci_evt", dissect_bthci_evt, proto_bthci_evt);
+ bthci_evt_handle = new_register_dissector("bthci_evt", dissect_bthci_evt, proto_bthci_evt);
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_bthci_evt, hf, array_length(hf));
@@ -5864,9 +5868,6 @@ proto_register_bthci_evt(void)
void
proto_reg_handoff_bthci_evt(void)
{
- dissector_handle_t bthci_evt_handle;
-
- bthci_evt_handle = find_dissector("bthci_evt");
dissector_add_uint("hci_h4.type", HCI_H4_TYPE_EVT, bthci_evt_handle);
dissector_add_uint("hci_h1.type", BTHCI_CHANNEL_EVENT, bthci_evt_handle);
diff --git a/epan/dissectors/packet-bthfp.c b/epan/dissectors/packet-bthfp.c
index 26b90ee028..3e35458d5d 100644
--- a/epan/dissectors/packet-bthfp.c
+++ b/epan/dissectors/packet-bthfp.c
@@ -619,7 +619,7 @@ dissect_bcs_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
pitem = proto_tree_add_uint(tree, hf_bcs_codec, tvb, offset, parameter_length, value);
- if (value > 1) {
+ if (value < 1 || value > 2) {
expert_add_info(pinfo, pitem, &ei_bcs);
}
@@ -642,7 +642,7 @@ dissect_bac_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
pitem = proto_tree_add_uint(tree, hf_bac_codec, tvb, offset, parameter_length, value);
- if (value > 1) {
+ if (value < 1 || value > 2) {
expert_add_info(pinfo, pitem, &ei_bac);
}
@@ -1207,7 +1207,7 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
k_interface_id = rfcomm_data->interface_id;
k_adapter_id = rfcomm_data->adapter_id;
k_sdp_psm = SDP_PSM_DEFAULT;
- k_direction = (rfcomm_data->dlci & 0x01) ? P2P_DIR_SENT : P2P_DIR_RECV;
+ k_direction = (rfcomm_data->is_local_psm) ? P2P_DIR_SENT : P2P_DIR_RECV;
if (k_direction == P2P_DIR_RECV) {
k_bd_addr_oui = rfcomm_data->remote_bd_addr_oui;
k_bd_addr_id = rfcomm_data->remote_bd_addr_id;
@@ -1252,8 +1252,10 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
service_info->bd_addr_id == 0)) &&
service_info->type == BTSDP_RFCOMM_PROTOCOL_UUID &&
service_info->channel == (rfcomm_data->dlci >> 1)) {
- if ((service_info->uuid.bt_uuid == BTSDP_HFP_GW_SERVICE_UUID && pinfo->p2p_dir == P2P_DIR_SENT) ||
- (service_info->uuid.bt_uuid == BTSDP_HFP_SERVICE_UUID && pinfo->p2p_dir == P2P_DIR_RECV)) {
+ if ((service_info->uuid.bt_uuid == BTSDP_HFP_GW_SERVICE_UUID && service_info->direction == P2P_DIR_RECV && pinfo->p2p_dir == P2P_DIR_SENT) ||
+ (service_info->uuid.bt_uuid == BTSDP_HFP_GW_SERVICE_UUID && service_info->direction == P2P_DIR_SENT && pinfo->p2p_dir == P2P_DIR_RECV) ||
+ (service_info->uuid.bt_uuid == BTSDP_HFP_SERVICE_UUID && service_info->direction == P2P_DIR_RECV && pinfo->p2p_dir == P2P_DIR_RECV) ||
+ (service_info->uuid.bt_uuid == BTSDP_HFP_SERVICE_UUID && service_info->direction == P2P_DIR_SENT && pinfo->p2p_dir == P2P_DIR_SENT)) {
role = ROLE_HS;
} else {
role = ROLE_AG;
diff --git a/epan/dissectors/packet-btl2cap.h b/epan/dissectors/packet-btl2cap.h
index 533902a7be..4bcb3d446e 100644
--- a/epan/dissectors/packet-btl2cap.h
+++ b/epan/dissectors/packet-btl2cap.h
@@ -56,6 +56,7 @@ typedef struct _btl2cap_data_t {
guint32 adapter_id;
guint16 chandle; /* only low 12 bits used */
guint16 cid;
+ gboolean is_local_psm; /* otherwise it is PSM in remote device */
guint16 psm;
guint32 first_scid_frame;
guint32 first_dcid_frame;
diff --git a/epan/dissectors/packet-btrfcomm.c b/epan/dissectors/packet-btrfcomm.c
index 99ccd47e49..f5e3a7d2d1 100644
--- a/epan/dissectors/packet-btrfcomm.c
+++ b/epan/dissectors/packet-btrfcomm.c
@@ -627,7 +627,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
k_interface_id = l2cap_data->interface_id;
k_adapter_id = l2cap_data->adapter_id;
k_sdp_psm = SDP_PSM_DEFAULT;
- k_direction = (dlci & 0x01) ? P2P_DIR_SENT : P2P_DIR_RECV;
+ k_direction = (l2cap_data->is_local_psm) ? P2P_DIR_SENT : P2P_DIR_RECV;
if (k_direction == P2P_DIR_RECV) {
k_bd_addr_oui = l2cap_data->remote_bd_addr_oui;
k_bd_addr_id = l2cap_data->remote_bd_addr_id;
@@ -780,6 +780,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
rfcomm_data->adapter_id = l2cap_data->adapter_id;
rfcomm_data->chandle = l2cap_data->chandle;
rfcomm_data->cid = l2cap_data->cid;
+ rfcomm_data->is_local_psm = l2cap_data->is_local_psm;
rfcomm_data->dlci = dlci;
rfcomm_data->remote_bd_addr_oui = l2cap_data->remote_bd_addr_oui;
rfcomm_data->remote_bd_addr_id = l2cap_data->remote_bd_addr_id;
diff --git a/epan/dissectors/packet-btrfcomm.h b/epan/dissectors/packet-btrfcomm.h
index 78c2b83dae..c613c3be31 100644
--- a/epan/dissectors/packet-btrfcomm.h
+++ b/epan/dissectors/packet-btrfcomm.h
@@ -27,13 +27,14 @@
extern int proto_btrfcomm;
typedef struct _btrfcomm_data_t {
- guint32 interface_id;
- guint32 adapter_id;
- guint16 chandle; /* only low 12 bits used */
- guint16 cid;
- guint8 dlci;
- guint32 remote_bd_addr_oui;
- guint32 remote_bd_addr_id;
+ guint32 interface_id;
+ guint32 adapter_id;
+ guint16 chandle; /* only low 12 bits used */
+ guint16 cid;
+ gboolean is_local_psm; /* otherwise it is PSM in remote device */
+ guint8 dlci;
+ guint32 remote_bd_addr_oui;
+ guint32 remote_bd_addr_id;
} btrfcomm_data_t;
#endif