Remove struct ieee80211_hdr dependency from EVENT_RX_FROM_UNKNOWN
authorJouni Malinen <j@w1.fi>
Sun, 3 Jan 2010 10:17:20 +0000 (12:17 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 3 Jan 2010 10:17:20 +0000 (12:17 +0200)
It is simpler to just pass in u8* to the beginning of the header.

src/ap/drv_callbacks.c
src/drivers/driver.h
src/drivers/driver_hostap.c
src/drivers/driver_nl80211.c

index ca316c9..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)
@@ -378,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:
index 8c31619..bfe8dcb 100644 (file)
@@ -1947,7 +1947,7 @@ union wpa_event_data {
         * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
         */
        struct rx_from_unknown {
-               const struct ieee80211_hdr *hdr;
+               const u8 *frame;
                size_t len;
        } rx_from_unknown;
 
@@ -2050,8 +2050,6 @@ void wpa_scan_sort_results(struct wpa_scan_results *res);
 
 /* hostapd functions for driver wrappers */
 
-struct ieee80211_hdr;
-
 int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr);
 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                        const u8 *ie, size_t ielen);
index e976c57..c0f36b8 100644 (file)
@@ -83,7 +83,7 @@ static void handle_data(struct hostap_driver_data *drv, u8 *buf, size_t len,
 
        sa = hdr->addr2;
        os_memset(&event, 0, sizeof(event));
-       event.rx_from_unknown.hdr = hdr;
+       event.rx_from_unknown.frame = buf;
        event.rx_from_unknown.len = len;
        wpa_supplicant_event(drv->hapd, EVENT_RX_FROM_UNKNOWN, &event);
 
index 9982c44..6b4b706 100644 (file)
@@ -2715,11 +2715,11 @@ static void handle_tx_callback(void *ctx, u8 *buf, size_t len, int ok)
 
 
 static void from_unknown_sta(struct wpa_driver_nl80211_data *drv,
-                            struct ieee80211_hdr *hdr, size_t len)
+                            u8 *buf, size_t len)
 {
        union wpa_event_data event;
        os_memset(&event, 0, sizeof(event));
-       event.rx_from_unknown.hdr = hdr;
+       event.rx_from_unknown.frame = buf;
        event.rx_from_unknown.len = len;
        wpa_supplicant_event(drv->ctx, EVENT_RX_FROM_UNKNOWN, &event);
 }
@@ -2747,10 +2747,10 @@ static void handle_frame(struct wpa_driver_nl80211_data *drv,
        case WLAN_FC_TYPE_CTRL:
                /* can only get here with PS-Poll frames */
                wpa_printf(MSG_DEBUG, "CTRL");
-               from_unknown_sta(drv, hdr, len);
+               from_unknown_sta(drv, buf, len);
                break;
        case WLAN_FC_TYPE_DATA:
-               from_unknown_sta(drv, hdr, len);
+               from_unknown_sta(drv, buf, len);
                break;
        }
 }