[PATCH] l2_packet: fix bridge workaround for repeater configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In repeater configuration, both AP and STA wireless interfaces may be
included into the same bridge. In this case the following race condition
may occur: wpa_supplicant and hostapd are started, then hostapd clients
are connected before wpa_supplicant connects to remote AP. EAPOL packets
between hostapd and its clients are detected by wpa_supplicant on bridge
interface, prematurely disabling the workaround.

One possible option to fix this issue is to check EAPOL destination MAC
in wpa_supplicant and disable workaround only if EAPOL packet on bridge
interface is indeed intended for wpa_supplicant.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@xxxxxxxxxxxxx>
---
 src/l2_packet/l2_packet_linux.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/l2_packet/l2_packet_linux.c b/src/l2_packet/l2_packet_linux.c
index 291c9dd26..387f5e111 100644
--- a/src/l2_packet/l2_packet_linux.c
+++ b/src/l2_packet/l2_packet_linux.c
@@ -178,12 +178,16 @@ static void l2_packet_receive(int sock, void *eloop_ctx, void *sock_ctx)
 		 * authorization has been completed (in dormant state).
 		 */
 		if (l2->num_rx_br <= 1) {
-			wpa_printf(MSG_DEBUG,
-				   "l2_packet_receive: Main packet socket for %s seems to have working RX - close workaround bridge socket",
-				   l2->ifname);
-			eloop_unregister_read_sock(l2->fd_br_rx);
-			close(l2->fd_br_rx);
-			l2->fd_br_rx = -1;
+			const struct l2_ethhdr *eth = (const struct l2_ethhdr *) buf;
+
+			if (os_memcmp(eth->h_dest, l2->own_addr, ETH_ALEN) == 0) {
+				wpa_printf(MSG_DEBUG,
+					   "l2_packet_receive: Main packet socket for %s seems to have working RX - close workaround bridge socket",
+					   l2->ifname);
+				eloop_unregister_read_sock(l2->fd_br_rx);
+				close(l2->fd_br_rx);
+				l2->fd_br_rx = -1;
+			}
 		}
 
 		addr[0] = buf;
-- 
2.11.0


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux