mac80211: add parsing of TDLS specific IEs
authorArik Nemtsov <arik@wizery.com>
Sun, 9 Nov 2014 16:50:18 +0000 (18:50 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 19 Nov 2014 17:45:16 +0000 (18:45 +0100)
These are used in TDLS channel switching code.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/linux/ieee80211.h
net/mac80211/ieee80211_i.h
net/mac80211/util.c

index fbb02d240658c3da56af9dd1ad8362949af71cc1..4f4eea8a62882914a86c11a084928a02225c6e0b 100644 (file)
@@ -1067,6 +1067,12 @@ struct ieee80211_pspoll {
 
 /* TDLS */
 
+/* Channel switch timing */
+struct ieee80211_ch_switch_timing {
+       __le16 switch_time;
+       __le16 switch_timeout;
+} __packed;
+
 /* Link-id information element */
 struct ieee80211_tdls_lnkie {
        u8 ie_type; /* Link Identifier IE */
@@ -1108,6 +1114,15 @@ struct ieee80211_tdls_data {
                        u8 dialog_token;
                        u8 variable[0];
                } __packed discover_req;
+               struct {
+                       u8 target_channel;
+                       u8 oper_class;
+                       u8 variable[0];
+               } __packed chan_switch_req;
+               struct {
+                       __le16 status_code;
+                       u8 variable[0];
+               } __packed chan_switch_resp;
        } u;
 } __packed;
 
index 4b3a7e7ec2a0c080c0f2b6cff2743e20a2f487f2..e786ab6bc72cfd981683cc616ef61ebab71f469f 100644 (file)
@@ -1400,6 +1400,8 @@ struct ieee802_11_elems {
        size_t total_len;
 
        /* pointers to IEs */
+       const struct ieee80211_tdls_lnkie *lnk_id;
+       const struct ieee80211_ch_switch_timing *ch_sw_timing;
        const u8 *ext_capab;
        const u8 *ssid;
        const u8 *supp_rates;
index 3ca0c2e725ff4998d3ae0330adde21578b2e4d19..9e5bfd6148562cb9565be877851e83781b4ddf37 100644 (file)
@@ -832,6 +832,8 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
                case WLAN_EID_WIDE_BW_CHANNEL_SWITCH:
                case WLAN_EID_CHAN_SWITCH_PARAM:
                case WLAN_EID_EXT_CAPABILITY:
+               case WLAN_EID_CHAN_SWITCH_TIMING:
+               case WLAN_EID_LINK_ID:
                /*
                 * not listing WLAN_EID_CHANNEL_SWITCH_WRAPPER -- it seems possible
                 * that if the content gets bigger it might be needed more than once
@@ -851,6 +853,20 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
                elem_parse_failed = false;
 
                switch (id) {
+               case WLAN_EID_LINK_ID:
+                       if (elen + 2 != sizeof(struct ieee80211_tdls_lnkie)) {
+                               elem_parse_failed = true;
+                               break;
+                       }
+                       elems->lnk_id = (void *)(pos - 2);
+                       break;
+               case WLAN_EID_CHAN_SWITCH_TIMING:
+                       if (elen != sizeof(struct ieee80211_ch_switch_timing)) {
+                               elem_parse_failed = true;
+                               break;
+                       }
+                       elems->ch_sw_timing = (void *)pos;
+                       break;
                case WLAN_EID_EXT_CAPABILITY:
                        elems->ext_capab = pos;
                        elems->ext_capab_len = elen;