From: Brian Gix Date: Fri, 9 Apr 2021 15:45:24 +0000 (-0700) Subject: mesh: Switch beaconing net key X-Git-Tag: accepted/tizen/unified/20240117.163238~358 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7ea2c9e7a0fc56bb54c6d2d008803151ee55a06d;p=platform%2Fupstream%2Fbluez.git 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. --- diff --git a/mesh/net.c b/mesh/net.c index ebb6887..07ae786 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -2623,6 +2623,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; /* @@ -2630,6 +2637,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);