From b2187a67598e7e8f55cef258807ad75a2f9ad3d4 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 9 Mar 2014 12:11:04 -0700 Subject: [PATCH] monitor: Add support for decoding New Signature Resolving Key controls --- monitor/control.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/monitor/control.c b/monitor/control.c index b0bc2c64a..6394387d0 100644 --- a/monitor/control.c +++ b/monitor/control.c @@ -519,6 +519,27 @@ static void mgmt_new_irk(uint16_t len, const void *buf) packet_hexdump(buf, len); } +static void mgmt_new_csrk(uint16_t len, const void *buf) +{ + const struct mgmt_ev_new_csrk *ev = buf; + char addr[18]; + + if (len < sizeof(*ev)) { + printf("* Malformed New CSRK control\n"); + return; + } + + ba2str(&ev->key.addr.bdaddr, addr); + + printf("@ New CSRK: %s (%d) %s\n", addr, ev->key.addr.type, + ev->key.master ? "Master" : "Slave"); + + buf += sizeof(*ev); + len -= sizeof(*ev); + + packet_hexdump(buf, len); +} + void control_message(uint16_t opcode, const void *data, uint16_t size) { switch (opcode) { @@ -588,6 +609,9 @@ void control_message(uint16_t opcode, const void *data, uint16_t size) case MGMT_EV_NEW_IRK: mgmt_new_irk(size, data); break; + case MGMT_EV_NEW_CSRK: + mgmt_new_csrk(size, data); + break; default: printf("* Unknown control (code %d len %d)\n", opcode, size); packet_hexdump(data, size); -- 2.47.3