nl80211: Fix EAPOL frame RX for secondary BSSes
authorJouni Malinen <jouni.malinen@atheros.com>
Fri, 3 Apr 2009 18:04:25 +0000 (21:04 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 3 Apr 2009 18:04:25 +0000 (21:04 +0300)
Need to figure out which BSS should process the frame based on the
source address (STA/Supplicant MAC address).

hostapd/driver.h
hostapd/driver_nl80211.c
hostapd/drv_callbacks.c

index 41cb3d7..e369e84 100644 (file)
@@ -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 */
index db3a7fe..78b9a55 100644 (file)
@@ -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);
+       }
 }
 
 
index ca65078..22058cc 100644 (file)
@@ -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;
+}