nl80211: Map internal TDLS_PEER_* to NL80211_TDLS_PEER_*
Even though these enum definitions are currently identical, it is better to explicitly map these bits to the kernel interface instead of using the internal definition for this. This makes it much clearer that new enum tdls_peer_capability value needs to be assigned in nl80211 before they can be added into wpa_supplicant. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
742018f44d
commit
15b1831a2c
1 changed files with 25 additions and 15 deletions
|
@ -9200,6 +9200,28 @@ static int nl80211_start_radar_detection(void *priv,
|
|||
|
||||
#ifdef CONFIG_TDLS
|
||||
|
||||
static int nl80211_add_peer_capab(struct nl_msg *msg,
|
||||
enum tdls_peer_capability capa)
|
||||
{
|
||||
u32 peer_capab = 0;
|
||||
|
||||
if (!capa)
|
||||
return 0;
|
||||
|
||||
if (capa & TDLS_PEER_HT)
|
||||
peer_capab |= NL80211_TDLS_PEER_HT;
|
||||
if (capa & TDLS_PEER_VHT)
|
||||
peer_capab |= NL80211_TDLS_PEER_VHT;
|
||||
if (capa & TDLS_PEER_WMM)
|
||||
peer_capab |= NL80211_TDLS_PEER_WMM;
|
||||
if (capa & TDLS_PEER_HE)
|
||||
peer_capab |= NL80211_TDLS_PEER_HE;
|
||||
|
||||
return nla_put_u32(msg, NL80211_ATTR_TDLS_PEER_CAPABILITY,
|
||||
peer_capab);
|
||||
}
|
||||
|
||||
|
||||
static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code,
|
||||
u8 dialog_token, u16 status_code,
|
||||
u32 peer_capab, int initiator, const u8 *buf,
|
||||
|
@ -9219,21 +9241,9 @@ static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code,
|
|||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, dst) ||
|
||||
nla_put_u8(msg, NL80211_ATTR_TDLS_ACTION, action_code) ||
|
||||
nla_put_u8(msg, NL80211_ATTR_TDLS_DIALOG_TOKEN, dialog_token) ||
|
||||
nla_put_u16(msg, NL80211_ATTR_STATUS_CODE, status_code))
|
||||
goto fail;
|
||||
if (peer_capab) {
|
||||
/*
|
||||
* The internal enum tdls_peer_capability definition is
|
||||
* currently identical with the nl80211 enum
|
||||
* nl80211_tdls_peer_capability, so no conversion is needed
|
||||
* here.
|
||||
*/
|
||||
if (nla_put_u32(msg, NL80211_ATTR_TDLS_PEER_CAPABILITY,
|
||||
peer_capab))
|
||||
goto fail;
|
||||
}
|
||||
if ((initiator &&
|
||||
nla_put_flag(msg, NL80211_ATTR_TDLS_INITIATOR)) ||
|
||||
nla_put_u16(msg, NL80211_ATTR_STATUS_CODE, status_code) ||
|
||||
nl80211_add_peer_capab(msg, peer_capab) ||
|
||||
(initiator && nla_put_flag(msg, NL80211_ATTR_TDLS_INITIATOR)) ||
|
||||
nla_put(msg, NL80211_ATTR_IE, len, buf))
|
||||
goto fail;
|
||||
|
||||
|
|
Loading…
Reference in a new issue