diff options
author | Antonio Quartulli <ordex@autistici.org> | 2012-01-31 14:25:47 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-02-06 14:53:10 -0500 |
commit | 267335d63b808dc861f3a4dc81a605489a8a13ac (patch) | |
tree | 2f114b6f45147d17ea4cbd57cf33289a57248a1b /net | |
parent | 3eda95de19e1781612091869e866a5014257f462 (diff) |
cfg80211/mac80211: userspace peer authorization in IBSS
If the IBSS network is RSN-protected, let userspace authorize the stations
instead of adding them as AUTHORIZED by default.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/ibss.c | 6 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 20 |
3 files changed, 19 insertions, 9 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 7b3a0b0aa246..8361da4b36ab 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -268,7 +268,10 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta, | |||
268 | 268 | ||
269 | sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); | 269 | sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); |
270 | sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); | 270 | sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); |
271 | sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); | 271 | /* authorize the station only if the network is not RSN protected. If |
272 | * not wait for the userspace to authorize it */ | ||
273 | if (!sta->sdata->u.ibss.control_port) | ||
274 | sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); | ||
272 | 275 | ||
273 | rate_control_rate_init(sta); | 276 | rate_control_rate_init(sta); |
274 | 277 | ||
@@ -1075,6 +1078,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, | |||
1075 | sdata->u.ibss.fixed_bssid = false; | 1078 | sdata->u.ibss.fixed_bssid = false; |
1076 | 1079 | ||
1077 | sdata->u.ibss.privacy = params->privacy; | 1080 | sdata->u.ibss.privacy = params->privacy; |
1081 | sdata->u.ibss.control_port = params->control_port; | ||
1078 | sdata->u.ibss.basic_rates = params->basic_rates; | 1082 | sdata->u.ibss.basic_rates = params->basic_rates; |
1079 | memcpy(sdata->vif.bss_conf.mcast_rate, params->mcast_rate, | 1083 | memcpy(sdata->vif.bss_conf.mcast_rate, params->mcast_rate, |
1080 | sizeof(params->mcast_rate)); | 1084 | sizeof(params->mcast_rate)); |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index a146b1177cb0..74594f012cd3 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -478,6 +478,8 @@ struct ieee80211_if_ibss { | |||
478 | bool fixed_channel; | 478 | bool fixed_channel; |
479 | bool privacy; | 479 | bool privacy; |
480 | 480 | ||
481 | bool control_port; | ||
482 | |||
481 | u8 bssid[ETH_ALEN]; | 483 | u8 bssid[ETH_ALEN]; |
482 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | 484 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
483 | u8 ssid_len, ie_len; | 485 | u8 ssid_len, ie_len; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index e1fd1bf90729..f1681e2c5949 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2654,13 +2654,6 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) | |||
2654 | break; | 2654 | break; |
2655 | case NL80211_IFTYPE_P2P_CLIENT: | 2655 | case NL80211_IFTYPE_P2P_CLIENT: |
2656 | case NL80211_IFTYPE_STATION: | 2656 | case NL80211_IFTYPE_STATION: |
2657 | /* disallow things sta doesn't support */ | ||
2658 | if (params.plink_action) | ||
2659 | return -EINVAL; | ||
2660 | if (params.ht_capa) | ||
2661 | return -EINVAL; | ||
2662 | if (params.listen_interval >= 0) | ||
2663 | return -EINVAL; | ||
2664 | /* | 2657 | /* |
2665 | * Don't allow userspace to change the TDLS_PEER flag, | 2658 | * Don't allow userspace to change the TDLS_PEER flag, |
2666 | * but silently ignore attempts to change it since we | 2659 | * but silently ignore attempts to change it since we |
@@ -2668,7 +2661,15 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) | |||
2668 | * to change the flag. | 2661 | * to change the flag. |
2669 | */ | 2662 | */ |
2670 | params.sta_flags_mask &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); | 2663 | params.sta_flags_mask &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); |
2671 | 2664 | /* fall through */ | |
2665 | case NL80211_IFTYPE_ADHOC: | ||
2666 | /* disallow things sta doesn't support */ | ||
2667 | if (params.plink_action) | ||
2668 | return -EINVAL; | ||
2669 | if (params.ht_capa) | ||
2670 | return -EINVAL; | ||
2671 | if (params.listen_interval >= 0) | ||
2672 | return -EINVAL; | ||
2672 | /* reject any changes other than AUTHORIZED */ | 2673 | /* reject any changes other than AUTHORIZED */ |
2673 | if (params.sta_flags_mask & ~BIT(NL80211_STA_FLAG_AUTHORIZED)) | 2674 | if (params.sta_flags_mask & ~BIT(NL80211_STA_FLAG_AUTHORIZED)) |
2674 | return -EINVAL; | 2675 | return -EINVAL; |
@@ -4802,6 +4803,9 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) | |||
4802 | return PTR_ERR(connkeys); | 4803 | return PTR_ERR(connkeys); |
4803 | } | 4804 | } |
4804 | 4805 | ||
4806 | ibss.control_port = | ||
4807 | nla_get_flag(info->attrs[NL80211_ATTR_CONTROL_PORT]); | ||
4808 | |||
4805 | err = cfg80211_join_ibss(rdev, dev, &ibss, connkeys); | 4809 | err = cfg80211_join_ibss(rdev, dev, &ibss, connkeys); |
4806 | if (err) | 4810 | if (err) |
4807 | kfree(connkeys); | 4811 | kfree(connkeys); |