Skip to content

Commit

Permalink
mesh: Switch beaconing net key
Browse files Browse the repository at this point in the history
When transitioning from Phase 1 to Phase 2 of a network key and we are
beaconing, we need to halt the beaconing on the old key version, and
begin beaconing on the new key version.
  • Loading branch information
bgix committed Jan 31, 2023
1 parent cc8a4d8 commit e71d0e8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mesh/net.c
Expand Up @@ -2625,13 +2625,29 @@ static int key_refresh_phase_two(struct mesh_net *net, uint16_t idx)
if (subnet->kr_phase == KEY_REFRESH_PHASE_TWO)
return MESH_STATUS_SUCCESS;

/* Stop beaconing on old key */
if (net->snb_enable)
net_key_beacon_disable(subnet->net_key_tx, false);

if (net->mpb_enable)
net_key_beacon_disable(subnet->net_key_tx, true);

subnet->key_refresh = 1;
subnet->net_key_tx = subnet->net_key_upd;
/*
* TODO: Provisioner may need to stay in phase three until
* it hears beacons from all the nodes
*/
subnet->kr_phase = KEY_REFRESH_PHASE_TWO;

/* Start beaconing on new key */
if (net->snb_enable)
net_key_beacon_enable(subnet->net_key_tx, false, 0);

if (net->mpb_enable)
net_key_beacon_enable(subnet->net_key_tx, true,
net->mpb_period);

refresh_beacon(subnet, net);
queue_friend_update(net);

Expand Down

0 comments on commit e71d0e8

Please sign in to comment.