Remove struct ieee80211_hdr dependency from EVENT_RX_FROM_UNKNOWN
[libeap.git] / src / ap / drv_callbacks.c
index ed71d20..28eee76 100644 (file)
@@ -256,9 +256,9 @@ static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface,
 
 
 static void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
-                                       const struct ieee80211_hdr *hdr,
-                                       size_t len)
+                                       const u8 *frame, size_t len)
 {
+       const struct ieee80211_hdr *hdr = (const struct ieee80211_hdr *) frame;
        u16 fc = le_to_host16(hdr->frame_control);
        hapd = get_hapd_bssid(hapd->iface, get_hdr_bssid(hdr, len));
        if (hapd == NULL || hapd == HAPD_BROADCAST)
@@ -321,6 +321,23 @@ static void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, const u8 *buf,
 #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)
 {
@@ -361,7 +378,7 @@ void wpa_supplicant_event(void *ctx, wpa_event_type event,
                }
                break;
        case EVENT_RX_FROM_UNKNOWN:
-               hostapd_rx_from_unknown_sta(hapd, data->rx_from_unknown.hdr,
+               hostapd_rx_from_unknown_sta(hapd, data->rx_from_unknown.frame,
                                            data->rx_from_unknown.len);
                break;
        case EVENT_RX_MGMT:
@@ -369,6 +386,11 @@ void wpa_supplicant_event(void *ctx, wpa_event_type event,
                                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;
@@ -376,14 +398,3 @@ void wpa_supplicant_event(void *ctx, wpa_event_type event,
 }
 
 #endif /* HOSTAPD */
-
-
-void hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
-                        const u8 *ie, size_t ie_len)
-{
-       size_t i;
-
-       for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++)
-               hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
-                                       sa, ie, ie_len);
-}