summaryrefslogtreecommitdiff
path: root/emulator/smp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-08-12 13:19:14 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-08-12 14:15:24 -0700
commit219e1c6e50cf8f3fdfcf152962a5b0a4c2ae7bc3 (patch)
tree8f4872c702a1358305ad9346749878dd87c38571 /emulator/smp.c
parent561c500795a5bc06c06543ce85477040b708b547 (diff)
downloadbluez-219e1c6e50cf8f3fdfcf152962a5b0a4c2ae7bc3.tar.gz
bthost: Add bthost_debug and use it on smp.c
This adds bthost_debug which wraps util_debug and make use of it in smp.c.
Diffstat (limited to 'emulator/smp.c')
-rw-r--r--emulator/smp.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/emulator/smp.c b/emulator/smp.c
index ec1baea04..21a34dde6 100644
--- a/emulator/smp.c
+++ b/emulator/smp.c
@@ -358,7 +358,8 @@ static bool verify_random(struct smp_conn *conn, const uint8_t rnd[16])
return false;
if (memcmp(conn->pcnf, confirm, sizeof(conn->pcnf)) != 0) {
- printf("Confirmation values don't match\n");
+ bthost_debug(conn->smp->bthost,
+ "Confirmation values don't match");
return false;
}
@@ -698,12 +699,13 @@ void smp_data(void *conn_data, const void *data, uint16_t len)
uint8_t opcode;
if (len < 1) {
- printf("Received too small SMP PDU\n");
+ bthost_debug(conn->smp->bthost, "Received too small SMP PDU");
return;
}
if (conn->addr_type == BDADDR_BREDR) {
- printf("Received BR/EDR SMP data on LE link\n");
+ bthost_debug(conn->smp->bthost,
+ "Received BR/EDR SMP data on LE link");
return;
}
@@ -754,12 +756,13 @@ void smp_bredr_data(void *conn_data, const void *data, uint16_t len)
uint8_t opcode;
if (len < 1) {
- printf("Received too small SMP PDU\n");
+ bthost_debug(conn->smp->bthost, "Received too small SMP PDU");
return;
}
if (conn->addr_type != BDADDR_BREDR) {
- printf("Received LE SMP data on BR/EDR link\n");
+ bthost_debug(conn->smp->bthost,
+ "Received LE SMP data on BR/EDR link");
return;
}
@@ -853,6 +856,7 @@ void *smp_conn_add(void *smp_data, uint16_t handle,
{
struct smp *smp = smp_data;
struct smp_conn *conn;
+ char ia_str[18], ra_str[18];
conn = malloc(sizeof(struct smp_conn));
if (!conn)
@@ -870,6 +874,12 @@ void *smp_conn_add(void *smp_data, uint16_t handle,
memcpy(conn->ia, ia, 6);
memcpy(conn->ra, ra, 6);
+ ba2str((bdaddr_t *) ia, ia_str);
+ ba2str((bdaddr_t *) ra, ra_str);
+
+ bthost_debug(smp->bthost, "ia %s type 0x%02x ra %s type 0x%02x",
+ ia_str, ia_type, ra_str, ra_type);
+
bt_crypto_random_bytes(smp->crypto, conn->prnd, sizeof(conn->prnd));
return conn;