atheros: Clear WPS appie during deinit
authorAshok Kumar Ponnaiah <aponnaia@qti.qualcomm.com>
Tue, 24 Mar 2015 13:05:43 +0000 (15:05 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 24 Mar 2015 13:05:43 +0000 (15:05 +0200)
The WPS IE(s) need to be cleared from the driver explicitly.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/ap/ap_drv_ops.c
src/ap/ap_drv_ops.h
src/ap/wps_hostapd.c
src/drivers/driver_atheros.c

index aae544f..9ee88b4 100644 (file)
@@ -217,6 +217,15 @@ void hostapd_free_ap_extra_ies(struct hostapd_data *hapd,
 }
 
 
+int hostapd_reset_ap_wps_ie(struct hostapd_data *hapd)
+{
+       if (hapd->driver == NULL || hapd->driver->set_ap_wps_ie == NULL)
+               return 0;
+
+       return hapd->driver->set_ap_wps_ie(hapd->drv_priv, NULL, NULL, NULL);
+}
+
+
 int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
 {
        struct wpabuf *beacon, *proberesp, *assocresp;
index 5d07e71..82eaf3f 100644 (file)
@@ -24,6 +24,7 @@ int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
 void hostapd_free_ap_extra_ies(struct hostapd_data *hapd, struct wpabuf *beacon,
                               struct wpabuf *proberesp,
                               struct wpabuf *assocresp);
+int hostapd_reset_ap_wps_ie(struct hostapd_data *hapd);
 int hostapd_set_ap_wps_ie(struct hostapd_data *hapd);
 int hostapd_set_authorized(struct hostapd_data *hapd,
                           struct sta_info *sta, int authorized);
index b0e8b0b..7e74829 100644 (file)
@@ -856,8 +856,10 @@ static void hostapd_wps_clear_ies(struct hostapd_data *hapd, int deinit_only)
        wpabuf_free(hapd->wps_probe_resp_ie);
        hapd->wps_probe_resp_ie = NULL;
 
-       if (deinit_only)
+       if (deinit_only) {
+               hostapd_reset_ap_wps_ie(hapd);
                return;
+       }
 
        hostapd_set_ap_wps_ie(hapd);
 }
index f464421..b8e7864 100644 (file)
@@ -1694,6 +1694,13 @@ atheros_deinit(void *priv)
        struct atheros_driver_data *drv = priv;
 
        atheros_reset_appfilter(drv);
+
+       if (drv->wpa_ie || drv->wps_beacon_ie || drv->wps_probe_resp_ie) {
+               wpabuf_free(drv->wpa_ie);
+               wpabuf_free(drv->wps_beacon_ie);
+               wpabuf_free(drv->wps_probe_resp_ie);
+               atheros_set_opt_ie(priv, NULL, 0);
+       }
        netlink_deinit(drv->netlink);
        (void) linux_set_iface_flags(drv->ioctl_sock, drv->iface, 0);
        if (drv->ioctl_sock >= 0)
@@ -1704,9 +1711,6 @@ atheros_deinit(void *priv)
                l2_packet_deinit(drv->sock_xmit);
        if (drv->sock_raw)
                l2_packet_deinit(drv->sock_raw);
-       wpabuf_free(drv->wpa_ie);
-       wpabuf_free(drv->wps_beacon_ie);
-       wpabuf_free(drv->wps_probe_resp_ie);
        free(drv);
 }