Bluetooth: SMP: Add missing opcode for "Identity Address Information"

Also fix tvb_length, tvb_length_remaining warnings.

Bug: 10299

Change-Id: Ib8b55ea9f2220394a5896d13e5cc4e2cefff1e13
Reviewed-on: https://code.wireshark.org/review/6407
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
This commit is contained in:
Michal Labedzki 2014-12-29 08:53:15 +01:00
parent d6e0409892
commit 55df238efd
4 changed files with 34 additions and 12 deletions

View File

@ -1002,6 +1002,12 @@ static const value_string bluetooth_company_id_vals[] = {
};
value_string_ext bluetooth_company_id_vals_ext = VALUE_STRING_EXT_INIT(bluetooth_company_id_vals);
const value_string bluetooth_address_type_vals[] = {
{ 0x00, "Public" },
{ 0x01, "Random" },
{ 0, NULL }
};
guint32 max_disconnect_in_frame = G_MAXUINT32;
@ -1192,7 +1198,7 @@ dissect_bluetooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
pinfo->ptype = PT_BLUETOOTH;
get_conversation(pinfo, &pinfo->dl_src, &pinfo->dl_dst, pinfo->srcport, pinfo->destport);
main_item = proto_tree_add_item(tree, proto_bluetooth, tvb, 0, tvb_length(tvb), ENC_NA);
main_item = proto_tree_add_item(tree, proto_bluetooth, tvb, 0, tvb_captured_length(tvb), ENC_NA);
main_tree = proto_item_add_subtree(main_item, ett_bluetooth);
bluetooth_data = (bluetooth_data_t *) wmem_new(wmem_packet_scope(), bluetooth_data_t);
@ -1260,7 +1266,7 @@ dissect_bluetooth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
call_dissector(data_handle, tvb, pinfo, tree);
}
return tvb_length(tvb);
return tvb_captured_length(tvb);
}
void

View File

@ -84,6 +84,8 @@ extern const value_string bthci_cmd_notification_types[];
extern value_string_ext bthci_evt_evt_code_vals_ext;
extern const value_string bluetooth_address_type_vals[];
/* We support Bluetooth over various interfaces, interface_id and adapter_id
is used to decode further payload. Case: there is a host. Host has X

View File

@ -314,12 +314,6 @@ static const value_string batch_scan_mode_vals[] = {
{ 0, NULL }
};
static const value_string address_type_vals[] = {
{ 0x00, "Public" },
{ 0x01, "Random" },
{ 0, NULL }
};
static const value_string batch_scan_discard_rule_vals[] = {
{ 0x00, "Old Items" },
{ 0x01, "Lower RSSI Items" },
@ -1270,7 +1264,7 @@ proto_register_bthci_vendor_broadcom(void)
},
{ &hf_le_batch_scan_address_type,
{ "Address Type", "bthci_vendor.broadcom.le.batch_scan.address_type",
FT_UINT8, BASE_HEX, VALS(address_type_vals), 0x0,
FT_UINT8, BASE_HEX, VALS(bluetooth_address_type_vals), 0x0,
NULL, HFILL }
},
{ &hf_le_batch_scan_discard_rule,
@ -1305,7 +1299,7 @@ proto_register_bthci_vendor_broadcom(void)
},
{ &hf_le_multi_advertising_address_type,
{ "Address Type", "bthci_vendor.broadcom.le.multi_advertising.address_type",
FT_UINT8, BASE_HEX, VALS(address_type_vals), 0x0,
FT_UINT8, BASE_HEX, VALS(bluetooth_address_type_vals), 0x0,
NULL, HFILL }
},
{ &hf_le_multi_advertising_type,

View File

@ -29,6 +29,7 @@
#include "config.h"
#include <epan/packet.h>
#include "packet-bluetooth.h"
#include "packet-btl2cap.h"
/* Initialize the protocol and registered fields */
@ -53,6 +54,8 @@ static int hf_btsmp_ediv = -1;
static int hf_btsmp_authreq = -1;
static int hf_btsmp_initiator_key_distribution = -1;
static int hf_btsmp_responder_key_distribution = -1;
static int hf_bd_addr = -1;
static int hf_address_type = -1;
/* Initialize the subtree pointers */
static gint ett_btsmp = -1;
@ -202,7 +205,7 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
break;
}
if (tvb_length_remaining(tvb, 0) < 1)
if (tvb_reported_length(tvb) < 1)
return FALSE;
proto_tree_add_item(st, hf_btsmp_opcode, tvb, 0, 1, ENC_LITTLE_ENDIAN);
@ -265,7 +268,14 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
offset += 16;
break;
case 0x0a: /* Signing Informationn */
case 0x09: /* Identity Address Information */
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);
break;
case 0x0a: /* Signing Information */
proto_tree_add_item(st, hf_btsmp_signature_key, tvb, offset, 16, ENC_NA);
offset += 16;
break;
@ -380,6 +390,16 @@ proto_register_btsmp(void)
{"Responder Key Distribution", "btsmp.responder_key_distribution",
FT_NONE, BASE_NONE, NULL, 0x00,
NULL, HFILL}
},
{&hf_bd_addr,
{ "BD_ADDR", "btsmp.bd_addr",
FT_ETHER, BASE_NONE, NULL, 0x0,
"Bluetooth Device Address", HFILL}
},
{ &hf_address_type,
{ "Address Type", "btsmp.address_type",
FT_UINT8, BASE_HEX, VALS(bluetooth_address_type_vals), 0x0,
NULL, HFILL }
}
};