1 --- a/hostapd/ctrl_iface.c
2 +++ b/hostapd/ctrl_iface.c
5 #include "config_file.h"
6 #include "ctrl_iface.h"
7 +#include "config_file.h"
11 @@ -47,6 +48,7 @@ struct wpa_ctrl_dst {
15 +static char *reload_opts = NULL;
17 static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
18 const char *buf, size_t len);
19 @@ -156,6 +158,68 @@ static int hostapd_ctrl_iface_new_sta(st
23 +static int hostapd_ctrl_iface_set_down(struct hostapd_data *hapd)
25 + if (hapd->driver->stop_ap)
26 + hapd->driver->stop_ap(hapd->drv_priv);
30 +static char *get_option(char *opt, char *str)
32 + int len = strlen(str);
34 + if (!strncmp(opt, str, len))
40 +static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname)
42 + struct hostapd_config *conf;
45 + conf = hostapd_config_read(fname);
49 + for (opt = strtok(reload_opts, " ");
51 + opt = strtok(NULL, " ")) {
53 + if ((val = get_option(opt, "channel=")))
54 + conf->channel = atoi(val);
55 + else if ((val = get_option(opt, "ht_capab=")))
56 + conf->ht_capab = atoi(val);
57 + else if ((val = get_option(opt, "ht_capab_mask=")))
58 + conf->ht_capab &= atoi(val);
59 + else if ((val = get_option(opt, "sec_chan=")))
60 + conf->secondary_channel = atoi(val);
61 + else if ((val = get_option(opt, "hw_mode=")))
62 + conf->hw_mode = atoi(val);
63 + else if ((val = get_option(opt, "ieee80211n=")))
64 + conf->ieee80211n = atoi(val);
72 +static int hostapd_ctrl_iface_update(struct hostapd_data *hapd, char *txt)
74 + struct hostapd_config * (*config_read_cb)(const char *config_fname);
75 + struct hostapd_iface *iface = hapd->iface;
77 + config_read_cb = iface->interfaces->config_read_cb;
78 + iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
81 + hostapd_reload_config(iface);
83 + iface->interfaces->config_read_cb = config_read_cb;
86 #ifdef CONFIG_IEEE80211W
88 @@ -1546,6 +1610,10 @@ static void hostapd_ctrl_iface_receive(i
89 } else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
90 reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
92 + } else if (os_strcmp(buf, "DOWN") == 0) {
93 + hostapd_ctrl_iface_set_down(hapd);
94 + } else if (os_strncmp(buf, "UPDATE ", 7) == 0) {
95 + hostapd_ctrl_iface_update(hapd, buf + 7);
98 os_memcpy(reply, "UNKNOWN COMMAND\n", 16);