Merge driver ops set_wps_beacon_ie and set_wps_probe_resp_ie
[libeap.git] / src / drivers / driver_hostap.c
index 86306ee..157b326 100644 (file)
@@ -792,30 +792,28 @@ static int hostap_set_generic_elem(const char *ifname, void *priv,
 }
 
 
-static int hostap_set_wps_beacon_ie(const char *ifname, void *priv,
-                                   const u8 *ie, size_t len)
-{
-       /* Host AP driver supports only one set of extra IEs, so we need to
-        * use the ProbeResp IEs also for Beacon frames since they include more
-        * information. */
-       return 0;
-}
-
-
-static int hostap_set_wps_probe_resp_ie(const char *ifname, void *priv,
-                                       const u8 *ie, size_t len)
+static int hostap_set_ap_wps_ie(const char *ifname, void *priv,
+                               const struct wpabuf *beacon,
+                               const struct wpabuf *proberesp)
 {
        struct hostap_driver_data *drv = priv;
 
+       /*
+        * Host AP driver supports only one set of extra IEs, so we need to
+        * use the Probe Response IEs also for Beacon frames since they include
+        * more information.
+        */
+
        os_free(drv->wps_ie);
        drv->wps_ie = NULL;
        drv->wps_ie_len = 0;
-       if (ie) {
-               drv->wps_ie = os_malloc(len);
+       if (proberesp) {
+               drv->wps_ie = os_malloc(wpabuf_len(proberesp));
                if (drv->wps_ie == NULL)
                        return -1;
-               os_memcpy(drv->wps_ie, ie, len);
-               drv->wps_ie_len = len;
+               os_memcpy(drv->wps_ie, wpabuf_head(proberesp),
+                         wpabuf_len(proberesp));
+               drv->wps_ie_len = wpabuf_len(proberesp);
        }
 
        return hostapd_ioctl_set_generic_elem(drv);
@@ -1650,8 +1648,7 @@ const struct wpa_driver_ops wpa_driver_hostap_ops = {
        .get_inact_sec = hostap_get_inact_sec,
        .sta_clear_stats = hostap_sta_clear_stats,
        .get_hw_feature_data = hostap_get_hw_feature_data,
-       .set_wps_beacon_ie = hostap_set_wps_beacon_ie,
-       .set_wps_probe_resp_ie = hostap_set_wps_probe_resp_ie,
+       .set_ap_wps_ie = hostap_set_ap_wps_ie,
 #else /* HOSTAPD */
        .get_bssid = wpa_driver_hostap_get_bssid,
        .get_ssid = wpa_driver_hostap_get_ssid,