-
Notifications
You must be signed in to change notification settings - Fork 3k
BLE: Add privacy trace #14127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BLE: Add privacy trace #14127
Conversation
- Prefix with Connection <id> - when appropriate. - Display parameters after `:`. - If multiple parameters should be displayed name then and print the value after =. They are separated by a `,`.
Only the first 8 bytes were generated from the stack.
Address resolution is set at the debug level as it is a very common operation and may clutter the output.
return BLE_ERROR_NOT_IMPLEMENTED; | ||
} | ||
|
||
tr_info("Add RPA to LL resolving list: peer address=%s, type=%s, peer irk=%s, local irk=%s", | ||
to_string(peer_address_type), to_string(peer_identity_address), to_string(peer_irk), to_string(local_irk)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address and type swapped
to_string(peer_address_type), to_string(peer_identity_address), to_string(peer_irk), to_string(local_irk)); | |
to_string(peer_identity_address), to_string(peer_address_type), to_string(peer_irk), to_string(local_irk)); |
return BLE_ERROR_NOT_IMPLEMENTED; | ||
} | ||
|
||
tr_info("Remove RPA from LL resolving list: peer address=%s, type=%s", | ||
to_string(peer_address_type), to_string(peer_identity_address)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_string(peer_address_type), to_string(peer_identity_address)); | |
to_string(peer_identity_address), to_string(peer_address_type)); |
#include "mbed-trace/mbed_trace.h" | ||
#include "common/ble_trace_helpers.h" | ||
|
||
#define TRACE_GROUP "BLSM" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's worth using a different tag: BLPR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
@@ -444,6 +482,7 @@ ble_error_t PalSecurityManager::cancel_pairing( | |||
ble_error_t PalSecurityManager::get_random_data(byte_array_t<8> &random_data) | |||
{ | |||
SecRand(random_data.data(), random_data.size()); | |||
tr_info("Stack generated random data: %s", to_string(random_data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think this is useful, if the data is relevant the caller will log it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That still useful, the caller will log things like set CSRK: .....
It doesn't say much about the origin of the bytes.
I'd keep it, it help me in identifying the issue fixed by #14125
@@ -697,6 +752,7 @@ bool PalSecurityManager::sm_handler(const wsfMsgHdr_t *msg) | |||
} | |||
|
|||
case DM_SEC_LTK_REQ_IND: { | |||
tr_info("Handling event DM_SEC_LTK_REQ_IND"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
traces stop here, but there are a few more events below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I don't know what I was thinking.
@@ -340,6 +370,7 @@ ble_error_t PrivateAddressController::resolve_address_on_host( | |||
|
|||
void PrivateAddressController::on_resolving_list_action_complete() | |||
{ | |||
tr_info("Resolving list action conpleted"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tr_info("Resolving list action conpleted"); | |
tr_info("Resolving list action completed"); |
if (!_db) return BLE_ERROR_INITIALIZATION_INCOMPLETE; | ||
tr_info("Connection %d - Accept pairing request", connection); | ||
if (!_db) { | ||
tr_error("Failure, db not initialized"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it can be collapsed with the rest of them
tr_error("Failure, db not initialized"); | |
tr_error("Failure, DB not initialized"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess same below, some copy pasting would solve this to avoid accidental differences in lines.
return; | ||
} | ||
|
||
SecurityDistributionFlags_t* flags = _db->get_distribution_flags(cb->db_entry); | ||
if (!flags) { | ||
tr_error("Connection %d - Cannot enable encryption, no distribution flags found for entry %p", cb->connection, cb->db_entry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honestly, if you're fixing things, this whole if statement should just be an MBED_ASSERT(flags);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same below and other instances
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix would be to validate the DB when it is loaded. I'm not doing it now.
PasskeyAscii ascii_passkey(passkey); | ||
tr_info("Connection %d - Received passkey display %.*s", | ||
connection, ascii_passkey.PASSKEY_LEN, ascii_passkey.value()); | ||
eventHandler->passkeyDisplay(connection, ascii_passkey.value()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we null check eventHandler? you added the check to other places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and another one below
set_mitm_performed(connection); | ||
if (!eventHandler) { | ||
tr_error("Impossible to forward Keypress notification to application, no event handler registered"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the call below proceeds, needs to be in else block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should just merge and I'll make a separate PR to fix the issues listed above
- Put privacy traces in BLPR - Add missing traces in PALSecurityManagerImpl.cpp - Add missing EventHandler null pointer check - Typo and parameters order fix.
Thanks @paul-szczepanek-arm . I addressed your changes. |
Add traces to the Bluetooth Security Manager and Privacy controller. The traces are made to be comprehensive to improve the ux when users submit bugs. A centralized set of helpers has been created to convert BLE types to string. * BLE: Add SM traces * BLE: Add traces to Security Manager PAL * BLE: Make SM traces consistent. - Prefix with Connection <id> - when appropriate. - Display parameters after `:`. - If multiple parameters should be displayed name then and print the value after =. They are separated by a `,`. * BLE: Fix SM random number generation. Only the first 8 bytes were generated from the stack. * BLE: Regenerate CSRK if it is all zeroes. * BLE: Add trace into privacy modules Address resolution is set at the debug level as it is a very common operation and may clutter the output. * Address trace review for SM: - Put privacy traces in BLPR - Add missing traces in PALSecurityManagerImpl.cpp - Add missing EventHandler null pointer check - Typo and parameters order fix.
Add traces to the Bluetooth Security Manager and Privacy controller. The traces are made to be comprehensive to improve the ux when users submit bugs. A centralized set of helpers has been created to convert BLE types to string. * BLE: Add SM traces * BLE: Add traces to Security Manager PAL * BLE: Make SM traces consistent. - Prefix with Connection <id> - when appropriate. - Display parameters after `:`. - If multiple parameters should be displayed name then and print the value after =. They are separated by a `,`. * BLE: Fix SM random number generation. Only the first 8 bytes were generated from the stack. * BLE: Regenerate CSRK if it is all zeroes. * BLE: Add trace into privacy modules Address resolution is set at the debug level as it is a very common operation and may clutter the output. * Address trace review for SM: - Put privacy traces in BLPR - Add missing traces in PALSecurityManagerImpl.cpp - Add missing EventHandler null pointer check - Typo and parameters order fix.
Add traces to the Bluetooth Security Manager and Privacy controller. The traces are made to be comprehensive to improve the ux when users submit bugs. A centralized set of helpers has been created to convert BLE types to string. * BLE: Add SM traces * BLE: Add traces to Security Manager PAL * BLE: Make SM traces consistent. - Prefix with Connection <id> - when appropriate. - Display parameters after `:`. - If multiple parameters should be displayed name then and print the value after =. They are separated by a `,`. * BLE: Fix SM random number generation. Only the first 8 bytes were generated from the stack. * BLE: Regenerate CSRK if it is all zeroes. * BLE: Add trace into privacy modules Address resolution is set at the debug level as it is a very common operation and may clutter the output. * Address trace review for SM: - Put privacy traces in BLPR - Add missing traces in PALSecurityManagerImpl.cpp - Add missing EventHandler null pointer check - Typo and parameters order fix.
Add traces to the Bluetooth Security Manager and Privacy controller. The traces are made to be comprehensive to improve the ux when users submit bugs. A centralized set of helpers has been created to convert BLE types to string. * BLE: Add SM traces * BLE: Add traces to Security Manager PAL * BLE: Make SM traces consistent. - Prefix with Connection <id> - when appropriate. - Display parameters after `:`. - If multiple parameters should be displayed name then and print the value after =. They are separated by a `,`. * BLE: Fix SM random number generation. Only the first 8 bytes were generated from the stack. * BLE: Regenerate CSRK if it is all zeroes. * BLE: Add trace into privacy modules Address resolution is set at the debug level as it is a very common operation and may clutter the output. * Address trace review for SM: - Put privacy traces in BLPR - Add missing traces in PALSecurityManagerImpl.cpp - Add missing EventHandler null pointer check - Typo and parameters order fix.
Summary of changes
Add traces to the privacy controller and its associated PAL.
Traces of the host resolution operation are set at the debug level to not clutter the output.
Preceding PR: #14118
Impact of changes
Migration actions required
Documentation
Pull request type
Test results
Reviewers