Browse Source

Remove struct ieee80211_hdr dependency from EVENT_RX_FROM_UNKNOWN

It is simpler to just pass in u8* to the beginning of the header.
Jouni Malinen 15 years ago
parent
commit
0d9fc3d8bd
4 changed files with 9 additions and 11 deletions
  1. 3 3
      src/ap/drv_callbacks.c
  2. 1 3
      src/drivers/driver.h
  3. 1 1
      src/drivers/driver_hostap.c
  4. 4 4
      src/drivers/driver_nl80211.c

+ 3 - 3
src/ap/drv_callbacks.c

@@ -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:

+ 1 - 3
src/drivers/driver.h

@@ -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);

+ 1 - 1
src/drivers/driver_hostap.c

@@ -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);
 

+ 4 - 4
src/drivers/driver_nl80211.c

@@ -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;
 	}
 }