2010-10-23 23:39:54 +00:00
|
|
|
--- a/hostapd/ctrl_iface.c
|
|
|
|
+++ b/hostapd/ctrl_iface.c
|
2012-03-27 10:42:47 +00:00
|
|
|
@@ -33,6 +33,7 @@
|
2010-11-09 01:36:36 +00:00
|
|
|
#include "wps/wps.h"
|
2012-03-27 10:42:47 +00:00
|
|
|
#include "config_file.h"
|
2010-10-23 23:39:54 +00:00
|
|
|
#include "ctrl_iface.h"
|
|
|
|
+#include "config_file.h"
|
|
|
|
|
|
|
|
|
|
|
|
struct wpa_ctrl_dst {
|
2012-03-27 10:42:47 +00:00
|
|
|
@@ -43,6 +44,7 @@ struct wpa_ctrl_dst {
|
2010-10-23 23:39:54 +00:00
|
|
|
int errors;
|
|
|
|
};
|
|
|
|
|
|
|
|
+static char *reload_opts = NULL;
|
|
|
|
|
|
|
|
static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
|
|
|
|
const char *buf, size_t len);
|
2012-03-27 10:42:47 +00:00
|
|
|
@@ -152,6 +154,66 @@ static int hostapd_ctrl_iface_new_sta(st
|
2010-11-09 01:36:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2010-10-23 23:39:54 +00:00
|
|
|
|
|
|
|
+static int hostapd_ctrl_iface_set_down(struct hostapd_data *hapd)
|
|
|
|
+{
|
|
|
|
+ if (hapd->driver->stop_ap)
|
|
|
|
+ hapd->driver->stop_ap(hapd->drv_priv);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static char *get_option(char *opt, char *str)
|
|
|
|
+{
|
|
|
|
+ int len = strlen(str);
|
|
|
|
+
|
|
|
|
+ if (!strncmp(opt, str, len))
|
|
|
|
+ return opt + len;
|
|
|
|
+ else
|
|
|
|
+ return NULL;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname)
|
|
|
|
+{
|
|
|
|
+ struct hostapd_config *conf;
|
|
|
|
+ char *opt, *val;
|
|
|
|
+
|
|
|
|
+ conf = hostapd_config_read(fname);
|
|
|
|
+ if (!conf)
|
|
|
|
+ return NULL;
|
|
|
|
+
|
|
|
|
+ for (opt = strtok(reload_opts, " ");
|
|
|
|
+ opt;
|
|
|
|
+ opt = strtok(NULL, " ")) {
|
|
|
|
+
|
|
|
|
+ if ((val = get_option(opt, "channel=")))
|
|
|
|
+ conf->channel = atoi(val);
|
|
|
|
+ else if ((val = get_option(opt, "ht_capab=")))
|
|
|
|
+ conf->ht_capab = atoi(val);
|
|
|
|
+ else if ((val = get_option(opt, "ht_capab_mask=")))
|
|
|
|
+ conf->ht_capab &= atoi(val);
|
|
|
|
+ else if ((val = get_option(opt, "sec_chan=")))
|
|
|
|
+ conf->secondary_channel = atoi(val);
|
2012-08-29 16:06:24 +00:00
|
|
|
+ else if ((val = get_option(opt, "hw_mode=")))
|
2010-10-23 23:39:54 +00:00
|
|
|
+ conf->hw_mode = atoi(val);
|
|
|
|
+ else if ((val = get_option(opt, "ieee80211n=")))
|
|
|
|
+ conf->ieee80211n = atoi(val);
|
|
|
|
+ else
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return conf;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int hostapd_ctrl_iface_reload(struct hostapd_data *hapd, char *txt)
|
|
|
|
+{
|
|
|
|
+ struct hostapd_iface *iface = hapd->iface;
|
|
|
|
+
|
|
|
|
+ iface->config_read_cb = hostapd_ctrl_iface_config_read;
|
|
|
|
+ reload_opts = txt;
|
|
|
|
+
|
|
|
|
+ hostapd_reload_config(iface);
|
|
|
|
+
|
|
|
|
+ iface->config_read_cb = hostapd_config_read;
|
|
|
|
+}
|
|
|
|
|
2010-11-09 01:36:36 +00:00
|
|
|
#ifdef CONFIG_IEEE80211W
|
|
|
|
#ifdef NEED_AP_MLME
|
2012-03-27 10:42:47 +00:00
|
|
|
@@ -710,6 +772,10 @@ static void hostapd_ctrl_iface_receive(i
|
2010-10-23 23:39:54 +00:00
|
|
|
reply_len += res;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_NO_RADIUS */
|
|
|
|
+ } else if (os_strcmp(buf, "DOWN") == 0) {
|
|
|
|
+ hostapd_ctrl_iface_set_down(hapd);
|
|
|
|
+ } else if (os_strncmp(buf, "RELOAD ", 7) == 0) {
|
|
|
|
+ hostapd_ctrl_iface_reload(hapd, buf + 7);
|
|
|
|
} else if (os_strcmp(buf, "STA-FIRST") == 0) {
|
|
|
|
reply_len = hostapd_ctrl_iface_sta_first(hapd, reply,
|
|
|
|
reply_size);
|