2012-06-19 00:20:06

by Will Hawkins

[permalink] [raw]
Subject: [PATCH 2/2 v3] mac80211/cfg80211: add support for userspace to handle auth frames on adhoc ifaces

Set the necessary flags to allow user space applications to register for
authentication frames on adhoc interfaces. Also, check to make sure that
"open" authentication frames are not sent when a userspace application
is registered for authentication frames.

Signed-off-by: Will Hawkins <[email protected]>
---
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 725cb4b..5709dcb 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -279,7 +279,8 @@ static struct sta_info
*ieee80211_ibss_finish_sta(struct sta_info *sta,
/* If it fails, maybe we raced another insertion? */
if (sta_info_insert_rcu(sta))
return sta_info_get(sdata, addr);
- if (auth) {
+ if (auth && !cfg80211_mgmt_reg_match(sdata->dev,
+ IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH)) {
ibss_vdbg("TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n",
sdata->vif.addr, sdata->u.ibss.bssid, addr);
ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0,
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index d81c178..4467162 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -455,7 +455,9 @@ static const struct ieee80211_txrx_stypes
ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
[NL80211_IFTYPE_ADHOC] = {
.tx = 0xffff,
- .rx = BIT(IEEE80211_STYPE_ACTION >> 4),
+ .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_DEAUTH >> 4),
},
[NL80211_IFTYPE_STATION] = {
.tx = 0xffff,