mirror of
https://github.com/outbackdingo/wlan-ap.git
synced 2026-02-06 01:26:28 +00:00
opensync: fix passpoint config
- fix potential issue with icon config section name - remove passpoint related entries in config wireless on delete Signed-off-by: Arif Alam <arif.alam@connectus.ai>
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
--- a/interfaces/opensync.ovsschema
|
||||
+++ b/interfaces/opensync.ovsschema
|
||||
@@ -8828,6 +8828,433 @@
|
||||
@@ -8828,6 +8828,442 @@
|
||||
}
|
||||
},
|
||||
"isRoot": true
|
||||
+ },
|
||||
+ "Hotspot20_Icon_Config": {
|
||||
+ "columns": {
|
||||
+ "icon_config_name": {
|
||||
+ "type": {
|
||||
+ "key": {
|
||||
+ "type": "string"
|
||||
+ },
|
||||
+ "min": 1,
|
||||
+ "max": 1
|
||||
+ }
|
||||
+ },
|
||||
+ "url": {
|
||||
+ "type": {
|
||||
+ "key": {
|
||||
|
||||
@@ -35,5 +35,6 @@ extern bool vif_state_update(struct uci_section *s, struct schema_Wifi_VIF_Confi
|
||||
void vif_hs20_update(struct schema_Hotspot20_Config *hs2conf);
|
||||
void vif_hs20_osu_update(struct schema_Hotspot20_OSU_Providers *hs2osuconf);
|
||||
void vif_hs20_icon_update(struct schema_Hotspot20_Icon_Config *hs2iconconf);
|
||||
void vif_section_del(char *section_name);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -462,21 +462,70 @@ static void callback_Hotspot20_Config(ovsdb_update_monitor_t *mon,
|
||||
struct schema_Hotspot20_Config *old,
|
||||
struct schema_Hotspot20_Config *conf)
|
||||
{
|
||||
vif_hs20_update(conf);
|
||||
|
||||
switch (mon->mon_type)
|
||||
{
|
||||
case OVSDB_UPDATE_NEW:
|
||||
case OVSDB_UPDATE_MODIFY:
|
||||
(void) vif_hs20_update(conf);
|
||||
break;
|
||||
|
||||
case OVSDB_UPDATE_DEL:
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(ERR, "Hotspot20_Config: unexpected mon_type %d %s", mon->mon_type, mon->mon_uuid);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void callback_Hotspot20_OSU_Providers(ovsdb_update_monitor_t *mon,
|
||||
struct schema_Hotspot20_OSU_Providers *old,
|
||||
struct schema_Hotspot20_OSU_Providers *conf)
|
||||
{
|
||||
vif_hs20_osu_update(conf);
|
||||
switch (mon->mon_type)
|
||||
{
|
||||
case OVSDB_UPDATE_NEW:
|
||||
case OVSDB_UPDATE_MODIFY:
|
||||
(void) vif_hs20_osu_update(conf);
|
||||
break;
|
||||
|
||||
case OVSDB_UPDATE_DEL:
|
||||
(void) vif_section_del("osu-provider");
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(ERR, "Hotspot20_OSU_Providers: unexpected mon_type %d %s",
|
||||
mon->mon_type, mon->mon_uuid);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void callback_Hotspot20_Icon_Config(ovsdb_update_monitor_t *mon,
|
||||
struct schema_Hotspot20_Icon_Config *old,
|
||||
struct schema_Hotspot20_Icon_Config *conf)
|
||||
{
|
||||
vif_hs20_icon_update(conf);
|
||||
|
||||
switch (mon->mon_type)
|
||||
{
|
||||
case OVSDB_UPDATE_NEW:
|
||||
case OVSDB_UPDATE_MODIFY:
|
||||
(void) vif_hs20_icon_update(conf);
|
||||
break;
|
||||
|
||||
case OVSDB_UPDATE_DEL:
|
||||
(void) vif_section_del("hs20-icon");
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(ERR, "Hotspot20_Icon_Config: unexpected mon_type %d %s",
|
||||
mon->mon_type, mon->mon_uuid);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
bool target_radio_init(const struct target_radio_ops *ops)
|
||||
|
||||
@@ -471,7 +471,7 @@ static void vif_config_custom_opt_set(struct blob_buf *b,
|
||||
blobmsg_add_string(b, "dtim_period", value);
|
||||
else if (strcmp(opt, "radius_nas_id") == 0)
|
||||
blobmsg_add_string(b, "nasid", value);
|
||||
else if (strcmp(opt, "radius_oper_name") == 0)
|
||||
else if (strcmp(opt, "radius_oper_name") == 0 && strlen(value) > 0)
|
||||
{
|
||||
memset(operator_name, '\0', sizeof(operator_name));
|
||||
sprintf(operator_name, "126:s:%s", value);
|
||||
@@ -762,6 +762,34 @@ size_t write_file(void *ptr, size_t size, size_t nmemb, FILE *stream) {
|
||||
return written;
|
||||
}
|
||||
|
||||
void vif_section_del(char *section_name)
|
||||
{
|
||||
|
||||
struct uci_package *wireless;
|
||||
struct uci_element *e = NULL, *tmp = NULL;
|
||||
int ret=0;
|
||||
|
||||
ret= uci_load(uci, "wireless", &wireless);
|
||||
if (ret) {
|
||||
LOGD("%s: uci_load() failed with rc %d", section_name, ret);
|
||||
return;
|
||||
}
|
||||
uci_foreach_element_safe(&wireless->sections, tmp, e) {
|
||||
struct uci_section *s = uci_to_section(e);
|
||||
if ((s == NULL) || (s->type == NULL)) continue;
|
||||
if (!strcmp(s->type, section_name)) {
|
||||
uci_section_del(uci, "vif", "wireless", (char *)s->e.name, section_name);
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
uci_commit(uci, &wireless, false);
|
||||
uci_unload(uci, wireless);
|
||||
reload_config = 1;
|
||||
|
||||
}
|
||||
|
||||
static bool hs20_download_icon(char *icon_name, char *icon_url)
|
||||
{
|
||||
CURL *curl;
|
||||
@@ -1068,7 +1096,7 @@ void vif_hs20_icon_update(struct schema_Hotspot20_Icon_Config *iconconf)
|
||||
sprintf(path, "/tmp/%s", name);
|
||||
blobmsg_add_string(&hs20, "path", path);
|
||||
|
||||
blob_to_uci_section(uci, "wireless", iconconf->name, "hs20-icon",
|
||||
blob_to_uci_section(uci, "wireless", iconconf->icon_config_name, "hs20-icon",
|
||||
hs20.head, &wifi_hs20_icon_param, NULL);
|
||||
reload_config = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user