From 770123a05135f61b591b5f6df18ae00e57c0f970 Mon Sep 17 00:00:00 2001 From: Kamil Zulewski <kamil.zulewski@iopsys.eu> Date: Thu, 18 May 2023 16:11:02 +0200 Subject: [PATCH] Limiting length of Wi-Fi BH link chains Reading max_node_bh_hops config option --- src/config.c | 9 +++++++++ src/config.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/config.c b/src/config.c index 1b0d7234..ebc756c4 100644 --- a/src/config.c +++ b/src/config.c @@ -632,6 +632,7 @@ static int cntlr_config_get_base(struct controller_config *c, CNTLR_DEFAULT_PCP, CNTLR_ENABLE_TS, CNTLR_PROFILE, + CNTRL_MAX_NODE_BH_HOPS, NUM_CNTLR_ATTRS }; @@ -648,6 +649,7 @@ static int cntlr_config_get_base(struct controller_config *c, [CNTLR_DEFAULT_PCP] = { .name = "default_pcp", .type = UCI_TYPE_STRING }, [CNTLR_ENABLE_TS] = { .name = "enable_ts", .type = UCI_TYPE_STRING }, [CNTLR_PROFILE] = { .name = "profile", .type = UCI_TYPE_STRING }, + [CNTRL_MAX_NODE_BH_HOPS] = { .name = "max_node_bh_hops", .type = UCI_TYPE_STRING }, }; struct uci_option *tb[NUM_CNTLR_ATTRS]; @@ -734,6 +736,13 @@ static int cntlr_config_get_base(struct controller_config *c, c->enable_ts = !!atoi(val); } + if (tb[CNTRL_MAX_NODE_BH_HOPS]) { + const char *val = tb[CNTRL_MAX_NODE_BH_HOPS]->v.string; + const int max_hops = atoi(val); + + c->max_node_bh_hops = (max_hops > 0) ? max_hops : 0; + } + return 0; } diff --git a/src/config.h b/src/config.h index c057daa2..a7e8b85a 100644 --- a/src/config.h +++ b/src/config.h @@ -167,6 +167,7 @@ struct controller_config { unsigned int default_pcp; int map_profile; bool enable_ts; + unsigned int max_node_bh_hops; #if (EASYMESH_VERSION > 2) char *dpp_uri_file; #endif -- GitLab