diff --git a/mesh/net-keys.c b/mesh/net-keys.c
index 65f0808..6f1758f 100644
--- a/mesh/net-keys.c
+++ b/mesh/net-keys.c
l_debug("Setting SNB: IVI: %8.8x, IVU: %d, KR: %d", iv_index, ivu, kr);
print_packet("Set SNB Beacon to", beacon, sizeof(beacon));
+ /* Propagate changes to all local nodes */
+ net_local_beacon(id, beacon);
+
/* Send one new SNB soon, after all nodes have seen it */
l_getrandom(&rand_ms, sizeof(rand_ms));
rand_ms %= 1000;
diff --git a/mesh/net.c b/mesh/net.c
index 0485086..5aeeab1 100644
--- a/mesh/net.c
+++ b/mesh/net.c
net_key_beacon_seen(beacon_data.key_id);
}
+void net_local_beacon(uint32_t key_id, uint8_t *beacon)
+{
+ struct net_beacon_data beacon_data = {
+ .key_id = key_id,
+ .ivu = !!(beacon[2] & 0x02),
+ .kr = !!(beacon[2] & 0x01),
+ .ivi = l_get_be32(beacon + 11),
+ };
+
+ /* Deliver locally generated beacons to all nodes */
+ l_queue_foreach(nets, process_beacon, &beacon_data);
+}
+
bool mesh_net_set_beacon_mode(struct mesh_net *net, bool enable)
{
if (!net)
diff --git a/mesh/net.h b/mesh/net.h
index 07b8783..023b61e 100644
--- a/mesh/net.h
+++ b/mesh/net.h
bool mesh_net_register_unicast(struct mesh_net *net,
uint16_t unicast, uint8_t num_ele);
uint8_t mesh_net_get_num_ele(struct mesh_net *net);
+void net_local_beacon(uint32_t key_id, uint8_t *beacon);
bool mesh_net_set_beacon_mode(struct mesh_net *net, bool enable);
bool mesh_net_set_proxy_mode(struct mesh_net *net, bool enable);
bool mesh_net_set_relay_mode(struct mesh_net *net, bool enable, uint8_t cnt,