Skip to content

Commit dfe018b

Browse files
ariknemlinvjw
authored andcommitted
mac80211: handle TDLS high-level commands and frames
Register and implement the TDLS cfg80211 callback functions. Internally prepare and send TDLS management frames. We incorporate local STA capabilities and supported rates with extra IEs given by usermode. The resulting packet is either encapsulated in a data frame, or assembled as an action frame. It is transmitted either directly or through the AP, as mandated by the TDLS specification. Declare support for the TDLS external setup wiphy capability. This tells usermode to handle link setup and discovery on its own, and use the kernel driver for sending TDLS mgmt packets. Signed-off-by: Arik Nemtsov <arik@wizery.com> Cc: Kalyan C Gaddam <chakkal@iit.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 768db34 commit dfe018b

5 files changed

Lines changed: 412 additions & 0 deletions

File tree

‎include/linux/ieee80211.h‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,12 @@ struct ieee80211_mgmt {
759759
u8 action;
760760
u8 smps_control;
761761
} __attribute__ ((packed)) ht_smps;
762+
struct {
763+
u8 action_code;
764+
u8 dialog_token;
765+
__le16 capability;
766+
u8 variable[0];
767+
} __packed tdls_discover_resp;
762768
} u;
763769
} __attribute__ ((packed)) action;
764770
} u;
@@ -805,6 +811,52 @@ struct ieee80211_pspoll {
805811
u8 ta[6];
806812
} __attribute__ ((packed));
807813

814+
/* TDLS */
815+
816+
/* Link-id information element */
817+
struct ieee80211_tdls_lnkie {
818+
u8 ie_type; /* Link Identifier IE */
819+
u8 ie_len;
820+
u8 bssid[6];
821+
u8 init_sta[6];
822+
u8 resp_sta[6];
823+
} __packed;
824+
825+
struct ieee80211_tdls_data {
826+
u8 da[6];
827+
u8 sa[6];
828+
__be16 ether_type;
829+
u8 payload_type;
830+
u8 category;
831+
u8 action_code;
832+
union {
833+
struct {
834+
u8 dialog_token;
835+
__le16 capability;
836+
u8 variable[0];
837+
} __packed setup_req;
838+
struct {
839+
__le16 status_code;
840+
u8 dialog_token;
841+
__le16 capability;
842+
u8 variable[0];
843+
} __packed setup_resp;
844+
struct {
845+
__le16 status_code;
846+
u8 dialog_token;
847+
u8 variable[0];
848+
} __packed setup_cfm;
849+
struct {
850+
__le16 reason_code;
851+
u8 variable[0];
852+
} __packed teardown;
853+
struct {
854+
u8 dialog_token;
855+
u8 variable[0];
856+
} __packed discover_req;
857+
} u;
858+
} __packed;
859+
808860
/**
809861
* struct ieee80211_bar - HT Block Ack Request
810862
*
@@ -1196,6 +1248,8 @@ enum ieee80211_eid {
11961248
WLAN_EID_TS_DELAY = 43,
11971249
WLAN_EID_TCLAS_PROCESSING = 44,
11981250
WLAN_EID_QOS_CAPA = 46,
1251+
/* 802.11z */
1252+
WLAN_EID_LINK_ID = 101,
11991253
/* 802.11s */
12001254
WLAN_EID_MESH_CONFIG = 113,
12011255
WLAN_EID_MESH_ID = 114,
@@ -1279,6 +1333,7 @@ enum ieee80211_category {
12791333
WLAN_CATEGORY_HT = 7,
12801334
WLAN_CATEGORY_SA_QUERY = 8,
12811335
WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1336+
WLAN_CATEGORY_TDLS = 12,
12821337
WLAN_CATEGORY_MESH_ACTION = 13,
12831338
WLAN_CATEGORY_MULTIHOP_ACTION = 14,
12841339
WLAN_CATEGORY_SELF_PROTECTED = 15,
@@ -1342,6 +1397,36 @@ enum ieee80211_key_len {
13421397
WLAN_KEY_LEN_AES_CMAC = 16,
13431398
};
13441399

1400+
/* Public action codes */
1401+
enum ieee80211_pub_actioncode {
1402+
WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14,
1403+
};
1404+
1405+
/* TDLS action codes */
1406+
enum ieee80211_tdls_actioncode {
1407+
WLAN_TDLS_SETUP_REQUEST = 0,
1408+
WLAN_TDLS_SETUP_RESPONSE = 1,
1409+
WLAN_TDLS_SETUP_CONFIRM = 2,
1410+
WLAN_TDLS_TEARDOWN = 3,
1411+
WLAN_TDLS_PEER_TRAFFIC_INDICATION = 4,
1412+
WLAN_TDLS_CHANNEL_SWITCH_REQUEST = 5,
1413+
WLAN_TDLS_CHANNEL_SWITCH_RESPONSE = 6,
1414+
WLAN_TDLS_PEER_PSM_REQUEST = 7,
1415+
WLAN_TDLS_PEER_PSM_RESPONSE = 8,
1416+
WLAN_TDLS_PEER_TRAFFIC_RESPONSE = 9,
1417+
WLAN_TDLS_DISCOVERY_REQUEST = 10,
1418+
};
1419+
1420+
/*
1421+
* TDLS capabililites to be enabled in the 5th byte of the
1422+
* @WLAN_EID_EXT_CAPABILITY information element
1423+
*/
1424+
#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5)
1425+
#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6)
1426+
1427+
/* TDLS specific payload type in the LLC/SNAP header */
1428+
#define WLAN_TDLS_SNAP_RFTYPE 0x2
1429+
13451430
/**
13461431
* enum - mesh path selection protocol identifier
13471432
*

‎include/linux/if_ether.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
8484
#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
8585
#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
86+
#define ETH_P_TDLS 0x890D /* TDLS */
8687
#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
8788
#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
8889
#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */

‎net/mac80211/Kconfig‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,18 @@ config MAC80211_VERBOSE_MHWMP_DEBUG
225225

226226
Do not select this option.
227227

228+
config MAC80211_VERBOSE_TDLS_DEBUG
229+
bool "Verbose TDLS debugging"
230+
depends on MAC80211_DEBUG_MENU
231+
---help---
232+
Selecting this option causes mac80211 to print out very
233+
verbose TDLS selection debugging messages (when mac80211
234+
is a TDLS STA).
235+
It should not be selected on production systems as those
236+
messages are remotely triggerable.
237+
238+
Do not select this option.
239+
228240
config MAC80211_DEBUG_COUNTERS
229241
bool "Extra statistics for TX/RX debugging"
230242
depends on MAC80211_DEBUG_MENU

0 commit comments

Comments
 (0)