#endif /* NEED_AP_MLME */
+static int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
+ const u8 *ie, size_t ie_len)
+{
+ size_t i;
+ int ret = 0;
+
+ for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) {
+ if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
+ sa, ie, ie_len) > 0) {
+ ret = 1;
+ break;
+ }
+ }
+ return ret;
+}
+
+
void wpa_supplicant_event(void *ctx, wpa_event_type event,
union wpa_event_data *data)
{
data->rx_mgmt.frame_len, data->rx_mgmt.fi);
break;
#endif /* NEED_AP_MLME */
+ case EVENT_RX_PROBE_REQ:
+ hostapd_probe_req_rx(hapd, data->rx_probe_req.sa,
+ data->rx_probe_req.ie,
+ data->rx_probe_req.ie_len);
+ break;
default:
wpa_printf(MSG_DEBUG, "Unknown event %d", event);
break;
}
#endif /* HOSTAPD */
-
-
-int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
- const u8 *ie, size_t ie_len)
-{
- size_t i;
- int ret = 0;
-
- for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) {
- if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
- sa, ie, ie_len) > 0) {
- ret = 1;
- break;
- }
- }
- return ret;
-}
*
* This event is used only by driver_test.c and userspace MLME.
*/
- EVENT_MLME_RX
+ EVENT_MLME_RX,
+
+ /**
+ * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
+ *
+ * This event is used to indicate when a Probe Request frame has been
+ * received. Information about the received frame is included in
+ * union wpa_event_data::rx_probe_req.
+ */
+ EVENT_RX_PROBE_REQ,
} wpa_event_type;
int channel;
int ssi;
} mlme_rx;
+
+ /**
+ * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
+ */
+ struct rx_probe_req {
+ /**
+ * sa - Source address of the received Probe Request frame
+ */
+ const u8 *sa;
+
+ /**
+ * ie - IEs from the Probe Request body
+ */
+ const u8 *ie;
+
+ /**
+ * ie_len - Length of ie buffer in octets
+ */
+ size_t ie_len;
+ } rx_probe_req;
};
/**
/* hostapd functions for driver wrappers */
-struct sta_info;
struct ieee80211_hdr;
int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr);
struct hostapd_data * hostapd_sta_get_bss(struct hostapd_data *hapd,
const u8 *addr);
-int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
- const u8 *ie, size_t ie_len);
#endif /* DRIVER_H */
{
struct madwifi_driver_data *drv = ctx;
const struct ieee80211_mgmt *mgmt;
- const u8 *end, *ie;
u16 fc;
- size_t ie_len;
+ union wpa_event_data event;
/* Send Probe Request information to WPS processing */
WLAN_FC_GET_STYPE(fc) != WLAN_FC_STYPE_PROBE_REQ)
return;
- end = buf + len;
- ie = mgmt->u.probe_req.variable;
- ie_len = len - (IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req));
-
- hostapd_probe_req_rx(drv->hapd, mgmt->sa, ie, ie_len);
+ os_memset(&event, 0, sizeof(event));
+ event.rx_probe_req.sa = mgmt->sa;
+ event.rx_probe_req.ie = mgmt->u.probe_req.variable;
+ event.rx_probe_req.ie_len =
+ len - (IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req));
+ wpa_supplicant_event(drv->hapd, EVENT_RX_PROBE_REQ, &event);
}
#endif /* CONFIG_WPS */
{
struct madwifi_driver_data *drv = ctx;
const struct ieee80211_mgmt *mgmt;
- const u8 *end, *ie;
u16 fc;
- size_t ie_len;
+ union wpa_event_data event;
/* Send Probe Request information to WPS processing */
WLAN_FC_GET_STYPE(fc) != WLAN_FC_STYPE_PROBE_REQ)
return;
- end = buf + len;
- ie = mgmt->u.probe_req.variable;
- ie_len = len - (IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req));
-
- hostapd_probe_req_rx(drv->hapd, mgmt->sa, ie, ie_len);
+ os_memset(&event, 0, sizeof(event));
+ event.rx_probe_req.sa = mgmt->sa;
+ event.rx_probe_req.ie = mgmt->u.probe_req.variable;
+ event.rx_probe_req.ie_len =
+ len - (IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req));
+ wpa_supplicant_event(drv->hapd, EVENT_RX_PROBE_REQ, &event);
}
#endif /* IEEE80211_IOCTL_FILTERFRAME */
#endif /* CONFIG_WPS */
u8 sa[ETH_ALEN];
u8 ie[512];
size_t ielen;
+ union wpa_event_data event;
/* data: optional [ ' ' | STA-addr | ' ' | IEs(hex) ] */
MAC2STR(sa));
wpa_hexdump(MSG_MSGDUMP, "test_driver: scan IEs", ie, ielen);
-#ifdef HOSTAPD
- hostapd_probe_req_rx(drv->ctx, sa, ie, ielen);
-#endif /* HOSTAPD */
+ os_memset(&event, 0, sizeof(event));
+ event.rx_probe_req.sa = sa;
+ event.rx_probe_req.ie = ie;
+ event.rx_probe_req.ie_len = ielen;
+ wpa_supplicant_event(drv->ctx, EVENT_RX_PROBE_REQ, &event);
}
for (bss = drv->bss; bss; bss = bss->next) {