Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e458b8a2 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

cfg80211: fix nl80211 disconnected events



When reporting a disconnection to userspace, we try
to report whether it was from the AP or by our own
choice. However, we misreported a broadcast deauth
or disassoc as being by own choice, which is wrong.
Fix this by checking the sender address instead of
the destination address.

Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e21546a2
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -149,7 +149,7 @@ static void __cfg80211_send_deauth(struct net_device *dev,


		reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
		reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);


		from_ap = memcmp(mgmt->da, dev->dev_addr, ETH_ALEN) == 0;
		from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
		__cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
		__cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
	} else if (wdev->sme_state == CFG80211_SME_CONNECTING) {
	} else if (wdev->sme_state == CFG80211_SME_CONNECTING) {
		__cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0,
		__cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0,
@@ -215,7 +215,7 @@ static void __cfg80211_send_disassoc(struct net_device *dev,


	reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
	reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);


	from_ap = memcmp(mgmt->da, dev->dev_addr, ETH_ALEN) == 0;
	from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
	__cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
	__cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
}
}