summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2014-12-12 11:11:00 +0100
committerMichal Labedzki <michal.labedzki@tieto.com>2014-12-18 11:02:52 +0000
commit4a467ff609f1b5ee99cbc1aaccdc7b78d3cbecbc (patch)
tree2eba698b56f5603af2822fd287a51b903150c6ff
parentee4a7f2c5d22fa240beebe5f3cbf610cc3e28bc9 (diff)
downloadwireshark-4a467ff609f1b5ee99cbc1aaccdc7b78d3cbecbc.tar.gz
Bluetooth: BTLE: Add src/dst addresses when they are known
Generally where it is not connection then on LinkLayer protocol level addresses for Source and Destination device are known. Change-Id: Id67703edc08df73d4c7a2f66ee8f4d6810a867c9 Reviewed-on: https://code.wireshark.org/review/5776 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
-rw-r--r--epan/dissectors/packet-bluetooth-hci.h3
-rw-r--r--epan/dissectors/packet-bthci_cmd.c62
-rw-r--r--epan/dissectors/packet-bthci_evt.c102
-rw-r--r--epan/dissectors/packet-btle.c58
-rw-r--r--epan/dissectors/packet-hci_mon.c2
5 files changed, 123 insertions, 104 deletions
diff --git a/epan/dissectors/packet-bluetooth-hci.h b/epan/dissectors/packet-bluetooth-hci.h
index 9051c20770..4d9f18541e 100644
--- a/epan/dissectors/packet-bluetooth-hci.h
+++ b/epan/dissectors/packet-bluetooth-hci.h
@@ -143,7 +143,8 @@ typedef struct _localhost_name_entry_t {
} localhost_name_entry_t;
/* In "packet-btle.c" */
-extern gint dissect_bd_addr(gint hf_bd_addr, proto_tree *tree, tvbuff_t *tvb, gint offset);
+extern gint dissect_bd_addr(gint hf_bd_addr, proto_tree *tree, tvbuff_t *tvb,
+ gint offset, guint8 *bdaddr);
#endif
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index bb733acbb6..4800cbcf4c 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -1941,7 +1941,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
break;
case 0x0005: /* Create Connection */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
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);
@@ -1990,36 +1990,36 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
break;
case 0x0008: /* Create Connection Cancel Request */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
break;
case 0x0009: /* Accept Connection Request */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_role, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
break;
case 0x000a: /* Reject Connection Request */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, 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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, 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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
break;
case 0x000d: /* PIN Code Request Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_pin_code_length ,tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2028,7 +2028,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
break;
case 0x000e: /* PIN Code Request Negative Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
break;
case 0x000f: /* Change Connection Packet Type */
@@ -2067,7 +2067,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
break;
case 0x0019: /* Remote Name Request */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2083,7 +2083,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
break;
case 0x001a: /* Remote Name Request Cancel */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
break;
case 0x001c: /* Read Remote Extended Features */
@@ -2099,7 +2099,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
}
proto_tree_add_item(tree, hf_bthci_cmd_transmit_bandwidth, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@@ -2135,7 +2135,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
offset+=2;
break;
case 0x002a: /* Reject Synchronous Connection Request */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_reason, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2151,7 +2151,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
break;
case 0x002b: /* IO Capability Response */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_io_capability, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2162,7 +2162,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
break;
case 0x0034: /* IO Capability Request Negative Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_reason, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
break;
@@ -2171,18 +2171,18 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr
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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
break;
case 0x002e: /* User Passkey Request Reply */
- offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, 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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_hash_c, tvb, offset, 16, ENC_NA);
offset+=16;
@@ -2331,7 +2331,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_role, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2494,7 +2494,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
break;
default:
@@ -2525,7 +2525,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_auto_acc_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2549,7 +2549,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_read_all_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2561,14 +2561,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, 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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_delete_all_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -2859,7 +2859,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_cmd_notification_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
@@ -3139,7 +3139,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
break;
case 0x0006: /* LE Set Advertising Parameters */
@@ -3155,7 +3155,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, 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);
@@ -3212,7 +3212,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, 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);
@@ -3239,7 +3239,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);
+ offset = dissect_bd_addr(hf_bthci_cmd_bd_addr, tree, tvb, offset, NULL);
break;
case 0x0013: /* LE Connection Update */
@@ -5160,7 +5160,7 @@ 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);
+ offset = dissect_bd_addr(hf_btcommon_eir_ad_bd_addr, tree, tvb, offset, NULL);
break;
@@ -5206,7 +5206,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);
+ offset = dissect_bd_addr(hf_btcommon_eir_ad_bd_addr, entry_tree, tvb, offset, NULL);
}
break;
@@ -5228,7 +5228,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);
+ offset = dissect_bd_addr(hf_btcommon_eir_ad_bd_addr, entry_tree, tvb, offset, NULL);
break;
case 0x1C: /* LE Role */
diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c
index d587315309..2befd8317c 100644
--- a/epan/dissectors/packet-bthci_evt.c
+++ b/epan/dissectors/packet-bthci_evt.c
@@ -888,28 +888,6 @@ static const value_string evt_air_mode_vals[] = {
void proto_register_bthci_evt(void);
void proto_reg_handoff_bthci_evt(void);
-static int
-dissect_bthci_evt_bd_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
- proto_tree *tree, guint8 *bdaddr)
-{
- guint8 bd_addr[6];
-
- bd_addr[5] = tvb_get_guint8(tvb, offset);
- bd_addr[4] = tvb_get_guint8(tvb, offset + 1);
- bd_addr[3] = tvb_get_guint8(tvb, offset + 2);
- bd_addr[2] = tvb_get_guint8(tvb, offset + 3);
- bd_addr[1] = tvb_get_guint8(tvb, offset + 4);
- bd_addr[0] = tvb_get_guint8(tvb, offset + 5);
-
- if (bdaddr)
- memcpy(bdaddr, bd_addr, 6);
-
- proto_tree_add_ether(tree, hf_bthci_evt_bd_addr, tvb, offset, 6, bd_addr);
- offset += 6;
-
- return offset;
-}
-
static void bthci_evt_vendor_prompt(packet_info *pinfo _U_, gchar* result)
{
g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Vendor as");
@@ -996,7 +974,7 @@ dissect_bthci_evt_conn_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_bthci_evt_bd_addr(tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
if (!pinfo->fd->flags.visited && hci_data != NULL && status == 0x00) {
wmem_tree_key_t key[5];
guint32 k_interface_id;
@@ -1048,7 +1026,7 @@ dissect_bthci_evt_conn_complete(tvbuff_t *tvb, int offset, packet_info *pinfo,
static int
dissect_bthci_evt_conn_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
call_dissector(btcommon_cod_handle, tvb_new_subset_length(tvb, offset, 3), pinfo, tree);
offset += 3;
@@ -1232,25 +1210,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, proto_tree *tree)
+dissect_bthci_evt_pin_code_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_link_key_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_link_key_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_link_key_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, ENC_NA);
offset += 16;
@@ -1262,7 +1240,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, proto_tree *tree)
+dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
guint8 evt_num_keys;
@@ -1271,7 +1249,7 @@ dissect_bthci_evt_return_link_keys(tvbuff_t *tvb, int offset, packet_info *pinfo
offset += 1;
while (evt_num_keys--) {
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_link_key, tvb, offset, 16, ENC_NA);
offset += 16;
@@ -1304,7 +1282,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_bthci_evt_bd_addr(tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
proto_tree_add_item(tree, hf_bthci_evt_remote_name, tvb, offset, 248, ENC_ASCII|ENC_NA);
if (!pinfo->fd->flags.visited && hci_data != NULL) {
@@ -1416,12 +1394,12 @@ dissect_bthci_evt_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
}
static int
-dissect_bthci_evt_role_change(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_role_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bthci_evt_bd_addr( tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_role, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1639,9 +1617,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, proto_tree *tree)
+dissect_bthci_evt_page_scan_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1650,9 +1628,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, proto_tree *tree)
+dissect_bthci_evt_page_scan_repetition_mode_change(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1671,7 +1649,7 @@ dissect_bthci_evt_inq_result_with_rssi(tvbuff_t *tvb, int offset,
offset += 1;
for (num = 0; num < evt_num_responses; num++) {
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, (num == 0) ? bd_addr : NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, (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;
@@ -1694,17 +1672,17 @@ dissect_bthci_evt_inq_result_with_rssi(tvbuff_t *tvb, int offset,
}
static int
-dissect_bthci_evt_io_capability_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_io_capability_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_io_capability_response(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_io_capability, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1719,9 +1697,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, proto_tree *tree)
+dissect_bthci_evt_user_confirmation_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_numeric_value, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -1730,36 +1708,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, proto_tree *tree)
+dissect_bthci_evt_user_passkey_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_remote_oob_data_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_remote_oob_data_request(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_simple_pairing_complete(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_simple_pairing_complete(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
proto_tree_add_item(tree, hf_bthci_evt_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
return offset;
}
static int
-dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_bthci_evt_user_passkey_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_passkey, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -1768,9 +1746,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, proto_tree *tree)
+dissect_bthci_evt_keypress_notification(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_notification_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -1781,7 +1759,7 @@ 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)
{
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
offset = dissect_bthci_evt_lmp_features(tvb, offset, pinfo, tree, 0);
return offset;
@@ -1820,7 +1798,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_bthci_evt_bd_addr( tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, 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);
@@ -1889,7 +1867,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_bthci_evt_bd_addr( tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, 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;
@@ -2248,7 +2226,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_bthci_evt_bd_addr(tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
if (!pinfo->fd->flags.visited && hci_data != NULL && local_addr) {
wmem_tree_key_t key[4];
guint32 k_interface_id;
@@ -3217,7 +3195,7 @@ dissect_bthci_evt_sync_connection_complete(tvbuff_t *tvb, int offset,
connection_handle = tvb_get_letohs(tvb, offset) & 0x0FFF;
offset += 2;
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, bd_addr);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, bd_addr);
proto_tree_add_item(tree, hf_bthci_evt_sync_link_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
@@ -3413,7 +3391,7 @@ dissect_bthci_evt_inq_result(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
offset += 1;
for (num = 0; num < evt_num_responses; num++) {
- offset = dissect_bthci_evt_bd_addr(tvb, offset, pinfo, tree, NULL);
+ offset = dissect_bd_addr(hf_bthci_evt_bd_addr, tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_bthci_evt_page_scan_repetition_mode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
diff --git a/epan/dissectors/packet-btle.c b/epan/dissectors/packet-btle.c
index 6c0d5d7d90..057a09c802 100644
--- a/epan/dissectors/packet-btle.c
+++ b/epan/dissectors/packet-btle.c
@@ -202,7 +202,7 @@ void proto_reg_handoff_btle(void);
gint
-dissect_bd_addr(gint hf_bd_addr, proto_tree *tree, tvbuff_t *tvb, gint offset)
+dissect_bd_addr(gint hf_bd_addr, proto_tree *tree, tvbuff_t *tvb, gint offset, guint8 *bdaddr)
{
guint8 bd_addr[6];
@@ -216,6 +216,9 @@ dissect_bd_addr(gint hf_bd_addr, proto_tree *tree, tvbuff_t *tvb, gint offset)
proto_tree_add_ether(tree, hf_bd_addr, tvb, offset, 6, bd_addr);
offset += 6;
+ if (bdaddr)
+ memcpy(bdaddr, bd_addr, 6);
+
return offset;
}
@@ -318,6 +321,8 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
guint8 length;
guint32 interface_id;
tvbuff_t *next_tvb;
+ guint8 *dst_bd_addr;
+ guint8 *src_bd_addr;
enum {CRC_INDETERMINATE,
CRC_CAN_BE_CALCULATED,
CRC_INCORRECT,
@@ -326,6 +331,9 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
guint32 packet_crc;
const btle_context_t * btle_context = (const btle_context_t *) data;
+ src_bd_addr = (gchar *) wmem_alloc(pinfo->pool, 6);
+ dst_bd_addr = (gchar *) wmem_alloc(pinfo->pool, 6);
+
if (btle_context && btle_context->crc_checked_at_capture) {
crc_status = btle_context->crc_valid_at_capture ? CRC_CORRECT : CRC_INCORRECT;
}
@@ -405,7 +413,15 @@ 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);
+ offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset, src_bd_addr);
+
+ SET_ADDRESS(&pinfo->net_src, AT_ETHER, 6, src_bd_addr);
+ SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src_bd_addr);
+ SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src_bd_addr);
+
+ SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, 10, "broadcast");
+ SET_ADDRESS(&pinfo->dl_dst, AT_STRINGZ, 10, "broadcast");
+ SET_ADDRESS(&pinfo->dst, AT_STRINGZ, 10, "broadcast");
if (tvb_length_remaining(tvb, offset) > 3) {
next_tvb = tvb_new_subset_length(tvb, offset, tvb_length_remaining(tvb, offset) - 3);
@@ -416,17 +432,41 @@ 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);
- offset = dissect_bd_addr(hf_initiator_addresss, btle_tree, tvb, offset);
+ 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);
+
+ SET_ADDRESS(&pinfo->net_src, AT_ETHER, 6, src_bd_addr);
+ SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src_bd_addr);
+ SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src_bd_addr);
+
+ SET_ADDRESS(&pinfo->net_dst, AT_ETHER, 6, dst_bd_addr);
+ SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst_bd_addr);
+ SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst_bd_addr);
break;
case 0x03: /* SCAN_REQ */
- offset = dissect_bd_addr(hf_scanning_address, btle_tree, tvb, offset);
- offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset);
+ 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);
+
+ SET_ADDRESS(&pinfo->net_src, AT_ETHER, 6, src_bd_addr);
+ SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src_bd_addr);
+ SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src_bd_addr);
+
+ SET_ADDRESS(&pinfo->net_dst, AT_ETHER, 6, dst_bd_addr);
+ SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst_bd_addr);
+ SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst_bd_addr);
break;
case 0x04: /* SCAN_RSP */
- offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset);
+ offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset, src_bd_addr);
+
+ SET_ADDRESS(&pinfo->net_src, AT_ETHER, 6, src_bd_addr);
+ SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src_bd_addr);
+ SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src_bd_addr);
+
+ SET_ADDRESS(&pinfo->net_dst, AT_STRINGZ, 10, "broadcast");
+ SET_ADDRESS(&pinfo->dl_dst, AT_STRINGZ, 10, "broadcast");
+ SET_ADDRESS(&pinfo->dst, AT_STRINGZ, 10, "broadcast");
sub_item = proto_tree_add_item(btle_tree, hf_scan_response_data, tvb, offset, tvb_length_remaining(tvb, offset) - 3, ENC_NA);
sub_tree = proto_item_add_subtree(sub_item, ett_scan_response_data);
@@ -440,8 +480,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);
- offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset);
+ offset = dissect_bd_addr(hf_initiator_addresss, btle_tree, tvb, offset, NULL);
+ offset = dissect_bd_addr(hf_advertising_address, btle_tree, tvb, offset, NULL);
link_layer_data_item = proto_tree_add_item(btle_tree, hf_link_layer_data, tvb, offset, 22, ENC_NA);
link_layer_data_tree = proto_item_add_subtree(link_layer_data_item, ett_link_layer_data);
diff --git a/epan/dissectors/packet-hci_mon.c b/epan/dissectors/packet-hci_mon.c
index 77fb7de8a8..9b307c11d6 100644
--- a/epan/dissectors/packet-hci_mon.c
+++ b/epan/dissectors/packet-hci_mon.c
@@ -217,7 +217,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);
+ offset = dissect_bd_addr(hf_bd_addr, hci_mon_tree, tvb, offset, NULL);
proto_tree_add_item(hci_mon_tree, hf_name, tvb, offset, 8, ENC_NA | ENC_ASCII);
offset += 8;