aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
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
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')
-rw-r--r--net/mac80211/cfg.c20
-rw-r--r--net/mac80211/mlme.c7
-rw-r--r--net/mac80211/sta_info.h2
3 files changed, 26 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 1d17677a0ec..119a573af14 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
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index cd37a4e3c0d..b98c43a7f19 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1137,8 +1137,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1137 changed |= BSS_CHANGED_BSSID | BSS_CHANGED_HT; 1137 changed |= BSS_CHANGED_BSSID | BSS_CHANGED_HT;
1138 ieee80211_bss_info_change_notify(sdata, changed); 1138 ieee80211_bss_info_change_notify(sdata, changed);
1139 1139
1140 /* remove AP and TDLS peers */
1140 if (remove_sta) 1141 if (remove_sta)
1141 sta_info_destroy_addr(sdata, bssid); 1142 sta_info_flush(local, sdata);
1142 1143
1143 del_timer_sync(&sdata->u.mgd.conn_mon_timer); 1144 del_timer_sync(&sdata->u.mgd.conn_mon_timer);
1144 del_timer_sync(&sdata->u.mgd.bcn_mon_timer); 1145 del_timer_sync(&sdata->u.mgd.bcn_mon_timer);
@@ -2738,7 +2739,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
2738 req->reason_code, cookie, 2739 req->reason_code, cookie,
2739 !req->local_state_change); 2740 !req->local_state_change);
2740 if (assoc_bss) 2741 if (assoc_bss)
2741 sta_info_destroy_addr(sdata, bssid); 2742 sta_info_flush(sdata->local, sdata);
2742 2743
2743 mutex_lock(&sdata->local->mtx); 2744 mutex_lock(&sdata->local->mtx);
2744 ieee80211_recalc_idle(sdata->local); 2745 ieee80211_recalc_idle(sdata->local);
@@ -2778,7 +2779,7 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
2778 ieee80211_send_deauth_disassoc(sdata, req->bss->bssid, 2779 ieee80211_send_deauth_disassoc(sdata, req->bss->bssid,
2779 IEEE80211_STYPE_DISASSOC, req->reason_code, 2780 IEEE80211_STYPE_DISASSOC, req->reason_code,
2780 cookie, !req->local_state_change); 2781 cookie, !req->local_state_change);
2781 sta_info_destroy_addr(sdata, bssid); 2782 sta_info_flush(sdata->local, sdata);
2782 2783
2783 mutex_lock(&sdata->local->mtx); 2784 mutex_lock(&sdata->local->mtx);
2784 ieee80211_recalc_idle(sdata->local); 2785 ieee80211_recalc_idle(sdata->local);
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 56a3d38a2cd..b6bd4e9d872 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -45,6 +45,7 @@
45 * station in power-save mode, reply when the driver unblocks. 45 * station in power-save mode, reply when the driver unblocks.
46 * @WLAN_STA_PS_DRIVER_BUF: Station has frames pending in driver internal 46 * @WLAN_STA_PS_DRIVER_BUF: Station has frames pending in driver internal
47 * buffers. Automatically cleared on station wake-up. 47 * buffers. Automatically cleared on station wake-up.
48 * @WLAN_STA_TDLS_PEER: station is a TDLS peer.
48 */ 49 */
49enum ieee80211_sta_info_flags { 50enum ieee80211_sta_info_flags {
50 WLAN_STA_AUTH = 1<<0, 51 WLAN_STA_AUTH = 1<<0,
@@ -61,6 +62,7 @@ enum ieee80211_sta_info_flags {
61 WLAN_STA_PS_DRIVER = 1<<12, 62 WLAN_STA_PS_DRIVER = 1<<12,
62 WLAN_STA_PSPOLL = 1<<13, 63 WLAN_STA_PSPOLL = 1<<13,
63 WLAN_STA_PS_DRIVER_BUF = 1<<14, 64 WLAN_STA_PS_DRIVER_BUF = 1<<14,
65 WLAN_STA_TDLS_PEER = 1<<15,
64}; 66};
65 67
66#define STA_TID_NUM 16 68#define STA_TID_NUM 16