diff options
author | Brian Gix <brian.gix@intel.com> | 2021-04-09 08:45:24 -0700 |
---|---|---|
committer | Brian Gix <brian.gix@gmail.com> | 2023-01-30 16:14:41 -0800 |
commit | e71d0e802629bb939c7d518a2e33571fb996b72b (patch) | |
tree | 9dabf8cbb7ba7cd95504a6fa77a08cca5d7840da /mesh | |
parent | cc8a4d858bccccc03899faf9bd5e25439813e15e (diff) | |
download | bluez-e71d0e802629bb939c7d518a2e33571fb996b72b.tar.gz |
mesh: Switch beaconing net key
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.
Diffstat (limited to 'mesh')
-rw-r--r-- | mesh/net.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mesh/net.c b/mesh/net.c index 81f1e57ee..05ca48326 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -2625,6 +2625,13 @@ 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; /* @@ -2632,6 +2639,15 @@ static int key_refresh_phase_two(struct mesh_net *net, uint16_t idx) * 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); |