aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2014-06-11 10:18:18 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-06-23 08:24:54 -0400
commit9deba04d0f0b43ca60a867f006e06625ad85f8c2 (patch)
tree99ff348a43528d5a026899192f88930dae8a5a5f /net/mac80211/tx.c
parenta46992b441f097a971cca39f49d07a0d16a1c0d8 (diff)
mac80211: clarify TDLS Tx handling
Rename the flags used in the Tx path and add an explanation for the reasons to drop, send directly or through the AP. Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index f6018178f33c..865bdaf06ff1 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1811,7 +1811,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1811 int nh_pos, h_pos; 1811 int nh_pos, h_pos;
1812 struct sta_info *sta = NULL; 1812 struct sta_info *sta = NULL;
1813 bool wme_sta = false, authorized = false, tdls_auth = false; 1813 bool wme_sta = false, authorized = false, tdls_auth = false;
1814 bool tdls_direct = false; 1814 bool tdls_peer = false, tdls_setup_frame = false;
1815 bool multicast; 1815 bool multicast;
1816 u32 info_flags = 0; 1816 u32 info_flags = 0;
1817 u16 info_id = 0; 1817 u16 info_id = 0;
@@ -1953,34 +1953,35 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1953#endif 1953#endif
1954 case NL80211_IFTYPE_STATION: 1954 case NL80211_IFTYPE_STATION:
1955 if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) { 1955 if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) {
1956 bool tdls_peer = false;
1957
1958 sta = sta_info_get(sdata, skb->data); 1956 sta = sta_info_get(sdata, skb->data);
1959 if (sta) { 1957 if (sta) {
1960 authorized = test_sta_flag(sta, 1958 authorized = test_sta_flag(sta,
1961 WLAN_STA_AUTHORIZED); 1959 WLAN_STA_AUTHORIZED);
1962 wme_sta = test_sta_flag(sta, WLAN_STA_WME); 1960 wme_sta = test_sta_flag(sta, WLAN_STA_WME);
1963 tdls_peer = test_sta_flag(sta, 1961 tdls_peer = test_sta_flag(sta,
1964 WLAN_STA_TDLS_PEER); 1962 WLAN_STA_TDLS_PEER);
1965 tdls_auth = test_sta_flag(sta, 1963 tdls_auth = test_sta_flag(sta,
1966 WLAN_STA_TDLS_PEER_AUTH); 1964 WLAN_STA_TDLS_PEER_AUTH);
1967 } 1965 }
1968 1966
1969 /* 1967 if (tdls_peer)
1970 * If the TDLS link is enabled, send everything 1968 tdls_setup_frame =
1971 * directly. Otherwise, allow TDLS setup frames 1969 ethertype == ETH_P_TDLS &&
1972 * to be transmitted indirectly. 1970 skb->len > 14 &&
1973 */ 1971 skb->data[14] == WLAN_TDLS_SNAP_RFTYPE;
1974 tdls_direct = tdls_peer && (tdls_auth ||
1975 !(ethertype == ETH_P_TDLS && skb->len > 14 &&
1976 skb->data[14] == WLAN_TDLS_SNAP_RFTYPE));
1977 } 1972 }
1978 1973
1979 if (tdls_direct) { 1974 /*
1980 /* link during setup - throw out frames to peer */ 1975 * TDLS link during setup - throw out frames to peer. We allow
1981 if (!tdls_auth) 1976 * TDLS-setup frames to unauthorized peers for the special case
1982 goto fail_rcu; 1977 * of a link teardown after a TDLS sta is removed due to being
1978 * unreachable.
1979 */
1980 if (tdls_peer && !tdls_auth && !tdls_setup_frame)
1981 goto fail_rcu;
1983 1982
1983 /* send direct packets to authorized TDLS peers */
1984 if (tdls_peer && tdls_auth) {
1984 /* DA SA BSSID */ 1985 /* DA SA BSSID */
1985 memcpy(hdr.addr1, skb->data, ETH_ALEN); 1986 memcpy(hdr.addr1, skb->data, ETH_ALEN);
1986 memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); 1987 memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);