mac80211: advertise support for full station state in AP mode

This enables adding stations in unauthenticated mode, just after
receiving the first authentication frame; which in turn allows
sending a negative authentication reply if the station cannot be
added.

In addition init rate control for unassociated station only when
it becomes associated, prior to that low rates will be used.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Ayala Beker 2015-09-23 10:41:27 +02:00 коммит произвёл Johannes Berg
Родитель 47edb11b52
Коммит 44674d9c22
2 изменённых файлов: 24 добавлений и 12 удалений

Просмотреть файл

@ -981,7 +981,7 @@ static int sta_apply_auth_flags(struct ieee80211_local *local,
* well. Some drivers require rate control initialized * well. Some drivers require rate control initialized
* before drv_sta_state() is called. * before drv_sta_state() is called.
*/ */
if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
rate_control_rate_init(sta); rate_control_rate_init(sta);
ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC); ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
@ -1120,8 +1120,11 @@ static int sta_apply_parameters(struct ieee80211_local *local,
local->hw.queues >= IEEE80211_NUM_ACS) local->hw.queues >= IEEE80211_NUM_ACS)
sta->sta.wme = set & BIT(NL80211_STA_FLAG_WME); sta->sta.wme = set & BIT(NL80211_STA_FLAG_WME);
/* auth flags will be set later for TDLS stations */ /* auth flags will be set later for TDLS,
if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER)) { * and for unassociated stations that move to assocaited */
if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER) &&
!((mask & BIT(NL80211_STA_FLAG_ASSOCIATED)) &&
(set & BIT(NL80211_STA_FLAG_ASSOCIATED)))) {
ret = sta_apply_auth_flags(local, sta, mask, set); ret = sta_apply_auth_flags(local, sta, mask, set);
if (ret) if (ret)
return ret; return ret;
@ -1213,7 +1216,8 @@ static int sta_apply_parameters(struct ieee80211_local *local,
sta_apply_mesh_params(local, sta, params); sta_apply_mesh_params(local, sta, params);
/* set the STA state after all sta info from usermode has been set */ /* set the STA state after all sta info from usermode has been set */
if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) { if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) ||
set & BIT(NL80211_STA_FLAG_ASSOCIATED)) {
ret = sta_apply_auth_flags(local, sta, mask, set); ret = sta_apply_auth_flags(local, sta, mask, set);
if (ret) if (ret)
return ret; return ret;
@ -1255,12 +1259,14 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
* defaults -- if userspace wants something else we'll * defaults -- if userspace wants something else we'll
* change it accordingly in sta_apply_parameters() * change it accordingly in sta_apply_parameters()
*/ */
if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) { if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) &&
!(params->sta_flags_set & (BIT(NL80211_STA_FLAG_AUTHENTICATED) |
BIT(NL80211_STA_FLAG_ASSOCIATED)))) {
sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
} else {
sta->sta.tdls = true;
} }
if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))
sta->sta.tdls = true;
err = sta_apply_parameters(local, sta, params); err = sta_apply_parameters(local, sta, params);
if (err) { if (err) {
@ -1269,10 +1275,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
} }
/* /*
* for TDLS, rate control should be initialized only when * for TDLS and for unassociated station, rate control should be
* rates are known and station is marked authorized * initialized only when rates are known and station is marked
* authorized/associated
*/ */
if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER)) if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER) &&
test_sta_flag(sta, WLAN_STA_ASSOC))
rate_control_rate_init(sta); rate_control_rate_init(sta);
layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
@ -1347,7 +1355,10 @@ static int ieee80211_change_station(struct wiphy *wiphy,
break; break;
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN: case NL80211_IFTYPE_AP_VLAN:
statype = CFG80211_STA_AP_CLIENT; if (test_sta_flag(sta, WLAN_STA_ASSOC))
statype = CFG80211_STA_AP_CLIENT;
else
statype = CFG80211_STA_AP_CLIENT_UNASSOC;
break; break;
default: default:
err = -EOPNOTSUPP; err = -EOPNOTSUPP;

Просмотреть файл

@ -543,7 +543,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
NL80211_FEATURE_HT_IBSS | NL80211_FEATURE_HT_IBSS |
NL80211_FEATURE_VIF_TXPOWER | NL80211_FEATURE_VIF_TXPOWER |
NL80211_FEATURE_MAC_ON_CREATE | NL80211_FEATURE_MAC_ON_CREATE |
NL80211_FEATURE_USERSPACE_MPM; NL80211_FEATURE_USERSPACE_MPM |
NL80211_FEATURE_FULL_AP_CLIENT_STATE;
if (!ops->hw_scan) if (!ops->hw_scan)
wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN | wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |