aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
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