aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2017-03-16 19:14:47 +0100
committerMichal Labedzki <michal.labedzki@wireshark.org>2017-04-05 07:05:27 +0000
commit76edea174f808785cca55033cb3c2ebfbf149e6a (patch)
treeeecec395720e7853c20fd9cf49d821f251b3e8c5 /epan/dissectors
parentcf54564508f1a4e3ce6af8bab17fb884c5e9b9b9 (diff)
Bluetooth: HCI_CMD: Fix master-slave role
Initiator is always master. Only Role switch event may change it. Improve "Accept Connection Request" to avoid users confusion by using new specification description: 0x00 Become the Master for this connection. The LM will perform the role switch. 0x01 Remain the Slave for this connection. The LM will NOT perform the role switch. Field "Role" is now splitted from: "bthci_cmd.role" and it name is "bthci_cmd.acr.role". Change-Id: I98e3641b9ba9d2fd6c97808e4772beb4265018fd Reviewed-on: https://code.wireshark.org/review/20894 Petri-Dish: Michal Labedzki <michal.labedzki@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@wireshark.org>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-bthci_cmd.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index 83dc5ab9f7..699b3ab71e 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -98,6 +98,7 @@ static int hf_bthci_cmd_packet_type_hv1 = -1;
static int hf_bthci_cmd_packet_type_hv2 = -1;
static int hf_bthci_cmd_packet_type_hv3 = -1;
static int hf_bthci_cmd_role = -1;
+static int hf_bthci_cmd_acr_role = -1;
static int hf_bthci_cmd_pin_code_length = -1;
static int hf_bthci_cmd_pin_code = -1;
static int hf_bthci_cmd_pin_type = -1;
@@ -1668,6 +1669,12 @@ static const value_string cmd_role_vals[] = {
{0, NULL }
};
+static const value_string cmd_acr_role_vals[] = {
+ {0x00, "Become the Master for this connection. The LM will perform the role switch."},
+ {0x01, "Remain the Slave for this connection. The LM will NOT perform the role switch."},
+ {0, NULL }
+};
+
static const value_string cmd_pin_types[] = {
{0x00, "Variable PIN" },
{0x01, "Fixed PIN" },
@@ -2279,12 +2286,10 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
case 0x0009: /* Accept Connection Request */ {
guint8 bd_addr[6];
- guint8 role;
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);
+ proto_tree_add_item(tree, hf_bthci_cmd_acr_role, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
if (!pinfo->fd->flags.visited) {
@@ -2317,12 +2322,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
device_role = (device_role_t *) wmem_new(wmem_file_scope(), device_role_t);
device_role->change_in_frame = frame_number;
- if (role == 0)
- device_role->role = ROLE_SLAVE;
- else if (role == 1)
- device_role->role = ROLE_MASTER;
- else
- device_role->role = ROLE_UNKNOWN;
+ device_role->role = ROLE_MASTER;
wmem_tree_insert32_array(bluetooth_data->bdaddr_to_role, key, device_role);
}
@@ -4977,6 +4977,11 @@ proto_register_bthci_cmd(void)
FT_UINT8, BASE_HEX, VALS(cmd_role_vals), 0x0,
NULL, HFILL }
},
+ { &hf_bthci_cmd_acr_role,
+ { "Role", "bthci_cmd.acr.role",
+ FT_UINT8, BASE_HEX, VALS(cmd_acr_role_vals), 0x0,
+ NULL, HFILL }
+ },
{ &hf_bthci_cmd_pin_code_length,
{ "PIN Code Length", "bthci_cmd.pin_code_length",
FT_UINT8, BASE_DEC, NULL, 0x0,