-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Bluetooth: Mesh: Provisioner closes link on failed #97478
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -577,10 +577,9 @@ static void prov_complete(const uint8_t *data) | |||||||||||||||||
bt_hex(&provisionee.new_dev_key, 16), node->net_idx, | ||||||||||||||||||
node->num_elem, node->addr); | ||||||||||||||||||
|
||||||||||||||||||
bt_mesh_prov_link.expect = PROV_NO_PDU; | ||||||||||||||||||
atomic_set_bit(bt_mesh_prov_link.flags, COMPLETE); | ||||||||||||||||||
|
||||||||||||||||||
bt_mesh_prov_link.bearer->link_close(PROV_BEARER_LINK_STATUS_SUCCESS); | ||||||||||||||||||
prov_link_close(PROV_BEARER_LINK_STATUS_SUCCESS); | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
static void prov_node_add(void) | ||||||||||||||||||
|
@@ -685,7 +684,7 @@ static void prov_confirm(const uint8_t *data) | |||||||||||||||||
static void prov_failed(const uint8_t *data) | ||||||||||||||||||
{ | ||||||||||||||||||
LOG_WRN("Error: 0x%02x", data[0]); | ||||||||||||||||||
reset_state(); | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't get why provisioner does not clear CDB, state flags and doesn't release Diffie-Hellman key pair upon receiving provisioning failed frame.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you look in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no guarantee this callback is called. For pb gatt this will never cause this callback at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even simple case with pd adv will cause zombie node in CDB and heap leakage over mbedtls once mesh cannot find free adv structure, that might happen at any time and depends on customer configuration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For PB_ADV: For PB-GATT: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You described correctly, but this is applicable only to rpr server. Further rpr server handles this implementation does not assume any calbacks at all. Neither about success nor fail. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why? provisioner.c runs on RPR Client, not RPR server.
This I don't get. This discussion points to In case of RPR, when Provisiong Failed PDU is received, RPR Client will with this new change have this call flow: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And note, this PR aligns behavior with other cases where processing provisioning PDU ends up in failure: Even error handling of zephyr/subsys/bluetooth/mesh/pb_gatt.c Lines 67 to 72 in 9c5325d
But IMHO, this is a different problem and can be addressed in a separate task. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I gave up to argue about this. I still think it is not a good idea to rely on Host reliability to clean up internal mesh resources. Will Host call it in 100% cases or will not? I do not know. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It is guaranteed by Host to call disconnected callback, yes: zephyr/include/zephyr/bluetooth/conn.h Lines 1855 to 1856 in aaf3914
If this doesn't work, then it is Host bug and should be fixed in Host, not in Mesh. I agree with the point of that we should check the return value of |
||||||||||||||||||
prov_link_close(PROV_BEARER_LINK_STATUS_FAIL); | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess provisioner should analyze Error Code value before closing link.
If Error Code is not from Table 5.41 it should call error callback before closing link. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, it will be |
||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
static void local_input_complete(void) | ||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.