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.
-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;
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;
struct hostapd_driver_ops {
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,
int (*send_mgmt_frame)(struct hostapd_data *hapd, const void *msg,
size_t len);
int (*send_eapol)(struct hostapd_data *hapd, const u8 *addr,
wpabuf_free(hapd->wps_probe_resp_ie);
hapd->wps_probe_resp_ie = probe_resp_ie;
ieee802_11_set_beacon(hapd);
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);
wpabuf_free(hapd->wps_probe_resp_ie);
hapd->wps_probe_resp_ie = NULL;
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);
const u8 *ht_oper, size_t ht_oper_len);
/**
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
* @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
* Returns: 0 on success, -1 on failure
*
* This is an optional function to add WPS IE in the kernel driver for
+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);
+}
+