From 455299fb40d79bcbeaedcfbc04d00ac8330bbbdd Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 13 May 2013 11:53:21 +0300 Subject: [PATCH] nl80211: Fix foreign address filtering for MLME frame events Commit 97279d8d1ad40bd7d884af8e2fc26dff0163331a started filtering MLME frame events based on Address 1 (destination) field. This works fine for frames sent to us, but it did filter out some corner cases where we actually want to process an event based on a frame sent by us. The main such case is deauthentication or disassociation triggered by something external to wpa_supplicant in the system. Fix this by accepting events for frames where either Address 1 or 2 (transmitter) matches the interface address. Signed-hostap: Jouni Malinen --- src/drivers/driver_nl80211.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index d66d2e36a..6bbc3dacb 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -1493,17 +1493,18 @@ static void mlme_event(struct i802_bss *bss, data = nla_data(frame); len = nla_len(frame); - if (len < 4 + ETH_ALEN) { + if (len < 4 + 2 * ETH_ALEN) { wpa_printf(MSG_MSGDUMP, "nl80211: MLME event %d on %s(" MACSTR ") - too short", cmd, bss->ifname, MAC2STR(bss->addr)); return; } wpa_printf(MSG_MSGDUMP, "nl80211: MLME event %d on %s(" MACSTR ") A1=" - MACSTR, cmd, bss->ifname, MAC2STR(bss->addr), - MAC2STR(data + 4)); + MACSTR " A2=" MACSTR, cmd, bss->ifname, MAC2STR(bss->addr), + MAC2STR(data + 4), MAC2STR(data + 4 + ETH_ALEN)); if (cmd != NL80211_CMD_FRAME_TX_STATUS && !(data[4] & 0x01) && - os_memcmp(bss->addr, data + 4, ETH_ALEN) != 0) { + os_memcmp(bss->addr, data + 4, ETH_ALEN) != 0 && + os_memcmp(bss->addr, data + 4 + ETH_ALEN, ETH_ALEN) != 0) { wpa_printf(MSG_MSGDUMP, "nl80211: %s: Ignore MLME frame event " "for foreign address", bss->ifname); return;