Diff between e240ddf32c106d79e04955dda9645a6bd5a8248f and 011afd57f24b9e1895da8572f9ef651b605c19e6

Changed Files

File Additions Deletions Status
monitor/control.c +24 -0 modified

Full Patch

diff --git a/monitor/control.c b/monitor/control.c
index 6ec0bdc..e24fa5a 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -498,6 +498,27 @@ static void mgmt_passkey_notify(uint16_t len, const void *buf)
 	packet_hexdump(buf, len);
 }
 
+static void mgmt_new_irk(uint16_t len, const void *buf)
+{
+	const struct mgmt_ev_new_irk *ev = buf;
+	char addr[18], rpa[18];
+
+	if (len < sizeof(*ev)) {
+		printf("* Malformed New IRK control\n");
+		return;
+	}
+
+	ba2str(&ev->rpa, rpa);
+	ba2str(&ev->irk.addr.bdaddr, addr);
+
+	printf("@ New IRK: %s (%d) %s\n", addr, ev->irk.addr.type, rpa);
+
+	buf += sizeof(*ev);
+	len -= sizeof(*ev);
+
+	packet_hexdump(buf, len);
+}
+
 void control_message(uint16_t opcode, const void *data, uint16_t size)
 {
 	switch (opcode) {
@@ -564,6 +585,9 @@ void control_message(uint16_t opcode, const void *data, uint16_t size)
 	case MGMT_EV_PASSKEY_NOTIFY:
 		mgmt_passkey_notify(size, data);
 		break;
+	case MGMT_EV_NEW_IRK:
+		mgmt_new_irk(size, data);
+		break;
 	default:
 		printf("* Unknown control (code %d len %d)\n", opcode, size);
 		packet_hexdump(data, size);