From 774201079ee6fc362ac6db7fc9d50112575dc2e0 Mon Sep 17 00:00:00 2001 From: Inga Stotland Date: Tue, 18 Aug 2020 15:22:07 -0700 Subject: [PATCH] mesh: Always set net modes based on node feature settings The network settings such as relay, beacon, proxy and friend are always set based on local node feature settings. This change makes the net modes initialization unconditional, to include the "No Support" setting on node level which should result in the disabled mode in net.c Change-Id: Ie3d31cb8a4af91ee712c6f6fe49da854ba0c0345 Signed-off-by: anuj.bhumiya --- mesh/node.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/mesh/node.c b/mesh/node.c index 546cd7b..1ecdbd8 100644 --- a/mesh/node.c +++ b/mesh/node.c @@ -415,24 +415,16 @@ static bool init_storage_dir(struct mesh_node *node) static void update_net_settings(struct mesh_node *node) { - uint8_t mode; + struct mesh_net *net = node->net; - mode = node->proxy; - if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED) - mesh_net_set_proxy_mode(node->net, mode == MESH_MODE_ENABLED); + mesh_net_set_proxy_mode(net, node->proxy == MESH_MODE_ENABLED); - mode = node->friend; - if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED) - mesh_net_set_friend_mode(node->net, mode == MESH_MODE_ENABLED); + mesh_net_set_friend_mode(net, node->friend == MESH_MODE_ENABLED); - mode = node->relay.mode; - if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED) - mesh_net_set_relay_mode(node->net, mode == MESH_MODE_ENABLED, + mesh_net_set_relay_mode(net, node->relay.mode == MESH_MODE_ENABLED, node->relay.cnt, node->relay.interval); - mode = node->beacon; - if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED) - mesh_net_set_beacon_mode(node->net, mode == MESH_MODE_ENABLED); + mesh_net_set_beacon_mode(net, node->beacon == MESH_MODE_ENABLED); } static bool init_from_storage(struct mesh_config_node *db_node, -- 2.7.4