diff --git a/src/core/agent_map.c b/src/core/agent_map.c index 1ea5925e71dbb2d7b69e3d8a1ab3ba2f830637f5..0dbcc4d850b47315e46d499b69e509c3ee10ae31 100644 --- a/src/core/agent_map.c +++ b/src/core/agent_map.c @@ -822,7 +822,7 @@ int handle_ap_autoconfig_wsc(void *agent, struct cmdu_cstruct *cmdu) goto teardown; } - uci_apply_m2(ifname, radio->name, out.output.ssid, + rv = uci_apply_m2(ifname, radio->name, out.output.ssid, out.output.auth_types, out.output.encryption_types, out.output.network_key, @@ -830,6 +830,15 @@ int handle_ap_autoconfig_wsc(void *agent, struct cmdu_cstruct *cmdu) out.output.bridge, out.output.proto, out.output.vid, out.output.br_ip, out.output.bk_ssid, out.output.bk_key); + if (rv) { + err("Failure to process M2, tearing down all "\ + " MAP interfaces"\ + " for bssid" MACFMT "\n", + MAC2STR(bssid)); + wifi_teardown_map_ifaces_by_radio(a, + radio->name); + goto teardown; + } break; } default: diff --git a/src/core/config.c b/src/core/config.c index 14508cdba0828b57d54ae20cfe13182a23b04be4..de49dd297ab7c68516ebcc6f09c2917f5056faa1 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -23,6 +23,8 @@ #include <libubus.h> #include <uci.h> +#include <wsc.h> + #include "debug.h" #include "utils.h" #include "config.h" @@ -32,17 +34,6 @@ #include "worker.h" #include "agent.h" -#define WPS_AUTH_OPEN (0x0001) -#define WPS_AUTH_WPAPSK (0x0002) -#define WPS_AUTH_SHARED (0x0004) /* deprecated */ -#define WPS_AUTH_WPA (0x0008) -#define WPS_AUTH_WPA2 (0x0010) -#define WPS_AUTH_WPA2PSK (0x0020) -#define WPS_ENCR_NONE (0x0001) -#define WPS_ENCR_WEP (0x0002) /* deprecated */ -#define WPS_ENCR_TKIP (0x0004) -#define WPS_ENCR_AES (0x0008) - // UCI sections #define UCI_BK_AGENT "bk-iface" #define UCI_FH_AGENT "fh-iface" @@ -506,6 +497,8 @@ static bool get_encryption_value(uint16_t auth_type, uint16_t encryption_type, strncat(encrypt_val, "wpa", elen); else if (auth_type & WPS_AUTH_WPA2) strncat(encrypt_val, "wpa2", elen); + else if (auth_type & WPS_AUTH_OPEN) + strncat(encrypt_val, "none", elen); else return false; @@ -676,7 +669,6 @@ int uci_apply_m2(char *interface_name, char *device, uint8_t *ssid, inet_ntop(AF_INET, &br_ip, ipaddr_str, INET_ADDRSTRLEN); - dbg("Applying WSC configuration (%s):\n", interface_name); dbg(" - SSID : %s\n", ssid); dbg(" - AUTH_TYPE : 0x%04x\n", auth_type); @@ -1849,7 +1841,7 @@ int agent_config_prepare(struct agent_config *cfg) uci_foreach_element(&pkg->sections, e) { struct uci_section *s = uci_to_section(e); struct uci_section *wl_s; - char *device, *ifname; + const char *device, *ifname; uint8_t band = 0; char obj_name[64] = {0}; int rv; @@ -2070,7 +2062,6 @@ int uci_set_bridge(char *config, char *bridge, char *proto, char *ipaddress) } uci_commit(ctx, &pkg, false); -out: uci_unload(ctx, pkg); uci_free_context(ctx); return false;