Browse Source

nl80211: Fix EAPOL frame RX for secondary BSSes

Need to figure out which BSS should process the frame based on the
source address (STA/Supplicant MAC address).
Jouni Malinen 16 years ago
parent
commit
f82ef4d8db
3 changed files with 24 additions and 2 deletions
  1. 2 0
      hostapd/driver.h
  2. 6 2
      hostapd/driver_nl80211.c
  3. 16 0
      hostapd/drv_callbacks.c

+ 2 - 0
hostapd/driver.h

@@ -237,5 +237,7 @@ void hostapd_mgmt_rx(struct hostapd_data *hapd, u8 *buf, size_t len,
 void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, u8 *buf, size_t len,
 			u16 stype, int ok);
 void hostapd_michael_mic_failure(struct hostapd_data *hapd, const u8 *addr);
+struct hostapd_data * hostapd_sta_get_bss(struct hostapd_data *hapd,
+					  const u8 *addr);
 
 #endif /* HOSTAPD_DRIVER_H */

+ 6 - 2
hostapd/driver_nl80211.c

@@ -1731,7 +1731,6 @@ static void handle_frame(struct i802_driver_data *drv,
 static void handle_eapol(int sock, void *eloop_ctx, void *sock_ctx)
 {
 	struct i802_driver_data *drv = eloop_ctx;
-	struct hostapd_data *hapd = drv->hapd;
 	struct sockaddr_ll lladdr;
 	unsigned char buf[3000];
 	int len;
@@ -1744,8 +1743,13 @@ static void handle_eapol(int sock, void *eloop_ctx, void *sock_ctx)
 		return;
 	}
 
-	if (have_ifidx(drv, lladdr.sll_ifindex))
+	if (have_ifidx(drv, lladdr.sll_ifindex)) {
+		struct hostapd_data *hapd;
+		hapd = hostapd_sta_get_bss(drv->hapd, lladdr.sll_addr);
+		if (!hapd)
+			return;
 		hostapd_eapol_receive(hapd, lladdr.sll_addr, buf, len);
+	}
 }
 
 

+ 16 - 0
hostapd/drv_callbacks.c

@@ -278,3 +278,19 @@ void hostapd_michael_mic_failure(struct hostapd_data *hapd, const u8 *addr)
 {
 	michael_mic_failure(hapd, addr, 1);
 }
+
+
+struct hostapd_data * hostapd_sta_get_bss(struct hostapd_data *hapd,
+					  const u8 *addr)
+{
+	struct hostapd_iface *iface = hapd->iface;
+	size_t j;
+
+	for (j = 0; j < iface->num_bss; j++) {
+		hapd = iface->bss[j];
+		if (ap_get_sta(hapd, addr))
+			return hapd;
+	}
+
+	return NULL;
+}