]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add STOP_AP control interface command
authorJouni Malinen <j@w1.fi>
Sun, 8 Feb 2015 10:16:13 +0000 (12:16 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 8 Feb 2015 11:35:49 +0000 (13:35 +0200)
This is mainly for testing purposes to allow beaconing to be stopped
without clearing AP state in hostapd.

Signed-off-by: Jouni Malinen <j@w1.fi>
hostapd/ctrl_iface.c
src/ap/ap_drv_ops.h
src/ap/ctrl_iface_ap.c
src/ap/ctrl_iface_ap.h
wpa_supplicant/ap.c
wpa_supplicant/ap.h
wpa_supplicant/ctrl_iface.c

index 54b17dc93b3aa1cf067e9913f8a7216cee0dc218..7d97484a1943ab8f40f8c7c00401f16715577c7a 100644 (file)
@@ -1955,6 +1955,9 @@ static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx,
        } else if (os_strncmp(buf, "DISASSOCIATE ", 13) == 0) {
                if (hostapd_ctrl_iface_disassociate(hapd, buf + 13))
                        reply_len = -1;
+       } else if (os_strcmp(buf, "STOP_AP") == 0) {
+               if (hostapd_ctrl_iface_stop_ap(hapd))
+                       reply_len = -1;
 #ifdef CONFIG_IEEE80211W
 #ifdef NEED_AP_MLME
        } else if (os_strncmp(buf, "SA_QUERY ", 9) == 0) {
index c133be7548a4a4c79dfbc348a13669ab62cab65b..1c8069506c467fbb90a84022988cf0f6be60d9d6 100644 (file)
@@ -335,4 +335,11 @@ static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd,
                                        data_len, buf);
 }
 
+static inline int hostapd_drv_stop_ap(struct hostapd_data *hapd)
+{
+       if (hapd->driver == NULL || hapd->driver->stop_ap == NULL)
+               return 0;
+       return hapd->driver->stop_ap(hapd->drv_priv);
+}
+
 #endif /* AP_DRV_OPS */
index 8c84e3ef121cdd495c67995a7d8c9cb262d20fb3..41ab988277bbda83eaae26b84147bd3ec54989ef 100644 (file)
@@ -537,3 +537,9 @@ int hostapd_parse_csa_settings(const char *pos,
 
        return 0;
 }
+
+
+int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
+{
+       return hostapd_drv_stop_ap(hapd);
+}
index ee58b4c969be63323462c11f7aca8033e0103525..e5297d03e810a092afa48d3b840b31f8a22f5a76 100644 (file)
@@ -23,6 +23,6 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf,
                              size_t buflen);
 int hostapd_parse_csa_settings(const char *pos,
                               struct csa_settings *settings);
-
+int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd);
 
 #endif /* CTRL_IFACE_AP_H */
index 65532e3cb1bc448933aeb5cc2084d5a366d5ca21..fca2137c6f5e410aacb040e85edac0f9e3751761 100644 (file)
@@ -1238,3 +1238,14 @@ int wpas_ap_wps_add_nfc_pw(struct wpa_supplicant *wpa_s, u16 pw_id,
                                              pw ? wpabuf_len(pw) : 0, 1);
 }
 #endif /* CONFIG_WPS_NFC */
+
+
+int wpas_ap_stop_ap(struct wpa_supplicant *wpa_s)
+{
+       struct hostapd_data *hapd;
+
+       if (!wpa_s->ap_iface)
+               return -1;
+       hapd = wpa_s->ap_iface->bss[0];
+       return hostapd_ctrl_iface_stop_ap(hapd);
+}
index 4d80c7a7cf4aeeca75bb26891e4789a3a171f19f..6a118342478f1d613eaa14770e160e0e31a28b7a 100644 (file)
@@ -80,4 +80,6 @@ void wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
                               struct wpa_ssid *ssid,
                               struct hostapd_config *conf);
 
+int wpas_ap_stop_ap(struct wpa_supplicant *wpa_s);
+
 #endif /* AP_H */
index 7a77a7f1970f5a6f9cca5d07b0f9c3aa2584ac27..c4a457748ff3f5207e59f944379a2e96d836bcd3 100644 (file)
@@ -8278,6 +8278,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
        } else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) {
                if (ap_ctrl_iface_chanswitch(wpa_s, buf + 12))
                        reply_len = -1;
+       } else if (os_strcmp(buf, "STOP_AP") == 0) {
+               if (wpas_ap_stop_ap(wpa_s))
+                       reply_len = -1;
 #endif /* CONFIG_AP */
        } else if (os_strcmp(buf, "SUSPEND") == 0) {
                wpas_notify_suspend(wpa_s->global);