TDLS: Add initial support for TDLS (IEEE Std 802.11z-2010)
This commit is contained in:
parent
23ab8e863f
commit
281ff0aa76
17 changed files with 2036 additions and 5 deletions
|
@ -101,6 +101,11 @@
|
|||
/* Status codes (IEEE 802.11-2007, 7.3.1.9, Table 7-23) */
|
||||
#define WLAN_STATUS_SUCCESS 0
|
||||
#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
|
||||
#define WLAN_STATUS_TDLS_WAKEUP_ALTERNATE 2
|
||||
#define WLAN_STATUS_TDLS_WAKEUP_REJECT 3
|
||||
#define WLAN_STATUS_SECURITY_DISABLED 5
|
||||
#define WLAN_STATUS_UNACCEPTABLE_LIFETIME 6
|
||||
#define WLAN_STATUS_NOT_IN_SAME_BSS 7
|
||||
#define WLAN_STATUS_CAPS_UNSUPPORTED 10
|
||||
#define WLAN_STATUS_REASSOC_NO_ASSOC 11
|
||||
#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
|
||||
|
@ -148,6 +153,7 @@
|
|||
#define WLAN_STATUS_INVALID_PMKID 53
|
||||
#define WLAN_STATUS_INVALID_MDIE 54
|
||||
#define WLAN_STATUS_INVALID_FTIE 55
|
||||
#define WLAN_STATUS_INVALID_RSNIE 72
|
||||
|
||||
/* Reason codes (IEEE 802.11-2007, 7.3.1.7, Table 7-22) */
|
||||
#define WLAN_REASON_UNSPECIFIED 1
|
||||
|
@ -175,6 +181,8 @@
|
|||
#define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
|
||||
#define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
|
||||
#define WLAN_REASON_CIPHER_SUITE_REJECTED 24
|
||||
#define WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE 25
|
||||
#define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26
|
||||
/* IEEE 802.11e */
|
||||
#define WLAN_REASON_DISASSOC_LOW_ACK 34
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#endif /* CONFIG_IEEE80211R */
|
||||
#define RSN_AUTH_KEY_MGMT_802_1X_SHA256 RSN_SELECTOR(0x00, 0x0f, 0xac, 5)
|
||||
#define RSN_AUTH_KEY_MGMT_PSK_SHA256 RSN_SELECTOR(0x00, 0x0f, 0xac, 6)
|
||||
#define RSN_AUTH_KEY_MGMT_TPK_HANDSHAKE RSN_SELECTOR(0x00, 0x0f, 0xac, 7)
|
||||
|
||||
#define RSN_CIPHER_SUITE_NONE RSN_SELECTOR(0x00, 0x0f, 0xac, 0)
|
||||
#define RSN_CIPHER_SUITE_WEP40 RSN_SELECTOR(0x00, 0x0f, 0xac, 1)
|
||||
|
@ -68,6 +69,7 @@
|
|||
#ifdef CONFIG_IEEE80211W
|
||||
#define RSN_CIPHER_SUITE_AES_128_CMAC RSN_SELECTOR(0x00, 0x0f, 0xac, 6)
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
#define RSN_CIPHER_SUITE_NO_GROUP_ADDRESSED RSN_SELECTOR(0x00, 0x0f, 0xac, 7)
|
||||
|
||||
/* EAPOL-Key Key Data Encapsulation
|
||||
* GroupKey and PeerKey require encryption, otherwise, encryption is optional.
|
||||
|
|
|
@ -694,6 +694,14 @@ struct p2p_params {
|
|||
size_t num_sec_dev_types;
|
||||
};
|
||||
|
||||
enum tdls_oper {
|
||||
TDLS_DISCOVERY_REQ,
|
||||
TDLS_SETUP,
|
||||
TDLS_TEARDOWN,
|
||||
TDLS_ENABLE_LINK,
|
||||
TDLS_DISABLE_LINK
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wpa_driver_ops - Driver interface API definition
|
||||
*
|
||||
|
@ -2187,6 +2195,26 @@ struct wpa_driver_ops {
|
|||
int (*p2p_invite)(void *priv, const u8 *peer, int role,
|
||||
const u8 *bssid, const u8 *ssid, size_t ssid_len,
|
||||
const u8 *go_dev_addr, int persistent_group);
|
||||
|
||||
/**
|
||||
* send_tdls_mgmt - for sending TDLS management packets
|
||||
* @priv: private driver interface data
|
||||
* @dst: Destination (peer) MAC address
|
||||
* @action_code: TDLS action code for the mssage
|
||||
* @dialog_token: Dialog Token to use in the message (if needed)
|
||||
* @status_code: Status Code or Reason Code to use (if needed)
|
||||
* @buf: TDLS IEs to add to the message
|
||||
* @len: Length of buf in octets
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* This optional function can be used to send packet to driver which is
|
||||
* responsible for receiving and sending all TDLS packets.
|
||||
*/
|
||||
int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
|
||||
u8 dialog_token, u16 status_code,
|
||||
const u8 *buf, size_t len);
|
||||
|
||||
int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
|
||||
};
|
||||
|
||||
|
||||
|
@ -2308,6 +2336,13 @@ enum wpa_event_type {
|
|||
*/
|
||||
EVENT_STKSTART,
|
||||
|
||||
/**
|
||||
* EVENT_TDLS - Request TDLS operation
|
||||
*
|
||||
* This event can be used to request a TDLS operation to be performed.
|
||||
*/
|
||||
EVENT_TDLS,
|
||||
|
||||
/**
|
||||
* EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
|
||||
*
|
||||
|
@ -2757,6 +2792,18 @@ union wpa_event_data {
|
|||
u8 peer[ETH_ALEN];
|
||||
} stkstart;
|
||||
|
||||
/**
|
||||
* struct tdls - Data for EVENT_TDLS
|
||||
*/
|
||||
struct tdls {
|
||||
u8 peer[ETH_ALEN];
|
||||
enum {
|
||||
TDLS_REQUEST_SETUP,
|
||||
TDLS_REQUEST_TEARDOWN
|
||||
} oper;
|
||||
u16 reason_code; /* for teardown */
|
||||
} tdls;
|
||||
|
||||
/**
|
||||
* struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
|
||||
*
|
||||
|
|
|
@ -3324,5 +3324,7 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
|
|||
NULL /* p2p_sd_response */,
|
||||
NULL /* p2p_service_update */,
|
||||
NULL /* p2p_reject */,
|
||||
NULL /* p2p_invite */
|
||||
NULL /* p2p_invite */,
|
||||
NULL /* send_tdls_mgmt */,
|
||||
NULL /* tdls_oper */
|
||||
};
|
||||
|
|
1700
src/rsn_supp/tdls.c
Normal file
1700
src/rsn_supp/tdls.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -55,6 +55,12 @@ struct wpa_sm_ctx {
|
|||
int (*send_ft_action)(void *ctx, u8 action, const u8 *target_ap,
|
||||
const u8 *ies, size_t ies_len);
|
||||
int (*mark_authenticated)(void *ctx, const u8 *target_ap);
|
||||
#ifdef CONFIG_TDLS
|
||||
int (*send_tdls_mgmt)(void *ctx, const u8 *dst,
|
||||
u8 action_code, u8 dialog_token,
|
||||
u16 status_code, const u8 *buf, size_t len);
|
||||
int (*tdls_oper)(void *ctx, int oper, const u8 *peer);
|
||||
#endif /* CONFIG_TDLS */
|
||||
};
|
||||
|
||||
|
||||
|
@ -330,4 +336,12 @@ wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
|
|||
|
||||
#endif /* CONFIG_IEEE80211R */
|
||||
|
||||
|
||||
/* tdls.c */
|
||||
int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr);
|
||||
int wpa_tdls_recv_teardown_notify(struct wpa_sm *sm, const u8 *addr,
|
||||
u16 reason_code);
|
||||
int wpa_tdls_init(struct wpa_sm *sm);
|
||||
void wpa_tdls_deinit(struct wpa_sm *sm);
|
||||
|
||||
#endif /* WPA_H */
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "utils/list.h"
|
||||
|
||||
struct wpa_peerkey;
|
||||
struct wpa_tdls_peer;
|
||||
struct wpa_eapol_key;
|
||||
|
||||
/**
|
||||
|
@ -43,6 +44,7 @@ struct wpa_sm {
|
|||
|
||||
struct l2_packet_data *l2_preauth;
|
||||
struct l2_packet_data *l2_preauth_br;
|
||||
struct l2_packet_data *l2_tdls;
|
||||
u8 preauth_bssid[ETH_ALEN]; /* current RSN pre-auth peer or
|
||||
* 00:00:00:00:00:00 if no pre-auth is
|
||||
* in progress */
|
||||
|
@ -92,6 +94,9 @@ struct wpa_sm {
|
|||
#ifdef CONFIG_PEERKEY
|
||||
struct wpa_peerkey *peerkey;
|
||||
#endif /* CONFIG_PEERKEY */
|
||||
#ifdef CONFIG_TDLS
|
||||
struct wpa_tdls_peer *tdls;
|
||||
#endif /* CONFIG_TDLS */
|
||||
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
u8 xxkey[PMK_LEN]; /* PSK or the second 256 bits of MSK */
|
||||
|
@ -237,6 +242,27 @@ static inline int wpa_sm_mark_authenticated(struct wpa_sm *sm,
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TDLS
|
||||
static inline int wpa_sm_send_tdls_mgmt(struct wpa_sm *sm, const u8 *dst,
|
||||
u8 action_code, u8 dialog_token,
|
||||
u16 status_code, const u8 *buf,
|
||||
size_t len)
|
||||
{
|
||||
if (sm->ctx->send_tdls_mgmt)
|
||||
return sm->ctx->send_tdls_mgmt(sm->ctx->ctx, dst, action_code,
|
||||
dialog_token, status_code,
|
||||
buf, len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int wpa_sm_tdls_oper(struct wpa_sm *sm, int oper,
|
||||
const u8 *peer)
|
||||
{
|
||||
if (sm->ctx->tdls_oper)
|
||||
return sm->ctx->tdls_oper(sm->ctx->ctx, oper, peer);
|
||||
return -1;
|
||||
}
|
||||
#endif /* CONFIG_TDLS */
|
||||
|
||||
void wpa_eapol_key_send(struct wpa_sm *sm, const u8 *kck,
|
||||
int ver, const u8 *dest, u16 proto,
|
||||
|
|
|
@ -397,7 +397,6 @@ int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
|
|||
ie->rsn_ie_len = pos[1] + 2;
|
||||
wpa_hexdump(MSG_DEBUG, "WPA: RSN IE in EAPOL-Key",
|
||||
ie->rsn_ie, ie->rsn_ie_len);
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
} else if (*pos == WLAN_EID_MOBILITY_DOMAIN) {
|
||||
ie->mdie = pos;
|
||||
ie->mdie_len = pos[1] + 2;
|
||||
|
@ -424,7 +423,9 @@ int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
|
|||
"EAPOL-Key Key Data IE",
|
||||
pos, 2 + pos[1]);
|
||||
}
|
||||
#endif /* CONFIG_IEEE80211R */
|
||||
} else if (*pos == WLAN_EID_LINK_ID) {
|
||||
ie->lnkid = pos;
|
||||
ie->lnkid_len = pos[1] + 2;
|
||||
} else if (*pos == WLAN_EID_VENDOR_SPECIFIC) {
|
||||
ret = wpa_parse_generic(pos, end, ie);
|
||||
if (ret < 0)
|
||||
|
|
|
@ -41,14 +41,14 @@ struct wpa_eapol_ie_parse {
|
|||
const u8 *igtk;
|
||||
size_t igtk_len;
|
||||
#endif /* CONFIG_IEEE80211W */
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
const u8 *mdie;
|
||||
size_t mdie_len;
|
||||
const u8 *ftie;
|
||||
size_t ftie_len;
|
||||
const u8 *reassoc_deadline;
|
||||
const u8 *key_lifetime;
|
||||
#endif /* CONFIG_IEEE80211R */
|
||||
const u8 *lnkid;
|
||||
size_t lnkid_len;
|
||||
};
|
||||
|
||||
int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
|
||||
|
|
|
@ -320,6 +320,9 @@ static inline unsigned int wpa_swap_32(unsigned int v)
|
|||
#ifndef ETH_P_ALL
|
||||
#define ETH_P_ALL 0x0003
|
||||
#endif
|
||||
#ifndef ETH_P_80211_ENCAP
|
||||
#define ETH_P_80211_ENCAP 0x890d /* TDLS comes under this category */
|
||||
#endif
|
||||
#ifndef ETH_P_PAE
|
||||
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
|
||||
#endif /* ETH_P_PAE */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue