summaryrefslogtreecommitdiff
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-02-14 23:27:01 +0100
committerJohannes Berg <johannes.berg@intel.com>2013-03-06 16:35:37 +0100
commitf8bacc210408f7a2a182f184a9fa1475b8a67440 (patch)
tree714bcf6b0240c622f9affb6ff7df61b4f9dc87a9 /net/mac80211/cfg.c
parentc0f3a317f2f0e51ad2f8809c83b137958b385c7f (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.c14
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,
if (ieee80211_vif_is_mesh(&sdata->vif)) {
#ifdef CONFIG_MAC80211_MESH
u32 changed = 0;
- if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) {
+ if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED &&
+ (params->sta_modify_mask &
+ STATION_PARAM_APPLY_PLINK_STATE)) {
switch (params->plink_state) {
case NL80211_PLINK_ESTAB:
if (sta->plink_state != NL80211_PLINK_ESTAB)
@@ -1292,12 +1294,18 @@ static int sta_apply_parameters(struct ieee80211_local *local,
/* nothing */
break;
}
+ } else if (params->sta_modify_mask &
+ STATION_PARAM_APPLY_PLINK_STATE) {
+ return -EINVAL;
} else {
switch (params->plink_action) {
- case PLINK_ACTION_OPEN:
+ case NL80211_PLINK_ACTION_NO_ACTION:
+ /* nothing */
+ break;
+ case NL80211_PLINK_ACTION_OPEN:
changed |= mesh_plink_open(sta);
break;
- case PLINK_ACTION_BLOCK:
+ case NL80211_PLINK_ACTION_BLOCK:
changed |= mesh_plink_block(sta);
break;
}