From 2c31adb75b8b9d481ddf20d1734ebeaf3a1ed3bb Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Thu, 22 Sep 2022 17:31:38 +0100 Subject: [PATCH] T#8840: SetSSID() operate don't support & (cherry picked from commit 83d92cdafa755061a8ac61c6701e31d20dfd63a2) --- dmtree/tr181/wifi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dmtree/tr181/wifi.c b/dmtree/tr181/wifi.c index bb42a154..c22a9481 100644 --- a/dmtree/tr181/wifi.c +++ b/dmtree/tr181/wifi.c @@ -3775,7 +3775,7 @@ static int get_WiFiDataElementsNetworkSSID_Band(char *refparam, struct dmctx *ct char *band = NULL; dmuci_get_value_by_section_string(((struct dmmap_dup *)data)->config_section, "band", &band); - *value = (!DM_LSTRCMP(band, "2")) ? "2.4" : "5"; + *value = (!DM_LSTRCMP(band, "2")) ? "2.4" : (!DM_LSTRCMP(band, "5")) ? "5" : "6"; return 0; } @@ -6063,15 +6063,19 @@ static int operate_WiFiDataElementsNetwork_SetSSID(char *refparam, struct dmctx if (!ssid_exist) { char sec_name[32]; + unsigned idx = 1; - snprintf(sec_name, sizeof(sec_name), "ap_%s_%s", ssid, (*band == '5') ? "5" : "2"); + uci_foreach_sections("mapcontroller", "ap", s) + idx++; + + snprintf(sec_name, sizeof(sec_name), "ap_%s_%u", (*band == '5') ? "5" : (*band == '6') ? "6" : "2", idx); dmuci_add_section("mapcontroller", "ap", &s); dmuci_rename_section_by_section(s, sec_name); dmuci_set_value_by_section(s, "ssid", ssid); dmuci_set_value_by_section(s, "key", key); dmuci_set_value_by_section(s, "type", "fronthaul"); - dmuci_set_value_by_section(s, "band", (*band == '5') ? "5" : "2"); + dmuci_set_value_by_section(s, "band", (*band == '5') ? "5" : (*band == '6') ? "6" : "2"); dmuci_set_value_by_section(s, "enabled", "1"); }