summaryrefslogtreecommitdiff
path: root/monitor/control.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-05-30 13:12:08 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2014-12-03 16:32:46 +0200
commitfc59dabdede3957d419a57bbdb11e1ec8436150a (patch)
tree96dbe866456b4a50074de852c1b9f0dadf1f6f02 /monitor/control.c
parent115fc8b9230d4929d29466b6b6dff19c7f991c8b (diff)
downloadbluez-fc59dabdede3957d419a57bbdb11e1ec8436150a.tar.gz
monitor: Print full type information for LTKs
Diffstat (limited to 'monitor/control.c')
-rw-r--r--monitor/control.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/monitor/control.c b/monitor/control.c
index 36ebcbca5..d9d6b4421 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -245,6 +245,7 @@ static void mgmt_new_link_key(uint16_t len, const void *buf)
static void mgmt_new_long_term_key(uint16_t len, const void *buf)
{
const struct mgmt_ev_new_long_term_key *ev = buf;
+ const char *type;
char str[18];
if (len < sizeof(*ev)) {
@@ -252,10 +253,38 @@ static void mgmt_new_long_term_key(uint16_t len, const void *buf)
return;
}
+ /* LE SC keys are both for master and slave */
+ switch (ev->key.type) {
+ case 0x00:
+ if (ev->key.master)
+ type = "Master (Unauthenticated)";
+ else
+ type = "Slave (Unauthenticated)";
+ break;
+ case 0x01:
+ if (ev->key.master)
+ type = "Master (Authenticated)";
+ else
+ type = "Slave (Authenticated)";
+ break;
+ case 0x02:
+ type = "SC (Unauthenticated)";
+ break;
+ case 0x03:
+ type = "SC (Authenticated)";
+ break;
+ case 0x04:
+ type = "SC (Debug)";
+ break;
+ default:
+ type = "<unknown>";
+ break;
+ }
+
ba2str(&ev->key.addr.bdaddr, str);
- printf("@ New Long Term Key: %s (%d) %s\n", str, ev->key.addr.type,
- ev->key.master ? "Master" : "Slave");
+ printf("@ New Long Term Key: %s (%d) %s 0x%02x\n", str,
+ ev->key.addr.type, type, ev->key.type);
buf += sizeof(*ev);
len -= sizeof(*ev);