Skip to content

Commit

Permalink
Bluetooth: Mesh: Fix checking for subnet when recovering App Key
Browse files Browse the repository at this point in the history
The ordering of items in flash is not guaranteed, so it's possible we
get an App Key before the corresponding Net Key. Remove the check for
a Net Key, since the storing code should never store an App Key if
there is no corresponding Net Key.

Fixes zephyrproject-rtos#9670

Signed-off-by: Johan Hedberg <[email protected]>
  • Loading branch information
Johan Hedberg authored and nashif committed Sep 3, 2018
1 parent be7d276 commit 697919c
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions subsys/bluetooth/host/mesh/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ static int net_key_set(int argc, char **argv, char *val)
static int app_key_set(int argc, char **argv, char *val)
{
struct bt_mesh_app_key *app;
struct bt_mesh_subnet *sub;
struct app_key_val key;
u16_t app_idx;
int len, err;
Expand Down Expand Up @@ -422,12 +421,6 @@ static int app_key_set(int argc, char **argv, char *val)
return -EINVAL;
}

sub = bt_mesh_subnet_get(key.net_idx);
if (!sub) {
BT_ERR("Failed to find subnet 0x%03x", key.net_idx);
return -ENOENT;
}

app = bt_mesh_app_key_find(app_idx);
if (!app) {
app = bt_mesh_app_key_alloc(app_idx);
Expand Down

0 comments on commit 697919c

Please sign in to comment.