Bluetooth: BAP: SD: Added missing bad code when using mod_src
When the encrypt state was changed via bt_bap_scan_delegator_mod_src then we didn't set the bad broadcast code correctly. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
34fa014682
commit
94e548120b
2 changed files with 11 additions and 1 deletions
|
@ -1469,6 +1469,12 @@ int bt_bap_scan_delegator_mod_src(const struct bt_bap_scan_delegator_mod_src_par
|
||||||
|
|
||||||
if (state->encrypt_state != param->encrypt_state) {
|
if (state->encrypt_state != param->encrypt_state) {
|
||||||
state->encrypt_state = param->encrypt_state;
|
state->encrypt_state = param->encrypt_state;
|
||||||
|
|
||||||
|
if (state->encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE) {
|
||||||
|
(void)memcpy(state->bad_code, internal_state->broadcast_code,
|
||||||
|
sizeof(internal_state->state.bad_code));
|
||||||
|
}
|
||||||
|
|
||||||
state_changed = true;
|
state_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,11 @@ static void bap_broadcast_assistant_recv_state_cb(
|
||||||
SET_FLAG(flag_broadcast_code_requested);
|
SET_FLAG(flag_broadcast_code_requested);
|
||||||
} else if (state->encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE) {
|
} else if (state->encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE) {
|
||||||
SET_FLAG(flag_incorrect_broadcast_code);
|
SET_FLAG(flag_incorrect_broadcast_code);
|
||||||
return;
|
if (memcmp(state->bad_code, INCORRECT_BROADCAST_CODE,
|
||||||
|
BT_AUDIO_BROADCAST_CODE_SIZE) != 0) {
|
||||||
|
FAIL("Bad code is not what we sent");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = 0; i < state->num_subgroups; i++) {
|
for (uint8_t i = 0; i < state->num_subgroups; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue