From 08991756f6040aebd44792e8c932329b9067b57f Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Tue, 13 Feb 2018 09:13:29 +0100 Subject: [PATCH] nimble/host: Do not set peer IRK for all-zero address Also fix comment to be more precise. X-Original-Commit: 471f63d3b4d372c6ae4a5acc51e9c5e67ab3aa1f --- nimble/host/src/ble_hs_pvcy.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nimble/host/src/ble_hs_pvcy.c b/nimble/host/src/ble_hs_pvcy.c index dbabb720c..eeab2a95f 100644 --- a/nimble/host/src/ble_hs_pvcy.c +++ b/nimble/host/src/ble_hs_pvcy.c @@ -229,12 +229,16 @@ ble_hs_pvcy_set_our_irk(const uint8_t *irk) return rc; } - /* Push a null address identity to the controller. The controller uses - * this entry to generate an RPA when we do advertising with - * own-addr-type = rpa. + /* + * Add local IRK entry with 00:00:00:00:00:00 address. This entry will + * be used to generate RPA for non-directed advertising if own_addr_type + * is set to rpa_pub since we use all-zero address as peer addres in + * such case. Peer IRK should be left all-zero since this is not for an + * actual peer. */ memset(tmp_addr, 0, 6); - rc = ble_hs_pvcy_add_entry(tmp_addr, 0, ble_hs_pvcy_irk); + memset(new_irk, 0, 16); + rc = ble_hs_pvcy_add_entry(tmp_addr, 0, new_irk); if (rc != 0) { return rc; }