From 55df238efd77a3d1787a8adc1d5c81d05469bcc8 Mon Sep 17 00:00:00 2001 From: Michal Labedzki Date: Mon, 29 Dec 2014 08:53:15 +0100 Subject: 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 Reviewed-by: Michal Labedzki Tested-by: Michal Labedzki --- epan/dissectors/packet-btsmp.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'epan/dissectors/packet-btsmp.c') diff --git a/epan/dissectors/packet-btsmp.c b/epan/dissectors/packet-btsmp.c index 5ac91ac54f..d361272b05 100644 --- a/epan/dissectors/packet-btsmp.c +++ b/epan/dissectors/packet-btsmp.c @@ -29,6 +29,7 @@ #include "config.h" #include +#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 } } }; -- cgit v1.2.3