aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2011-09-28 07:12:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-30 15:57:08 -0400
commit07ba55d7f1d0da174c9bc545c713b44cee760197 (patch)
tree6ef39589ced179b1f76d7148652f10fc333f3349 /net/mac80211/cfg.c
parentdfe018bf99537e42c816d3f543620a7e09fcf3cd (diff)
nl80211/mac80211: allow adding TDLS peers as stations
When adding a TDLS peer STA, mark it with a new flag in both nl80211 and mac80211. Before adding a peer, make sure the wiphy supports TDLS and our operating mode is appropriate (managed). In addition, make sure all peers are removed on disassociation. A TDLS peer is first added just before link setup is initiated. In later setup stages we have more info about peer supported rates, capabilities, etc. This info is reported via nl80211_set_station(). Signed-off-by: Arik Nemtsov <arik@wizery.com> Cc: Kalyan C Gaddam <chakkal@iit.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 1d17677a0ec1..119a573af14b 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -713,6 +713,12 @@ static void sta_apply_parameters(struct ieee80211_local *local,
713 if (set & BIT(NL80211_STA_FLAG_AUTHENTICATED)) 713 if (set & BIT(NL80211_STA_FLAG_AUTHENTICATED))
714 sta->flags |= WLAN_STA_AUTH; 714 sta->flags |= WLAN_STA_AUTH;
715 } 715 }
716
717 if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) {
718 sta->flags &= ~WLAN_STA_TDLS_PEER;
719 if (set & BIT(NL80211_STA_FLAG_TDLS_PEER))
720 sta->flags |= WLAN_STA_TDLS_PEER;
721 }
716 spin_unlock_irqrestore(&sta->flaglock, flags); 722 spin_unlock_irqrestore(&sta->flaglock, flags);
717 723
718 if (params->sta_modify_mask & STATION_PARAM_APPLY_UAPSD) { 724 if (params->sta_modify_mask & STATION_PARAM_APPLY_UAPSD) {
@@ -813,6 +819,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
813 819
814 sta_apply_parameters(local, sta, params); 820 sta_apply_parameters(local, sta, params);
815 821
822 /* Only TDLS-supporting stations can add TDLS peers */
823 if ((sta->flags & WLAN_STA_TDLS_PEER) &&
824 !((wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) &&
825 sdata->vif.type == NL80211_IFTYPE_STATION))
826 return -ENOTSUPP;
827
816 rate_control_rate_init(sta); 828 rate_control_rate_init(sta);
817 829
818 layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || 830 layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
@@ -865,6 +877,14 @@ static int ieee80211_change_station(struct wiphy *wiphy,
865 return -ENOENT; 877 return -ENOENT;
866 } 878 }
867 879
880 /* The TDLS bit cannot be toggled after the STA was added */
881 if ((params->sta_flags_mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) &&
882 !!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) !=
883 !!test_sta_flags(sta, WLAN_STA_TDLS_PEER)) {
884 rcu_read_unlock();
885 return -EINVAL;
886 }
887
868 if (params->vlan && params->vlan != sta->sdata->dev) { 888 if (params->vlan && params->vlan != sta->sdata->dev) {
869 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 889 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
870 890