]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Started to make set_ap_wps_ie() capable of adding multiple IEs
authorJouni Malinen <jouni.malinen@atheros.com>
Sun, 11 Apr 2010 17:16:43 +0000 (20:16 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 11 Apr 2010 17:16:43 +0000 (20:16 +0300)
This mechanism can be used to add various IEs to Beacon and Probe
Response frames and it should be made clear that it is not reserved
only for WPS IE.

src/ap/ap_drv_ops.c
src/ap/hostapd.h
src/ap/wps_hostapd.c
src/drivers/driver.h
wpa_supplicant/driver_i.h

index 5b0a506c8830a8ac0f0b77c63de9919b63686ae0..f264a3e407ff70bec1736ca7b21deb3ea3b13f0b 100644 (file)
@@ -39,13 +39,20 @@ static int hostapd_sta_flags_to_drv(int flags)
 }
 
 
-static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd,
-                                const struct wpabuf *beacon,
-                                const struct wpabuf *proberesp)
+static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
 {
+       struct wpabuf *beacon, *proberesp;
+       int ret;
+
        if (hapd->driver == NULL || hapd->driver->set_ap_wps_ie == NULL)
                return 0;
-       return hapd->driver->set_ap_wps_ie(hapd->drv_priv, beacon, proberesp);
+
+       beacon = hapd->wps_beacon_ie;
+       proberesp = hapd->wps_probe_resp_ie;
+
+       ret = hapd->driver->set_ap_wps_ie(hapd->drv_priv, beacon, proberesp);
+
+       return ret;
 }
 
 
index 61956f8e419ffbd9e155cbd9742631213af97ea7..3d0bab57c35fef2d862c613e06836b8a0778911f 100644 (file)
@@ -48,9 +48,7 @@ struct hostapd_frame_info {
 
 
 struct hostapd_driver_ops {
-       int (*set_ap_wps_ie)(struct hostapd_data *hapd,
-                            const struct wpabuf *beacon,
-                            const struct wpabuf *probe);
+       int (*set_ap_wps_ie)(struct hostapd_data *hapd);
        int (*send_mgmt_frame)(struct hostapd_data *hapd, const void *msg,
                               size_t len);
        int (*send_eapol)(struct hostapd_data *hapd, const u8 *addr,
index 86ce10f30c5c764fbfa80492313e7bca9ab12d46..bb433add882383c5a1a9bc4943295821aaf69e6e 100644 (file)
@@ -100,8 +100,7 @@ static int hostapd_wps_set_ie_cb(void *ctx, struct wpabuf *beacon_ie,
        wpabuf_free(hapd->wps_probe_resp_ie);
        hapd->wps_probe_resp_ie = probe_resp_ie;
        ieee802_11_set_beacon(hapd);
-       return hapd->drv.set_ap_wps_ie(hapd, hapd->wps_beacon_ie,
-                                      hapd->wps_probe_resp_ie);
+       return hapd->drv.set_ap_wps_ie(hapd);
 }
 
 
@@ -478,7 +477,7 @@ static void hostapd_wps_clear_ies(struct hostapd_data *hapd)
        wpabuf_free(hapd->wps_probe_resp_ie);
        hapd->wps_probe_resp_ie = NULL;
 
-       hapd->drv.set_ap_wps_ie(hapd, NULL, NULL);
+       hapd->drv.set_ap_wps_ie(hapd);
 }
 
 
index 0afc9fc519bdc01442845ac87752c6f7c00c9fa2..5b614f605938be387542d1104b0f257c13ebe6af 100644 (file)
@@ -1591,10 +1591,11 @@ struct wpa_driver_ops {
                             const u8 *ht_oper, size_t ht_oper_len);
 
        /**
-        * set_ap_wps_ie - Add WPS IE into Beacon/Probe Response frames (AP)
+        * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
         * @priv: Private driver interface data
-        * @beacon: WPS IE for Beacon frames
-        * @proberesp: WPS IE for Probe Response frames
+        * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
+        * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
+        *      extra IE(s)
         * Returns: 0 on success, -1 on failure
         *
         * This is an optional function to add WPS IE in the kernel driver for
index fa2ae4fad68ffd88f3bd3a9f0bb1d803cb9cfb26..a70aa6a3e69dcbf76bd3e6a6e5e9f6ff68769277 100644 (file)
@@ -481,4 +481,14 @@ static inline int wpa_drv_signal_monitor(struct wpa_supplicant *wpa_s,
        return -1;
 }
 
+static inline int wpa_drv_set_ap_wps_ie(struct wpa_supplicant *wpa_s,
+                                       const struct wpabuf *beacon,
+                                       const struct wpabuf *proberesp)
+{
+       if (!wpa_s->driver->set_ap_wps_ie)
+               return -1;
+       return wpa_s->driver->set_ap_wps_ie(wpa_s->drv_priv, beacon,
+                                           proberesp);
+}
+
 #endif /* DRIVER_I_H */