diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-02-14 17:27:01 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-03-06 10:35:37 -0500 |
commit | f8bacc210408f7a2a182f184a9fa1475b8a67440 (patch) | |
tree | 714bcf6b0240c622f9affb6ff7df61b4f9dc87a9 /net/mac80211/cfg.c | |
parent | c0f3a317f2f0e51ad2f8809c83b137958b385c7f (diff) |
cfg80211: clean up mesh plink station change API
Make the ability to leave the plink_state unchanged not use a
magic -1 variable that isn't in the enum, but an explicit change
flag; reject invalid plink states or actions and move the needed
constants for plink actions to the right header file. Also
reject plink_state changes for non-mesh interfaces.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index fb306814576a..ca28405d5f65 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1261,7 +1261,9 @@ static int sta_apply_parameters(struct ieee80211_local *local, | |||
1261 | if (ieee80211_vif_is_mesh(&sdata->vif)) { | 1261 | if (ieee80211_vif_is_mesh(&sdata->vif)) { |
1262 | #ifdef CONFIG_MAC80211_MESH | 1262 | #ifdef CONFIG_MAC80211_MESH |
1263 | u32 changed = 0; | 1263 | u32 changed = 0; |
1264 | if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) { | 1264 | if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED && |
1265 | (params->sta_modify_mask & | ||
1266 | STATION_PARAM_APPLY_PLINK_STATE)) { | ||
1265 | switch (params->plink_state) { | 1267 | switch (params->plink_state) { |
1266 | case NL80211_PLINK_ESTAB: | 1268 | case NL80211_PLINK_ESTAB: |
1267 | if (sta->plink_state != NL80211_PLINK_ESTAB) | 1269 | if (sta->plink_state != NL80211_PLINK_ESTAB) |
@@ -1292,12 +1294,18 @@ static int sta_apply_parameters(struct ieee80211_local *local, | |||
1292 | /* nothing */ | 1294 | /* nothing */ |
1293 | break; | 1295 | break; |
1294 | } | 1296 | } |
1297 | } else if (params->sta_modify_mask & | ||
1298 | STATION_PARAM_APPLY_PLINK_STATE) { | ||
1299 | return -EINVAL; | ||
1295 | } else { | 1300 | } else { |
1296 | switch (params->plink_action) { | 1301 | switch (params->plink_action) { |
1297 | case PLINK_ACTION_OPEN: | 1302 | case NL80211_PLINK_ACTION_NO_ACTION: |
1303 | /* nothing */ | ||
1304 | break; | ||
1305 | case NL80211_PLINK_ACTION_OPEN: | ||
1298 | changed |= mesh_plink_open(sta); | 1306 | changed |= mesh_plink_open(sta); |
1299 | break; | 1307 | break; |
1300 | case PLINK_ACTION_BLOCK: | 1308 | case NL80211_PLINK_ACTION_BLOCK: |
1301 | changed |= mesh_plink_block(sta); | 1309 | changed |= mesh_plink_block(sta); |
1302 | break; | 1310 | break; |
1303 | } | 1311 | } |