aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2015-05-13 17:33:28 +0200
committerMichal Labedzki <michal.labedzki@tieto.com>2015-06-15 05:40:25 +0000
commit7102a06811ab63e0433ac91ad242e02c5668d259 (patch)
tree128482bd4b38cb6d4f56344261d94ea76db1c7e1 /epan
parent9fb6ec6c89631f2fbb5228d8f81a727f6d1fee27 (diff)
Qt/Bluetooth: Add Devices dialogue
Please found it under Bluetooth menu. It shows all devices found in logs, not only connected, all that its address can be found in logs. Show if device is local (in most cases: capturing on it side) and manufacturer and LMP version what should answer the question what version of Bluetooth is used by Bluetooth device chip. Also firmware version. Change-Id: I32e3b7100cdebcaa850b6541de0ab89dff41c0e1 Reviewed-on: https://code.wireshark.org/review/8901 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Tested-by: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-bluetooth.c19
-rw-r--r--epan/dissectors/packet-bluetooth.h42
-rw-r--r--epan/dissectors/packet-btatt.c2
-rw-r--r--epan/dissectors/packet-bthci_cmd.c169
-rw-r--r--epan/dissectors/packet-bthci_cmd.h4
-rw-r--r--epan/dissectors/packet-bthci_evt.c350
-rw-r--r--epan/dissectors/packet-bthci_evt.h11
-rw-r--r--epan/dissectors/packet-bthci_vendor.c8
-rw-r--r--epan/dissectors/packet-btle.c16
-rw-r--r--epan/dissectors/packet-btobex.c47
-rw-r--r--epan/dissectors/packet-btsmp.c17
-rw-r--r--epan/dissectors/packet-hci_mon.c2
12 files changed, 480 insertions, 207 deletions
diff --git a/epan/dissectors/packet-bluetooth.c b/epan/dissectors/packet-bluetooth.c
index c89dd492a0..60031c7d43 100644
--- a/epan/dissectors/packet-bluetooth.c
+++ b/epan/dissectors/packet-bluetooth.c
@@ -60,6 +60,7 @@ static wmem_tree_t *localhost_bdaddr = NULL;
static wmem_tree_t *hci_vendors = NULL;
static int bluetooth_tap = -1;
+int bluetooth_device_tap = -1;
const value_string bluetooth_uuid_vals[] = {
/* Protocol Identifiers - https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery */
@@ -1025,7 +1026,9 @@ void proto_reg_handoff_bluetooth(void);
gint
-dissect_bd_addr(gint hf_bd_addr, proto_tree *tree, tvbuff_t *tvb, gint offset, guint8 *bdaddr)
+dissect_bd_addr(gint hf_bd_addr, packet_info *pinfo, proto_tree *tree,
+ tvbuff_t *tvb, gint offset, gboolean is_local_bd_addr,
+ guint32 interface_id, guint32 adapter_id, guint8 *bdaddr)
{
guint8 bd_addr[6];
@@ -1039,6 +1042,19 @@ dissect_bd_addr(gint hf_bd_addr, proto_tree *tree, tvbuff_t *tvb, gint offset, g
proto_tree_add_ether(tree, hf_bd_addr, tvb, offset, 6, bd_addr);
offset += 6;
+ if (have_tap_listener(bluetooth_device_tap)) {
+ bluetooth_device_tap_t *tap_device;
+
+ tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
+ tap_device->interface_id = interface_id;
+ tap_device->adapter_id = adapter_id;
+ memcpy(tap_device->bd_addr, bd_addr, 6);
+ tap_device->has_bd_addr = TRUE;
+ tap_device->is_local = is_local_bd_addr;
+ tap_device->type = BLUETOOTH_DEVICE_BD_ADDR;
+ tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
+ }
+
if (bdaddr)
memcpy(bdaddr, bd_addr, 6);
@@ -1403,6 +1419,7 @@ proto_register_bluetooth(void)
hci_vendor_table = register_dissector_table("bluetooth.vendor", "HCI Vendor", FT_UINT16, BASE_HEX);
bluetooth_tap = register_tap("bluetooth");
+ bluetooth_device_tap = register_tap("bluetooth.device");
register_conversation_table(proto_bluetooth, TRUE, bluetooth_conversation_packet, bluetooth_hostlist_packet);
}
diff --git a/epan/dissectors/packet-bluetooth.h b/epan/dissectors/packet-bluetooth.h
index 69e7a02965..b072173140 100644
--- a/epan/dissectors/packet-bluetooth.h
+++ b/epan/dissectors/packet-bluetooth.h
@@ -183,15 +183,51 @@ typedef struct _bluetooth_uuid_custom {
const gchar *name;
} bluetooth_uuid_custom_t;
+enum bluetooth_device_type {
+ BLUETOOTH_DEVICE_BD_ADDR,
+ BLUETOOTH_DEVICE_NAME,
+ BLUETOOTH_DEVICE_LOCAL_ADAPTER,
+ BLUETOOTH_DEVICE_LOCAL_VERSION,
+ BLUETOOTH_DEVICE_REMOTE_VERSION
+};
+
+typedef struct _bluetooth_device_tap_t {
+ guint32 interface_id;
+ guint32 adapter_id;
+
+ gboolean is_local;
+ gboolean has_bd_addr;
+ guint8 bd_addr[6];
+ enum bluetooth_device_type type;
+ union {
+ char *name;
+ struct {
+ guint8 hci_version;
+ guint16 hci_revision;
+ guint8 lmp_version;
+ guint16 lmp_subversion;
+ guint16 manufacturer;
+ } local_version;
+ struct {
+ guint8 lmp_version;
+ guint16 lmp_subversion;
+ guint16 manufacturer;
+ } remote_version;
+ } data;
+} bluetooth_device_tap_t;
+
+extern int bluetooth_device_tap;
+
WS_DLL_PUBLIC const value_string bluetooth_uuid_vals[];
WS_DLL_PUBLIC const bluetooth_uuid_custom_t bluetooth_uuid_custom[];
WS_DLL_PUBLIC value_string_ext bluetooth_uuid_vals_ext;
-extern value_string_ext bluetooth_company_id_vals_ext;
+WS_DLL_PUBLIC value_string_ext bluetooth_company_id_vals_ext;
extern guint32 max_disconnect_in_frame;
-extern gint dissect_bd_addr(gint hf_bd_addr, proto_tree *tree, tvbuff_t *tvb,
- gint offset, guint8 *bdaddr);
+extern gint dissect_bd_addr(gint hf_bd_addr, packet_info *pinfo, proto_tree *tree,
+ tvbuff_t *tvb, gint offset, gboolean is_local_bd_addr,
+ guint32 interface_id, guint32 adapter_id, guint8 *bdaddr);
extern bluetooth_uuid_t get_uuid(tvbuff_t *tvb, gint offset, gint size);
extern gchar *print_uuid(bluetooth_uuid_t *uuid);
diff --git a/epan/dissectors/packet-btatt.c b/epan/dissectors/packet-btatt.c
index abc649d004..73d8a649a6 100644
--- a/epan/dissectors/packet-btatt.c
+++ b/epan/dissectors/packet-btatt.c
@@ -2012,7 +2012,7 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
break;
case 0x2A03: /* Reconnection Address */
- offset = dissect_bd_addr(hf_btatt_reconnection_address, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_btatt_reconnection_address, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
case 0x2A04: /* Peripheral Preferred Connection Parameters */
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index 1d013659ee..fd62920a4e 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -37,6 +37,7 @@
#include <epan/expert.h>
#include <epan/prefs.h>
#include <epan/decode_as.h>
+#include <epan/tap.h>
#include "packet-bluetooth.h"
#include "packet-bthci_cmd.h"
@@ -1572,7 +1573,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
{
guint8 bd_addr[6];
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
proto_tree_add_item(tree, hf_bthci_cmd_packet_type_2dh1, tvb, offset, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(tree, hf_bthci_cmd_packet_type_3dh1, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -1657,14 +1658,14 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
break;
case 0x0008: /* Create Connection Cancel Request */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
case 0x0009: /* Accept Connection Request */ {
guint8 bd_addr[6];
guint8 role;
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
proto_tree_add_item(tree, hf_bthci_cmd_role, tvb, offset, 1, ENC_LITTLE_ENDIAN);
role = tvb_get_guint8(tvb, offset);
@@ -1713,25 +1714,25 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
break;
case 0x000a: /* Reject Connection Request */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_reason, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
break;
case 0x000b: /* Link Key Request Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_link_key, tvb, offset, 16, ENC_NA);
offset+=16;
break;
case 0x000c: /* Link Key Request Negative Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
case 0x000d: /* PIN Code Request Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_pin_code_length ,tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -1740,7 +1741,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
break;
case 0x000e: /* PIN Code Request Negative Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
case 0x000f: /* Change Connection Packet Type */
@@ -1779,7 +1780,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
break;
case 0x0019: /* Remote Name Request */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -1795,7 +1796,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
break;
case 0x001a: /* Remote Name Request Cancel */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
case 0x001c: /* Read Remote Extended Features */
@@ -1811,7 +1812,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree_add_item(tree, hf_bthci_cmd_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
} else {
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
}
proto_tree_add_item(tree, hf_bthci_cmd_transmit_bandwidth, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@@ -1847,7 +1848,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
offset+=2;
break;
case 0x002a: /* Reject Synchronous Connection Request */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_reason, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -1863,7 +1864,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
break;
case 0x002b: /* IO Capability Response */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_io_capability, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -1874,7 +1875,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
break;
case 0x0034: /* IO Capability Request Negative Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_reason, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
break;
@@ -1883,18 +1884,18 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
case 0x002d: /* User Confirmation Request Negative Reply */
case 0x002f: /* User Passkey Request Negative Reply */
case 0x0033: /* Remote OOB Data Request Negative Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
case 0x002e: /* User Passkey Request Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_passkey, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset+=4;
break;
case 0x0030: /* Remote OOB Data Request Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_hash_c, tvb, offset, 16, ENC_NA);
offset+=16;
@@ -1975,7 +1976,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
static int
-dissect_link_policy_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint16 cmd_ocf)
+dissect_link_policy_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint16 cmd_ocf, bluetooth_data_t *bluetooth_data)
{
proto_item *item;
guint16 timeout;
@@ -2047,7 +2048,7 @@ dissect_link_policy_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
break;
case 0x000b: /* Switch Role */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_role, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2121,7 +2122,8 @@ dissect_link_policy_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
static int
dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
- proto_tree *tree, guint16 cmd_ocf, bluetooth_data_t *bluetooth_data)
+ proto_tree *tree, guint16 cmd_ocf, bluetooth_data_t *bluetooth_data,
+ bthci_cmd_data_t *bthci_cmd_data)
{
proto_item *item;
guint16 timeout;
@@ -2214,7 +2216,7 @@ dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pin
break;
case 0x02:
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
default:
@@ -2245,7 +2247,7 @@ dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pin
break;
case 0x02:
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_auto_acc_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2269,7 +2271,7 @@ dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pin
break;
case 0x000d: /* Read Stored Link Key */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_read_all_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2281,14 +2283,14 @@ dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pin
offset += 1;
for (i = 0; i < num8; i++) {
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_link_key, tvb, offset, 16, ENC_NA);
offset += 16;
}
break;
case 0x0012: /* Delete Stored Link Key */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_delete_all_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2296,35 +2298,8 @@ dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pin
case 0x0013: /* Change Local Name */
proto_tree_add_item(tree, hf_bthci_cmd_device_name, tvb, offset, 248, ENC_UTF_8 | ENC_NA);
- if (!pinfo->fd->flags.visited) {
- wmem_tree_key_t key[4];
- guint32 k_interface_id;
- guint32 k_adapter_id;
- guint32 k_frame_number;
- gchar *name;
- localhost_name_entry_t *localhost_name_entry;
-
- k_interface_id = bluetooth_data->interface_id;
- k_adapter_id = bluetooth_data->adapter_id;
- k_frame_number = pinfo->fd->num;
-
- name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 248, ENC_UTF_8);
-
- key[0].length = 1;
- key[0].key = &k_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;
-
- localhost_name_entry = (localhost_name_entry_t *) wmem_new(wmem_file_scope(), localhost_name_entry_t);
- localhost_name_entry->interface_id = k_interface_id;
- localhost_name_entry->adapter_id = k_adapter_id;
- localhost_name_entry->name = wmem_strdup(wmem_file_scope(), name);
-
- wmem_tree_insert32_array(bluetooth_data->localhost_name, key, localhost_name_entry);
+ if (!pinfo->fd->flags.visited && bthci_cmd_data) {
+ bthci_cmd_data->data.name = tvb_get_string_enc(wmem_file_scope(), tvb, offset, 248, ENC_UTF_8);
}
offset += 248;
break;
@@ -2550,7 +2525,7 @@ dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pin
proto_tree_add_item(tree, hf_bthci_cmd_fec_required, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
- call_dissector(btcommon_eir_handle, tvb_new_subset_length(tvb, offset, 240), pinfo, tree);
+ call_dissector_with_data(btcommon_eir_handle, tvb_new_subset_length(tvb, offset, 240), pinfo, tree, bluetooth_data);
save_local_device_name_from_eir_ad(tvb, offset, pinfo, 240, bluetooth_data);
offset += 240;
break;
@@ -2583,7 +2558,7 @@ dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pin
break;
case 0x0060: /* Send Keypress Notification */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_notification_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2875,7 +2850,7 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
break;
case 0x0005: /* LE Set Random Address */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
case 0x0006: /* LE Set Advertising Parameters */
@@ -2891,7 +2866,7 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
offset++;
proto_tree_add_item(tree, hf_bthci_cmd_le_direct_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_le_advts_channel_map_1, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(tree, hf_bthci_cmd_le_advts_channel_map_2, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(tree, hf_bthci_cmd_le_advts_channel_map_3, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -2905,7 +2880,7 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(tree, hf_bthci_cmd_le_data_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
- call_dissector(btcommon_ad_handle, tvb_new_subset_length(tvb, offset, 31), pinfo, tree);
+ call_dissector_with_data(btcommon_ad_handle, tvb_new_subset_length(tvb, offset, 31), pinfo, tree, bluetooth_data);
save_local_device_name_from_eir_ad(tvb, offset, pinfo, 31, bluetooth_data);
offset += 31;
break;
@@ -2948,7 +2923,7 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
offset++;
proto_tree_add_item(tree, hf_bthci_cmd_le_peer_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_le_own_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
item = proto_tree_add_item(tree, hf_bthci_cmd_le_con_interval_min, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -2975,7 +2950,7 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
case 0x0012: /* LE Remove Device From White List */
proto_tree_add_item(tree, hf_bthci_cmd_le_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
case 0x0013: /* LE Connection Update */
@@ -3096,7 +3071,7 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
guint32 adapter_id;
guint32 frame_number;
wmem_tree_key_t key[5];
- bthci_cmd_data_t *bthci_cmd_data;
+ bthci_cmd_data_t *bthci_cmd_data = NULL;
proto_tree *sub_item;
wmem_tree_t *subtree;
@@ -3147,6 +3122,17 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
ocf = opcode & 0x03ff;
ogf = (guint8) (opcode >> 10);
+ if (!pinfo->fd->flags.visited && bluetooth_data) {
+ bthci_cmd_data = (bthci_cmd_data_t *) wmem_new(wmem_file_scope(), bthci_cmd_data_t);
+ bthci_cmd_data->opcode = opcode;
+ bthci_cmd_data->command_in_frame = frame_number;
+ bthci_cmd_data->command_abs_ts = pinfo->fd->abs_ts;
+ bthci_cmd_data->pending_in_frame = max_disconnect_in_frame;
+ bthci_cmd_data->pending_abs_ts = pinfo->fd->abs_ts;
+ bthci_cmd_data->response_in_frame = max_disconnect_in_frame;
+ bthci_cmd_data->response_abs_ts = pinfo->fd->abs_ts;
+ }
+
if (ogf == HCI_OGF_VENDOR_SPECIFIC)
proto_item_append_text(ti_cmd," - %s", val_to_str_ext(opcode, &bthci_cmd_opcode_vals_ext, "Vendor Command 0x%04x"));
else
@@ -3215,11 +3201,11 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case HCI_OGF_LINK_POLICY:
- offset = dissect_link_policy_cmd(tvb, offset, pinfo, bthci_cmd_tree, ocf);
+ offset = dissect_link_policy_cmd(tvb, offset, pinfo, bthci_cmd_tree, ocf, bluetooth_data);
break;
case HCI_OGF_HOST_CONTROLLER:
- offset = dissect_host_controller_baseband_cmd(tvb, offset, pinfo, bthci_cmd_tree, ocf, bluetooth_data);
+ offset = dissect_host_controller_baseband_cmd(tvb, offset, pinfo, bthci_cmd_tree, ocf, bluetooth_data, bthci_cmd_data);
break;
case HCI_OGF_INFORMATIONAL:
@@ -3245,7 +3231,7 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
}
}
- if (!pinfo->fd->flags.visited && bluetooth_data) {
+ if (!pinfo->fd->flags.visited && bluetooth_data && bthci_cmd_data) {
key[0].length = 1;
key[0].key = &interface_id;
key[1].length = 1;
@@ -3257,15 +3243,6 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
key[4].length = 0;
key[4].key = NULL;
- bthci_cmd_data = (bthci_cmd_data_t *) wmem_new(wmem_file_scope(), bthci_cmd_data_t);
- bthci_cmd_data->opcode = opcode;
- bthci_cmd_data->command_in_frame = frame_number;
- bthci_cmd_data->command_abs_ts = pinfo->fd->abs_ts;
- bthci_cmd_data->pending_in_frame = max_disconnect_in_frame;
- bthci_cmd_data->pending_abs_ts = pinfo->fd->abs_ts;
- bthci_cmd_data->response_in_frame = max_disconnect_in_frame;
- bthci_cmd_data->response_abs_ts = pinfo->fd->abs_ts;
-
wmem_tree_insert32_array(bthci_cmds, key, bthci_cmd_data);
}
@@ -4883,7 +4860,7 @@ proto_reg_handoff_bthci_cmd(void)
static gint
-dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
proto_item *entry_item;
proto_tree *entry_tree;
@@ -4894,6 +4871,9 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint8 data_size;
gint64 end_offset;
guint i_uuid;
+ gboolean has_bd_addr = FALSE;
+ guint8 bd_addr[6];
+ guint8 *name = NULL;
data_size = tvb_reported_length(tvb);
@@ -5002,8 +4982,10 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case 0x08: /* Device Name (shortened) */
case 0x09: /* Device Name */
- proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_name, tvb, offset, length, ENC_ASCII | ENC_NA);
+ proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_name, tvb, offset, length, ENC_UTF_8 | ENC_NA);
proto_item_append_text(entry_item, ": %s", tvb_format_text(tvb,offset, length));
+ if (!name || type == 0x09)
+ name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, length, ENC_UTF_8);
offset += length;
break;
@@ -5061,8 +5043,8 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 0x0C: /* BD_ADDR */
/* From CSS v3.pdf */
- offset = dissect_bd_addr(hf_btcommon_eir_ad_bd_addr, tree, tvb, offset, NULL);
-
+ offset = dissect_bd_addr(hf_btcommon_eir_ad_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
+ has_bd_addr = TRUE;
break;
case 0x0D: /* Class Of Device */
@@ -5176,7 +5158,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case 0x18: /* Random Target Address */
end_offset = offset + length;
while (offset < end_offset) {
- offset = dissect_bd_addr(hf_btcommon_eir_ad_bd_addr, entry_tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_btcommon_eir_ad_bd_addr, pinfo, entry_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
}
break;
@@ -5198,7 +5180,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_le_bd_addr_type, tvb, offset, 1, ENC_NA);
offset += 1;
- offset = dissect_bd_addr(hf_btcommon_eir_ad_bd_addr, entry_tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_btcommon_eir_ad_bd_addr, pinfo, entry_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
break;
case 0x1C: /* LE Role */
@@ -5267,6 +5249,25 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = tvb_reported_length(tvb);
}
+ if (has_bd_addr && name && have_tap_listener(bluetooth_device_tap)) {
+ bluetooth_device_tap_t *tap_device;
+
+ tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
+ if (bluetooth_data) {
+ tap_device->interface_id = bluetooth_data->interface_id;
+ tap_device->adapter_id = bluetooth_data->adapter_id;
+ } else {
+ tap_device->interface_id = HCI_INTERFACE_DEFAULT;
+ tap_device->adapter_id = HCI_ADAPTER_DEFAULT;
+ }
+ memcpy(tap_device->bd_addr, bd_addr, 6);
+ tap_device->has_bd_addr = TRUE;
+ tap_device->is_local = FALSE;
+ tap_device->type = BLUETOOTH_DEVICE_NAME;
+ tap_device->data.name = name;
+ tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
+ }
+
return offset + data_size;
}
@@ -5375,7 +5376,7 @@ dissect_btcommon_cod(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, vo
}
static gint
-dissect_btcommon_ad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_btcommon_ad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *main_item;
proto_tree *main_tree;
@@ -5383,11 +5384,11 @@ dissect_btcommon_ad(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
main_item = proto_tree_add_item(tree, hf_btcommon_eir_ad_advertising_data, tvb, 0, -1, ENC_NA);
main_tree = proto_item_add_subtree(main_item, ett_eir_ad);
- return dissect_eir_ad_data(tvb, pinfo, main_tree);
+ return dissect_eir_ad_data(tvb, pinfo, main_tree, (bluetooth_data_t *) data);
}
static gint
-dissect_btcommon_eir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_btcommon_eir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
proto_item *main_item;
proto_tree *main_tree;
@@ -5395,7 +5396,7 @@ dissect_btcommon_eir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *
main_item = proto_tree_add_item(tree, hf_btcommon_eir_ad_extended_inquiry_response_data, tvb, 0, -1, ENC_NA);
main_tree = proto_item_add_subtree(main_item, ett_eir_ad);
- return dissect_eir_ad_data(tvb, pinfo, main_tree);
+ return dissect_eir_ad_data(tvb, pinfo, main_tree, (bluetooth_data_t *) data);
}
static gint
diff --git a/epan/dissectors/packet-bthci_cmd.h b/epan/dissectors/packet-bthci_cmd.h
index c9d3dd4f96..bcb6c5b7dd 100644
--- a/epan/dissectors/packet-bthci_cmd.h
+++ b/epan/dissectors/packet-bthci_cmd.h
@@ -59,6 +59,10 @@ typedef struct _bthci_cmd_data_t {
nstime_t pending_abs_ts;
guint32 response_in_frame;
nstime_t response_abs_ts;
+
+ union {
+ gchar *name;
+ } data;
} bthci_cmd_data_t;
extern wmem_tree_t *bthci_cmds;
diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c
index c827b72324..e4a00a9964 100644
--- a/epan/dissectors/packet-bthci_evt.c
+++ b/epan/dissectors/packet-bthci_evt.c
@@ -37,10 +37,12 @@
#include <epan/expert.h>
#include <epan/prefs.h>
#include <epan/decode_as.h>
+#include <epan/tap.h>
#include "packet-bluetooth.h"
#include "packet-bthci_sco.h"
#include "packet-bthci_cmd.h"
+#include "packet-bthci_evt.h"
static dissector_handle_t bthci_cmd_handle;
static dissector_handle_t bthci_evt_handle;
@@ -79,7 +81,7 @@ static int hf_bthci_evt_remote_name = -1;
static int hf_bthci_evt_encryption_enable = -1;
static int hf_bthci_evt_key_flag = -1;
static int hf_bthci_evt_vers_nr = -1;
-static int hf_bthci_evt_hci_vers_nr = -1;
+static int hf_bthci_bthci_evt_hci_version = -1;
static int hf_bthci_evt_hci_revision = -1;
static int hf_bthci_evt_comp_id = -1;
static int hf_bthci_evt_sub_vers_nr = -1;
@@ -510,7 +512,7 @@ static const value_string evt_key_flag[] = {
};
/* Taken from https://www.bluetooth.org/Technical/AssignedNumbers/link_manager.htm */
-static const value_string evt_lmp_vers_nr[] = {
+const value_string bthci_evt_lmp_version[] = {
{0x00, "1.0b"},
{0x01, "1.1"},
{0x02, "1.2"},
@@ -526,7 +528,7 @@ static const value_string evt_lmp_vers_nr[] = {
/* Taken from https://www.bluetooth.org/Technical/AssignedNumbers/hci.htm
* (requires a login/password)
*/
-static const value_string evt_hci_vers_nr[] = {
+const value_string bthci_evt_hci_version[] = {
{0x00, "1.0b"},
{0x01, "1.1"},
{0x02, "1.2"},
@@ -833,7 +835,7 @@ dissect_bthci_evt_connect_complete(tvbuff_t *tvb, int offset, packet_info *pinfo
proto_tree_add_item(tree, hf_bthci_evt_connection_handle, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
if (!pinfo->fd->flags.visited && bluetooth_data != NULL && status == 0x00) {
wmem_tree_key_t key[5];
guint32 k_interface_id;
@@ -890,9 +892,9 @@ dissect_bthci_evt_connect_complete(tvbuff_t *tvb, int offset, packet_info *pinfo
}
static int
-dissect_bthci_evt_connect_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_connect_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
call_dissector(btcommon_cod_handle, tvb_new_subset_length(tvb, offset, 3), pinfo, tree);
offset += 3;
@@ -1076,25 +1078,25 @@ dissect_bthci_evt_lmp_features(tvbuff_t *tvb, int offset, packet_info *pinfo _U_
}
static int
-dissect_bthci_evt_pin_code_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_pin_code_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
return offset;
}
static int
-dissect_bthci_evt_link_key_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_link_key_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
return offset;
}
static int
-dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, ENC_NA);
offset += 16;
@@ -1106,7 +1108,7 @@ dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *
}
static int
-dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
guint8 evt_num_keys;
@@ -1115,7 +1117,7 @@ dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo
offset += 1;
while (evt_num_keys--) {
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, ENC_NA);
offset += 16;
@@ -1148,7 +1150,7 @@ dissect_bthci_evt_remote_name_req_complete(tvbuff_t *tvb, int offset,
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
proto_tree_add_item(tree, hf_bthci_evt_remote_name, tvb, offset, 248, ENC_UTF_8|ENC_NA);
if (!pinfo->fd->flags.visited && bluetooth_data != NULL) {
@@ -1188,13 +1190,33 @@ dissect_bthci_evt_remote_name_req_complete(tvbuff_t *tvb, int offset,
wmem_tree_insert32_array(bluetooth_data->bdaddr_to_name, key, device_name);
}
+
+ if (have_tap_listener(bluetooth_device_tap)) {
+ bluetooth_device_tap_t *tap_device;
+
+ tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
+ if (bluetooth_data) {
+ tap_device->interface_id = bluetooth_data->interface_id;
+ tap_device->adapter_id = bluetooth_data->adapter_id;
+ } else {
+ tap_device->interface_id = HCI_INTERFACE_DEFAULT;
+ tap_device->adapter_id = HCI_ADAPTER_DEFAULT;
+ }
+ memcpy(tap_device->bd_addr, bd_addr, 6);
+ tap_device->has_bd_addr = TRUE;
+ tap_device->is_local = FALSE;
+ tap_device->type = BLUETOOTH_DEVICE_NAME;
+ tap_device->data.name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 248, ENC_UTF_8);
+ tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
+ }
+
offset += 248;
return offset;
}
static int
-dissect_bthci_evt_read_remote_version_information_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_read_remote_version_information_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, bluetooth_data_t *bluetooth_data, proto_tree *tree)
{
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1211,6 +1233,61 @@ dissect_bthci_evt_read_remote_version_information_complete(tvbuff_t *tvb, int of
proto_tree_add_item(tree, hf_bthci_evt_sub_vers_nr, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
+ if (have_tap_listener(bluetooth_device_tap)) {
+ wmem_tree_t *subtree;
+ wmem_tree_key_t key[4];
+ guint32 interface_id;
+ guint32 adapter_id;
+ guint32 connection_handle;
+ remote_bdaddr_t *remote_bdaddr;
+ bluetooth_device_tap_t *tap_device;
+ guint8 lmp_version;
+ guint16 lmp_subversion;
+ guint16 manufacturer;
+
+ lmp_version = tvb_get_guint8(tvb, offset - 5);
+ manufacturer = tvb_get_letohs(tvb, offset - 4);
+ lmp_subversion = tvb_get_letohs(tvb, offset - 2);
+
+ interface_id = bluetooth_data->interface_id;
+ adapter_id = bluetooth_data->adapter_id;
+ connection_handle = tvb_get_guint16(tvb, offset - 7, ENC_LITTLE_ENDIAN) & 0x0fff;
+
+ key[0].length = 1;
+ key[0].key = &interface_id;
+ key[1].length = 1;
+ key[1].key = &adapter_id;
+ key[2].length = 1;
+ key[2].key = &connection_handle;
+ key[3].length = 0;
+ key[3].key = NULL;
+
+ subtree = (wmem_tree_t *) wmem_tree_lookup32_array(bluetooth_data->chandle_to_bdaddr, key);
+ remote_bdaddr = (subtree) ? (remote_bdaddr_t *) wmem_tree_lookup32_le(subtree, pinfo->fd->num) : NULL;
+
+ tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
+ tap_device->type = BLUETOOTH_DEVICE_REMOTE_VERSION;
+ if (bluetooth_data) {
+ tap_device->interface_id = bluetooth_data->interface_id;
+ tap_device->adapter_id = bluetooth_data->adapter_id;
+ } else {
+ tap_device->interface_id = HCI_INTERFACE_DEFAULT;
+ tap_device->adapter_id = HCI_ADAPTER_DEFAULT;
+ }
+
+ if (remote_bdaddr) {
+ tap_device->has_bd_addr = TRUE;
+ memcpy(tap_device->bd_addr, remote_bdaddr->bd_addr, 6);
+ } else {
+ tap_device->has_bd_addr = FALSE;
+ }
+ tap_device->is_local = FALSE;
+ tap_device->data.remote_version.lmp_version = lmp_version;
+ tap_device->data.remote_version.lmp_subversion = lmp_subversion;
+ tap_device->data.remote_version.manufacturer = manufacturer;
+ tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
+ }
+
return offset;
}
@@ -1302,7 +1379,7 @@ dissect_bthci_evt_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
static int
-dissect_bthci_evt_role_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
+dissect_bthci_evt_role_change(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
guint8 bd_addr[6];
@@ -1313,7 +1390,7 @@ dissect_bthci_evt_role_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
status = tvb_get_guint8(tvb, offset);
offset += 1;
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
proto_tree_add_item(tree, hf_bthci_evt_role, tvb, offset, 1, ENC_LITTLE_ENDIAN);
role = tvb_get_guint8(tvb, offset);
@@ -1600,9 +1677,9 @@ dissect_bthci_evt_command_status(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
static int
-dissect_bthci_evt_page_scan_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_page_scan_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1611,9 +1688,9 @@ dissect_bthci_evt_page_scan_mode_change(tvbuff_t *tvb, int offset, packet_info *
}
static int
-dissect_bthci_evt_page_scan_repetition_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_page_scan_repetition_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1623,7 +1700,7 @@ dissect_bthci_evt_page_scan_repetition_mode_change(tvbuff_t *tvb, int offset, pa
static int
dissect_bthci_evt_inquire_result_with_rssi(tvbuff_t *tvb, int offset,
- packet_info *pinfo, proto_tree *tree, guint8 *bd_addr)
+ packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data, guint8 *bd_addr)
{
guint8 num, evt_num_responses;
@@ -1632,7 +1709,7 @@ dissect_bthci_evt_inquire_result_with_rssi(tvbuff_t *tvb, int offset,
offset += 1;
for (num = 0; num < evt_num_responses; num++) {
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, (num == 0) ? bd_addr : NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, (num == 0) ? bd_addr : NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1655,17 +1732,17 @@ dissect_bthci_evt_inquire_result_with_rssi(tvbuff_t *tvb, int offset,
}
static int
-dissect_bthci_evt_io_capability_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_io_capability_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
return offset;
}
static int
-dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_evt_io_capability, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1680,9 +1757,9 @@ dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info
}
static int
-dissect_bthci_evt_user_confirmation_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_user_confirmation_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_evt_numeric_value, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -1691,36 +1768,36 @@ dissect_bthci_evt_user_confirmation_request(tvbuff_t *tvb, int offset, packet_in
}
static int
-dissect_bthci_evt_user_passkey_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_user_passkey_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
return offset;
}
static int
-dissect_bthci_evt_remote_oob_data_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_remote_oob_data_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
return offset;
}
static int
-dissect_bthci_evt_simple_pairing_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_simple_pairing_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
return offset;
}
static int
-dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_evt_passkey, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -1729,9 +1806,9 @@ dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_in
}
static int
-dissect_bthci_evt_keypress_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
+dissect_bthci_evt_keypress_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_evt_notification_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1740,9 +1817,9 @@ dissect_bthci_evt_keypress_notification(tvbuff_t *tvb, int offset, packet_info *
}
static int
-dissect_bthci_evt_remote_host_sup_feat_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_remote_host_sup_feat_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
offset = dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree, 0);
return offset;
@@ -1781,7 +1858,7 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
item = proto_tree_add_item(tree, hf_bthci_evt_le_con_interval, tvb, offset, 2, ENC_LITTLE_ENDIAN);
proto_item_append_text(item, " (%g msec)", tvb_get_letohs(tvb, offset)*1.25);
@@ -1852,7 +1929,7 @@ dissect_bthci_evt_le_meta(tvbuff_t *tvb, int offset, packet_info *pinfo,
offset += 1;
proto_tree_add_item(tree, hf_bthci_evt_le_peer_address_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_bthci_evt_data_length, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -2071,7 +2148,7 @@ dissect_bthci_evt_amp_status_change(tvbuff_t *tvb, int offset, packet_info *pinf
static int
dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *main_tree, proto_tree *tree,
- wmem_list_t *opcode_list, bluetooth_data_t *bluetooth_data)
+ wmem_list_t *opcode_list, bluetooth_data_t *bluetooth_data, guint32 *out_opcode)
{
proto_item *ti_opcode;
proto_tree *opcode_tree;
@@ -2096,6 +2173,8 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
opcode = tvb_get_letohs(tvb, offset);
ogf = opcode >> 10;
+ if (out_opcode)
+ *out_opcode = opcode;
interface_id = bluetooth_data->interface_id;
adapter_id = bluetooth_data->adapter_id;
@@ -2230,6 +2309,7 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
/* This is a list of Commands that all return status and BD_ADDR */
case 0x1009: /* Read BD_ADDR */
local_addr = TRUE;
+
/* FALLTHROUGH */
case 0x0408: /* Create Connection Cancel */
case 0x040b: /* Link Key Request Reply */
@@ -2249,7 +2329,7 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, local_addr, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
if (!pinfo->fd->flags.visited && bluetooth_data != NULL && local_addr) {
localhost_bdaddr_entry_t *localhost_bdaddr_entry;
@@ -2273,6 +2353,24 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
wmem_tree_insert32_array(bluetooth_data->localhost_bdaddr, key, localhost_bdaddr_entry);
}
+ if (local_addr && have_tap_listener(bluetooth_device_tap)) {
+ bluetooth_device_tap_t *tap_device;
+
+ tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
+ if (bluetooth_data) {
+ tap_device->interface_id = bluetooth_data->interface_id;
+ tap_device->adapter_id = bluetooth_data->adapter_id;
+ } else {
+ tap_device->interface_id = HCI_INTERFACE_DEFAULT;
+ tap_device->adapter_id = HCI_ADAPTER_DEFAULT;
+ }
+ memcpy(tap_device->bd_addr, bd_addr, 6);
+ tap_device->has_bd_addr = TRUE;
+ tap_device->is_local = TRUE;
+ tap_device->type = BLUETOOTH_DEVICE_LOCAL_ADAPTER;
+ tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
+ }
+
break;
/* This is a list of Commands that all return status and connection_handle */
@@ -2441,10 +2539,11 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
case 0x0c14: /* Read Local Name */
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ status = tvb_get_guint8(tvb, offset);
offset += 1;
proto_tree_add_item(tree, hf_bthci_evt_device_name, tvb, offset, 248, ENC_UTF_8|ENC_NA);
- if (!pinfo->fd->flags.visited && bluetooth_data != NULL) {
+ if (status == STATUS_SUCCESS && !pinfo->fd->flags.visited && bluetooth_data != NULL) {
gchar *name;
localhost_name_entry_t *localhost_name_entry;
@@ -2466,6 +2565,24 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
wmem_tree_insert32_array(bluetooth_data->localhost_name, key, localhost_name_entry);
}
+
+ if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
+ bluetooth_device_tap_t *tap_device;
+
+ tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
+ if (bluetooth_data) {
+ tap_device->interface_id = bluetooth_data->interface_id;
+ tap_device->adapter_id = bluetooth_data->adapter_id;
+ } else {
+ tap_device->interface_id = HCI_INTERFACE_DEFAULT;
+ tap_device->adapter_id = HCI_ADAPTER_DEFAULT;
+ }
+ tap_device->has_bd_addr = FALSE;
+ tap_device->is_local = TRUE;
+ tap_device->type = BLUETOOTH_DEVICE_NAME;
+ tap_device->data.name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 248, ENC_UTF_8);
+ tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
+ }
offset += 248;
break;
@@ -2737,7 +2854,7 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
status = tvb_get_guint8(tvb, offset);
offset += 1;
- proto_tree_add_item(tree, hf_bthci_evt_hci_vers_nr, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(tree, hf_bthci_bthci_evt_hci_version, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
hci_revision_item = proto_tree_add_item(tree, hf_bthci_evt_hci_revision, tvb, offset, 2, ENC_LITTLE_ENDIAN);
@@ -2766,11 +2883,32 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
key[2].key = NULL;
hci_vendor_data = (hci_vendor_data_t *) wmem_tree_lookup32_array(bluetooth_data->hci_vendors, key);
-
- hci_revision = tvb_get_letohs(tvb, offset - 7);
- manufacturer = tvb_get_letohs(tvb, offset - 4);
+ hci_revision = tvb_get_letohs(tvb, offset - 7);
+ manufacturer = tvb_get_letohs(tvb, offset - 4);
lmp_subversion = tvb_get_letohs(tvb, offset - 2);
+ if (have_tap_listener(bluetooth_device_tap)) {
+ bluetooth_device_tap_t *tap_device;
+ guint8 hci_version;
+ guint8 lmp_version;
+
+ hci_version = tvb_get_guint8(tvb, offset - 8);
+ lmp_version = tvb_get_guint8(tvb, offset - 5);
+
+ tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
+ tap_device->type = BLUETOOTH_DEVICE_LOCAL_VERSION;
+ tap_device->interface_id = interface_id;
+ tap_device->adapter_id = adapter_id;
+ tap_device->has_bd_addr = FALSE;
+ tap_device->is_local = TRUE;
+ tap_device->data.local_version.hci_version = hci_version;
+ tap_device->data.local_version.hci_revision = hci_revision;
+ tap_device->data.local_version.lmp_version = lmp_version;
+ tap_device->data.local_version.lmp_subversion = lmp_subversion;
+ tap_device->data.local_version.manufacturer = manufacturer;
+ tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
+ }
+
if (hci_vendor_data) {
proto_tree *sub_tree;
proto_item *sub_item;
@@ -3283,7 +3421,7 @@ dissect_bthci_evt_sync_connection_complete(tvbuff_t *tvb, int offset,
connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
offset += 2;
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
proto_tree_add_item(tree, hf_bthci_evt_sync_link_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -3494,7 +3632,7 @@ dissect_bthci_evt_link_supervision_timeout_changed(tvbuff_t *tvb, int offset, pa
}
static int
-dissect_bthci_evt_inquire_result(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_inquire_result(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bluetooth_data_t *bluetooth_data)
{
guint8 num, evt_num_responses;
@@ -3503,7 +3641,7 @@ dissect_bthci_evt_inquire_result(tvbuff_t *tvb, int offset, packet_info *pinfo,
offset += 1;
for (num = 0; num < evt_num_responses; num++) {
- offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, pinfo, tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -3540,6 +3678,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
wmem_list_frame_t *opcode_list_frame;
bthci_cmd_data_t *lastest_bthci_cmd_data = NULL;
opcode_list_data_t *opcode_list_data;
+ guint32 opcode = G_MAXUINT32;
/* Reject the packet if data is NULL */
if (data == NULL)
@@ -3604,7 +3743,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x02: /* Inquiry result event */
- offset = dissect_bthci_evt_inquire_result(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_inquire_result(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x03: /* Connection Complete */
@@ -3616,7 +3755,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x04: /* Connection Request */
- offset = dissect_bthci_evt_connect_request(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_connect_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x05: /* Disconnection Complete */
@@ -3654,7 +3793,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x0c: /* Read Remote Version Information Complete */
- offset = dissect_bthci_evt_read_remote_version_information_complete(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_read_remote_version_information_complete(tvb, offset, pinfo, bluetooth_data, bthci_evt_tree);
add_opcode(opcode_list, 0x41D, COMMAND_STATUS_NORMAL); /* Read Remote Version Information */
break;
@@ -3663,7 +3802,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x0e: /* Command Complete */
- offset = dissect_bthci_evt_command_complete(tvb, offset, pinfo, tree, bthci_evt_tree, opcode_list, bluetooth_data);
+ offset = dissect_bthci_evt_command_complete(tvb, offset, pinfo, tree, bthci_evt_tree, opcode_list, bluetooth_data, &opcode);
add_opcode(opcode_list, 0x0429, COMMAND_STATUS_NORMAL); /* Accept Synchronous Connection Request */
break;
@@ -3695,19 +3834,19 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x15: /* Return Link Keys */
- offset = dissect_bthci_evt_return_link_keys(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_return_link_keys(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x16: /* PIN Code Request */
- offset = dissect_bthci_evt_pin_code_request(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_pin_code_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x17: /* Link Key Request */
- offset = dissect_bthci_evt_link_key_request(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_link_key_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x18: /* Link Key Notification */
- offset = dissect_bthci_evt_link_key_notification(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_link_key_notification(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x19: /* Loopback Command */
@@ -3736,11 +3875,11 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x1f: /* Page Scan Mode Change */
- offset = dissect_bthci_evt_page_scan_mode_change(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_page_scan_mode_change(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x20: /* Page Scan Repetition Mode Change */
- offset = dissect_bthci_evt_page_scan_repetition_mode_change(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_page_scan_repetition_mode_change(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x21: /* Flow Specification Complete */
@@ -3748,7 +3887,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x22: /* Inquiry Result with RSSI */
- offset = dissect_bthci_evt_inquire_result_with_rssi(tvb, offset, pinfo, bthci_evt_tree, NULL);
+ offset = dissect_bthci_evt_inquire_result_with_rssi(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data, NULL);
break;
case 0x23: /* Read Remote Extended Features Complete */
@@ -3775,7 +3914,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
case 0x2f: /* Extended Inquiry Result */
previous_offset = offset;
- offset = dissect_bthci_evt_inquire_result_with_rssi(tvb, offset, pinfo, bthci_evt_tree, bd_addr);
+ offset = dissect_bthci_evt_inquire_result_with_rssi(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data, bd_addr);
call_dissector(btcommon_eir_handle, tvb_new_subset_length(tvb, offset, 240), pinfo, bthci_evt_tree);
save_remote_device_name(tvb, offset, pinfo, 240, (offset - previous_offset <= 1) ? NULL : bd_addr, bluetooth_data);
@@ -3789,27 +3928,27 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x31: /* IO Capability Request */
- offset = dissect_bthci_evt_io_capability_request(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_io_capability_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x32: /* IO Capability Response */
- offset = dissect_bthci_evt_io_capability_response(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_io_capability_response(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x33: /* User Confirmation Request */
- offset = dissect_bthci_evt_user_confirmation_request(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_user_confirmation_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x34: /* User Passkey Request */
- offset = dissect_bthci_evt_user_passkey_request(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_user_passkey_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x35: /* Remote OOB Data Request */
- offset = dissect_bthci_evt_remote_oob_data_request(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_remote_oob_data_request(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x36: /* Simple Pairing Complete */
- offset = dissect_bthci_evt_simple_pairing_complete(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_simple_pairing_complete(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x38: /* Link Supervision Timeout Changed */
@@ -3821,15 +3960,15 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
break;
case 0x3b: /* Enhanced Flush Complete */
- offset = dissect_bthci_evt_user_passkey_notification(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_user_passkey_notification(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x3c: /* Enhanced Flush Complete */
- offset = dissect_bthci_evt_keypress_notification(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_keypress_notification(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x3d: /* Remote Host Supported Features Notification */
- offset = dissect_bthci_evt_remote_host_sup_feat_notification(tvb, offset, pinfo, bthci_evt_tree);
+ offset = dissect_bthci_evt_remote_host_sup_feat_notification(tvb, offset, pinfo, bthci_evt_tree, bluetooth_data);
break;
case 0x3e: /* LE Meta */
@@ -3934,7 +4073,6 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
offset += tvb_reported_length_remaining(tvb, offset);
break;
}
-
}
opcode_list_frame = wmem_list_head(opcode_list);
@@ -3943,7 +4081,6 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
wmem_tree_key_t key[4];
guint32 interface_id;
guint32 adapter_id;
- guint32 opcode;
guint32 frame_number;
bthci_cmd_data_t *bthci_cmd_data;
wmem_tree_t *subtree;
@@ -4016,6 +4153,59 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
frame_number = pinfo->fd->num;
+ if (opcode != G_MAXUINT32 && opcode >> 10 != HCI_OGF_VENDOR_SPECIFIC) {
+ guint8 status;
+
+ switch(opcode) {
+ case 0x0c13: /* Change Local Name */
+ status = tvb_get_guint8(tvb, 5);
+
+ if (status == STATUS_SUCCESS && have_tap_listener(bluetooth_device_tap)) {
+ bluetooth_device_tap_t *tap_device;
+
+ tap_device = wmem_new(wmem_packet_scope(), bluetooth_device_tap_t);
+ if (bluetooth_data) {
+ tap_device->interface_id = bluetooth_data->interface_id;
+ tap_device->adapter_id = bluetooth_data->adapter_id;
+ } else {
+ tap_device->interface_id = HCI_INTERFACE_DEFAULT;
+ tap_device->adapter_id = HCI_ADAPTER_DEFAULT;
+ }
+ tap_device->has_bd_addr = FALSE;
+ tap_device->is_local = TRUE;
+ tap_device->type = BLUETOOTH_DEVICE_NAME;
+ tap_device->data.name = lastest_bthci_cmd_data->data.name;
+ tap_queue_packet(bluetooth_device_tap, pinfo, tap_device);
+ }
+ if (status == STATUS_SUCCESS && !pinfo->fd->flags.visited && bluetooth_data) {
+ localhost_name_entry_t *localhost_name_entry;
+ wmem_tree_key_t key[4];
+ guint32 interface_id;
+ guint32 adapter_id;
+
+ interface_id = bluetooth_data->interface_id;
+ adapter_id = bluetooth_data->adapter_id;
+
+ key[0].length = 1;
+ key[0].key = &interface_id;
+ key[1].length = 1;
+ key[1].key = &adapter_id;
+ key[2].length = 1;
+ key[2].key = &frame_number;
+ key[3].length = 0;
+ key[3].key = NULL;
+
+ localhost_name_entry = (localhost_name_entry_t *) wmem_new(wmem_file_scope(), localhost_name_entry_t);
+ localhost_name_entry->interface_id = interface_id;
+ localhost_name_entry->adapter_id = adapter_id;
+ localhost_name_entry->name = lastest_bthci_cmd_data->data.name;
+
+ wmem_tree_insert32_array(bluetooth_data->localhost_name, key, localhost_name_entry);
+ }
+ break;
+ }
+ }
+
if (!pinfo->fd->flags.visited && opcode_list_data->command_status == COMMAND_STATUS_PENDING &&
lastest_bthci_cmd_data->pending_in_frame == max_disconnect_in_frame) {
lastest_bthci_cmd_data->pending_in_frame = frame_number;
@@ -4231,12 +4421,12 @@ proto_register_bthci_evt(void)
},
{ &hf_bthci_evt_vers_nr,
{ "LMP Version", "bthci_evt.lmp_vers_nr",
- FT_UINT8, BASE_HEX, VALS(evt_lmp_vers_nr), 0x0,
+ FT_UINT8, BASE_HEX, VALS(bthci_evt_lmp_version), 0x0,
"Version of the Current LMP", HFILL }
},
- { &hf_bthci_evt_hci_vers_nr,
+ { &hf_bthci_bthci_evt_hci_version,
{ "HCI Version", "bthci_evt.hci_vers_nr",
- FT_UINT8, BASE_HEX, VALS(evt_hci_vers_nr), 0x0,
+ FT_UINT8, BASE_HEX, VALS(bthci_evt_hci_version), 0x0,
"Version of the Current HCI", HFILL }
},
{ &hf_bthci_evt_hci_revision,
diff --git a/epan/dissectors/packet-bthci_evt.h b/epan/dissectors/packet-bthci_evt.h
index 5df9dad563..402c8121d3 100644
--- a/epan/dissectors/packet-bthci_evt.h
+++ b/epan/dissectors/packet-bthci_evt.h
@@ -24,6 +24,17 @@
extern value_string_ext bthci_evt_evt_code_vals_ext;
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+WS_DLL_PUBLIC const value_string bthci_evt_lmp_version[];
+WS_DLL_PUBLIC const value_string bthci_evt_hci_version[];
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
#endif
/*
diff --git a/epan/dissectors/packet-bthci_vendor.c b/epan/dissectors/packet-bthci_vendor.c
index d2fbcc43da..62e82d4425 100644
--- a/epan/dissectors/packet-bthci_vendor.c
+++ b/epan/dissectors/packet-bthci_vendor.c
@@ -401,7 +401,7 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
switch(ocf) {
case 0x0001: /* Write BDADDR */
- offset = dissect_bd_addr(hf_bd_addr, main_tree, tvb, offset, bd_addr);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, TRUE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
/* TODO: This is command, but in respose (event Command Complete) there is a status for that,
so write bdaddr can fail, but we store bdaddr as valid for now... */
@@ -582,12 +582,12 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_tree_add_item(main_tree, hf_le_multi_advertising_address_type, tvb, offset, 1, ENC_NA);
offset += 1;
- offset = dissect_bd_addr(hf_bd_addr, main_tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(main_tree, hf_le_multi_advertising_address_type, tvb, offset, 1, ENC_NA);
offset += 1;
- offset = dissect_bd_addr(hf_bd_addr, main_tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_bitmask(main_tree, tvb, offset, hf_le_multi_advertising_channel_map, ett_channel_map, hfx_le_multi_advertising_channel_map, ENC_NA);
offset += 1;
@@ -613,7 +613,7 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
break;
case 0x04: /* Set Random Address */
- offset = dissect_bd_addr(hf_bd_addr, main_tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(main_tree, hf_le_multi_advertising_instance_id, tvb, offset, 1, ENC_NA);
offset += 1;
diff --git a/epan/dissectors/packet-btle.c b/epan/dissectors/packet-btle.c
index 91fd6d7f8d..08eaed3739 100644
--- a/epan/dissectors/packet-btle.c
+++ b/epan/dissectors/packet-btle.c
@@ -444,7 +444,7 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
case 0x00: /* ADV_IND */
case 0x02: /* ADV_NONCONN_IND */
case 0x06: /* ADV_SCAN_IND */
- offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset, src_bd_addr);
+ offset = dissect_bd_addr(hf_advertising_address, pinfo, btle_tree, tvb, offset, TRUE, interface_id, adapter_id, src_bd_addr);
SET_ADDRESS(&pinfo->net_src, AT_ETHER, 6, src_bd_addr);
COPY_ADDRESS_SHALLOW(&pinfo->dl_src, &pinfo->net_src);
@@ -475,8 +475,8 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
case 0x01: /* ADV_DIRECT_IND */
- offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset, src_bd_addr);
- offset = dissect_bd_addr(hf_initiator_addresss, btle_tree, tvb, offset, dst_bd_addr);
+ offset = dissect_bd_addr(hf_advertising_address, pinfo, btle_tree, tvb, offset, TRUE, interface_id, adapter_id, src_bd_addr);
+ offset = dissect_bd_addr(hf_initiator_addresss, pinfo, btle_tree, tvb, offset, FALSE, interface_id, adapter_id, dst_bd_addr);
SET_ADDRESS(&pinfo->net_src, AT_ETHER, 6, src_bd_addr);
COPY_ADDRESS_SHALLOW(&pinfo->dl_src, &pinfo->net_src);
@@ -500,8 +500,8 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
case 0x03: /* SCAN_REQ */
- offset = dissect_bd_addr(hf_scanning_address, btle_tree, tvb, offset, src_bd_addr);
- offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset, dst_bd_addr);
+ offset = dissect_bd_addr(hf_scanning_address, pinfo, btle_tree, tvb, offset, TRUE, interface_id, adapter_id, src_bd_addr);
+ offset = dissect_bd_addr(hf_advertising_address, pinfo, btle_tree, tvb, offset, FALSE, interface_id, adapter_id, dst_bd_addr);
SET_ADDRESS(&pinfo->net_src, AT_ETHER, 6, src_bd_addr);
COPY_ADDRESS_SHALLOW(&pinfo->dl_src, &pinfo->net_src);
@@ -525,7 +525,7 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
case 0x04: /* SCAN_RSP */
- offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset, src_bd_addr);
+ offset = dissect_bd_addr(hf_advertising_address, pinfo, btle_tree, tvb, offset, TRUE, interface_id, adapter_id, src_bd_addr);
SET_ADDRESS(&pinfo->net_src, AT_ETHER, 6, src_bd_addr);
COPY_ADDRESS_SHALLOW(&pinfo->dl_src, &pinfo->net_src);
@@ -559,8 +559,8 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
case 0x05: /* CONNECT_REQ */
- offset = dissect_bd_addr(hf_initiator_addresss, btle_tree, tvb, offset, src_bd_addr);
- offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset, dst_bd_addr);
+ offset = dissect_bd_addr(hf_initiator_addresss, pinfo, btle_tree, tvb, offset, FALSE, interface_id, adapter_id, src_bd_addr);
+ offset = dissect_bd_addr(hf_advertising_address, pinfo, btle_tree, tvb, offset, TRUE, interface_id, adapter_id, dst_bd_addr);
SET_ADDRESS(&pinfo->net_src, AT_ETHER, 6, src_bd_addr);
COPY_ADDRESS_SHALLOW(&pinfo->dl_src, &pinfo->net_src);
diff --git a/epan/dissectors/packet-btobex.c b/epan/dissectors/packet-btobex.c
index 79bb01461c..f8ea016a41 100644
--- a/epan/dissectors/packet-btobex.c
+++ b/epan/dissectors/packet-btobex.c
@@ -1778,6 +1778,28 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
guint32 value;
guint8 tag;
gchar *str = NULL;
+ guint32 interface_id;
+ guint32 adapter_id;
+ guint32 chandle;
+ guint32 channel;
+
+ if (is_obex_over_l2cap) {
+ btl2cap_data_t *l2cap_data;
+
+ l2cap_data = (btl2cap_data_t *) data;
+ interface_id = l2cap_data->interface_id;
+ adapter_id = l2cap_data->adapter_id;
+ chandle = l2cap_data->chandle;
+ channel = l2cap_data->cid;
+ } else {
+ btrfcomm_data_t *rfcomm_data;
+
+ rfcomm_data = (btrfcomm_data_t *) data;
+ interface_id = rfcomm_data->interface_id;
+ adapter_id = rfcomm_data->adapter_id;
+ chandle = rfcomm_data->chandle;
+ channel = rfcomm_data->dlci >> 1;
+ }
if (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_item *hdrs;
@@ -2017,10 +2039,7 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
col_append_fstr(pinfo->cinfo, COL_INFO, " - %s", target_vals[i].strptr);
if (!pinfo->fd->flags.visited) {
obex_profile_data_t *obex_profile_data;
- guint32 interface_id;
- guint32 adapter_id;
- guint32 chandle;
- guint32 channel;
+
wmem_tree_key_t key[6];
guint32 k_interface_id;
guint32 k_adapter_id;
@@ -2028,24 +2047,6 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
guint32 k_chandle;
guint32 k_channel;
- if (is_obex_over_l2cap) {
- btl2cap_data_t *l2cap_data;
-
- l2cap_data = (btl2cap_data_t *) data;
- interface_id = l2cap_data->interface_id;
- adapter_id = l2cap_data->adapter_id;
- chandle = l2cap_data->chandle;
- channel = l2cap_data->cid;
- } else {
- btrfcomm_data_t *rfcomm_data;
-
- rfcomm_data = (btrfcomm_data_t *) data;
- interface_id = rfcomm_data->interface_id;
- adapter_id = rfcomm_data->adapter_id;
- chandle = rfcomm_data->chandle;
- channel = rfcomm_data->dlci >> 1;
- }
-
k_interface_id = interface_id;
k_adapter_id = adapter_id;
k_chandle = chandle;
@@ -2129,7 +2130,7 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
switch (tag) {
case 0x00: /* Device Address */
if (sub_parameter_length == 6) {
- offset = dissect_bd_addr(hf_sender_bd_addr, parameter_tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_sender_bd_addr, pinfo, parameter_tree, tvb, offset, FALSE, interface_id, adapter_id, NULL);
} else {
proto_tree_add_item(parameter_tree, hf_session_parameter_data, tvb, offset, sub_parameter_length, ENC_NA);
diff --git a/epan/dissectors/packet-btsmp.c b/epan/dissectors/packet-btsmp.c
index 6fba3038d8..9fe5057c25 100644
--- a/epan/dissectors/packet-btsmp.c
+++ b/epan/dissectors/packet-btsmp.c
@@ -180,12 +180,25 @@ dissect_btsmp_key_dist(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
}
static int
-dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
int offset = 0;
proto_item *ti;
proto_tree *st;
guint8 opcode;
+ btl2cap_data_t *l2cap_data;
+ guint32 interface_id;
+ guint32 adapter_id;
+
+ l2cap_data = (btl2cap_data_t *) data;
+
+ if (l2cap_data) {
+ interface_id = l2cap_data->interface_id;
+ adapter_id = l2cap_data->adapter_id;
+ } else {
+ interface_id = HCI_INTERFACE_DEFAULT;
+ adapter_id = HCI_ADAPTER_DEFAULT;
+ }
ti = proto_tree_add_item(tree, proto_btsmp, tvb, 0, tvb_captured_length(tvb), ENC_NA);
st = proto_item_add_subtree(ti, ett_btsmp);
@@ -271,7 +284,7 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
proto_tree_add_item(st, hf_address_type, tvb, offset, 1, ENC_NA);
offset += 1;
- offset = dissect_bd_addr(hf_bd_addr, st, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, st, tvb, offset, FALSE, interface_id, adapter_id, NULL);
break;
case 0x0a: /* Signing Information */
diff --git a/epan/dissectors/packet-hci_mon.c b/epan/dissectors/packet-hci_mon.c
index ce0a089148..d803739a2b 100644
--- a/epan/dissectors/packet-hci_mon.c
+++ b/epan/dissectors/packet-hci_mon.c
@@ -199,7 +199,7 @@ dissect_hci_mon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
proto_tree_add_item(hci_mon_tree, hf_type, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
- offset = dissect_bd_addr(hf_bd_addr, hci_mon_tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, hci_mon_tree, tvb, offset, TRUE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
proto_tree_add_item(hci_mon_tree, hf_name, tvb, offset, 8, ENC_NA | ENC_ASCII);
offset += 8;