Bluetooth: Test: Update security/ccc_update
Previous commit reverted the `link_encrypted` filed of CCC config. Update the test to match the new expected behavior. Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This commit is contained in:
parent
c2b99c0123
commit
2e13802a38
2 changed files with 21 additions and 16 deletions
|
@ -248,7 +248,7 @@ static void connect_unsubscribe(void)
|
||||||
backchannel_sync_wait(SERVER_CLIENT_CHAN, SERVER_ID);
|
backchannel_sync_wait(SERVER_CLIENT_CHAN, SERVER_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void connect_restore_sec_unsubscribe(void)
|
static void connect_restore_sec(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -270,10 +270,7 @@ static void connect_restore_sec_unsubscribe(void)
|
||||||
/* wait for server to check that the subscribtion has been restored */
|
/* wait for server to check that the subscribtion has been restored */
|
||||||
backchannel_sync_wait(SERVER_CLIENT_CHAN, SERVER_ID);
|
backchannel_sync_wait(SERVER_CLIENT_CHAN, SERVER_ID);
|
||||||
|
|
||||||
/* send unsubscribtion request */
|
/* wait for server to check that the subscription no longer exist */
|
||||||
ccc_unsubscribe();
|
|
||||||
|
|
||||||
/* wait for server to check that the unsubscribtion has been well registered */
|
|
||||||
backchannel_sync_send(SERVER_CLIENT_CHAN, SERVER_ID);
|
backchannel_sync_send(SERVER_CLIENT_CHAN, SERVER_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,7 +344,7 @@ void run_central(void)
|
||||||
backchannel_sync_send(CLIENT_CLIENT_CHAN, BAD_CLIENT_ID);
|
backchannel_sync_send(CLIENT_CLIENT_CHAN, BAD_CLIENT_ID);
|
||||||
backchannel_sync_wait(CLIENT_CLIENT_CHAN, BAD_CLIENT_ID);
|
backchannel_sync_wait(CLIENT_CLIENT_CHAN, BAD_CLIENT_ID);
|
||||||
|
|
||||||
connect_restore_sec_unsubscribe();
|
connect_restore_sec();
|
||||||
disconnect();
|
disconnect();
|
||||||
|
|
||||||
PASS("Central test passed\n");
|
PASS("Central test passed\n");
|
||||||
|
|
|
@ -194,9 +194,9 @@ static void connect_wait_unsubscribtion(struct bt_le_ext_adv *adv)
|
||||||
|
|
||||||
stop_adv(adv);
|
stop_adv(adv);
|
||||||
|
|
||||||
/* check that subscribtion is not restored for bad client */
|
/* check that subscribtion is restored for bad client */
|
||||||
if (is_peer_subscribed(default_conn)) {
|
if (!is_peer_subscribed(default_conn)) {
|
||||||
FAIL("Subscribtion has been restored for bad client\n");
|
FAIL("Subscribtion has not been restored for bad client\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* confirm to bad client that the subscribtion had not been restored */
|
/* confirm to bad client that the subscribtion had not been restored */
|
||||||
|
@ -204,12 +204,12 @@ static void connect_wait_unsubscribtion(struct bt_le_ext_adv *adv)
|
||||||
/* wait for confirmation that bad client requested unsubscribtion */
|
/* wait for confirmation that bad client requested unsubscribtion */
|
||||||
backchannel_sync_wait(BAD_CLIENT_CHAN, BAD_CLIENT_ID);
|
backchannel_sync_wait(BAD_CLIENT_CHAN, BAD_CLIENT_ID);
|
||||||
|
|
||||||
/* check that unsubscribtion request failed */
|
/* check that unsubscribtion request didn't fail */
|
||||||
if (GET_FLAG(ccc_cfg_changed_flag)) {
|
if (!GET_FLAG(ccc_cfg_changed_flag)) {
|
||||||
FAIL("Bad client updated CCC config\n");
|
FAIL("Bad client didn't manage to update CCC config\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* confirm to bad client that unsubscribtion request has been ignored */
|
/* confirm to bad client that unsubscribtion request has been well registered */
|
||||||
backchannel_sync_send(BAD_CLIENT_CHAN, BAD_CLIENT_ID);
|
backchannel_sync_send(BAD_CLIENT_CHAN, BAD_CLIENT_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,9 +225,9 @@ static void connect_restore_sec_check_subscribtion(struct bt_le_ext_adv *adv)
|
||||||
/* wait for good client end of security update */
|
/* wait for good client end of security update */
|
||||||
backchannel_sync_wait(GOOD_CLIENT_CHAN, GOOD_CLIENT_ID);
|
backchannel_sync_wait(GOOD_CLIENT_CHAN, GOOD_CLIENT_ID);
|
||||||
|
|
||||||
/* check that subscribtion has been restored */
|
/* check that subscribtion hasn't been restored */
|
||||||
if (!is_peer_subscribed(default_conn)) {
|
if (is_peer_subscribed(default_conn)) {
|
||||||
FAIL("Good client is not subscribed\n");
|
FAIL("Good client is subscribed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* confirm to good client that the subscribtion has been well restored */
|
/* confirm to good client that the subscribtion has been well restored */
|
||||||
|
@ -285,6 +285,14 @@ static void check_ccc_handle(void)
|
||||||
|
|
||||||
void run_peripheral(void)
|
void run_peripheral(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* test goal: demonstrate the expected behavior of the GATT server when
|
||||||
|
* a non-bonded peer try to unsubscribe from a previously subscription
|
||||||
|
* done in a bonded context
|
||||||
|
*
|
||||||
|
* test pass if the bad client manage to unsubscribe
|
||||||
|
*/
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
struct bt_le_ext_adv *adv = NULL;
|
struct bt_le_ext_adv *adv = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue