summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-01-16 13:20:07 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2009-01-16 13:20:07 +0200
commitf6646fcfe84b703d0657a0e827682702d64a4788 (patch)
treed9e2502a9351f277346dce9560f2eee79d296b8b
parentb5fe14e46c4351fe582f009de2f0b6d6834566e5 (diff)
Require MITM for dedicated bonding if the remote side is capable of it
-rw-r--r--src/dbus-hci.c10
-rw-r--r--src/device.c5
-rw-r--r--src/device.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index 994e25cc..e340d4e9 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -1277,8 +1277,14 @@ int hcid_dbus_get_io_cap(bdaddr_t *local, bdaddr_t *remote,
if (*auth == 0x00) {
/* If remote requests dedicated bonding follow that lead */
if (device_get_auth(device) == 0x02 ||
- device_get_auth(device) == 0x03)
- *auth = 0x02;
+ device_get_auth(device) == 0x03) {
+ /* If the remote has NoInputNoOutput then don't require
+ * MITM, otherwise require it */
+ if (device_get_cap(device) == 0x03)
+ *auth = 0x02;
+ else
+ *auth = 0x03;
+ }
/* If remote requires MITM then also require it */
if (device_get_auth(device) & 0x01)
diff --git a/src/device.c b/src/device.c
index 0ae81a02..7b3131ff 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1380,6 +1380,11 @@ void device_set_cap(struct btd_device *device, uint8_t cap)
device->cap = cap;
}
+uint8_t device_get_cap(struct btd_device *device)
+{
+ return device->cap;
+}
+
void device_set_auth(struct btd_device *device, uint8_t auth)
{
if (!device)
diff --git a/src/device.h b/src/device.h
index 75119e12..f3a5cea0 100644
--- a/src/device.h
+++ b/src/device.h
@@ -54,6 +54,7 @@ gboolean device_is_busy(struct btd_device *device);
gboolean device_is_temporary(struct btd_device *device);
void device_set_temporary(struct btd_device *device, gboolean temporary);
void device_set_cap(struct btd_device *device, uint8_t cap);
+uint8_t device_get_cap(struct btd_device *device);
void device_set_auth(struct btd_device *device, uint8_t auth);
uint8_t device_get_auth(struct btd_device *device);
gboolean device_is_connected(struct btd_device *device);