nl80211: Fix TDLS key configuration to not set TX key index

The nl80211 command for setting the TX index does not distinguish TDLS
vs. AP key and as such, the driver would not know what this set TX key
index operation is doing in the TDLS case. This could result in the TX
key index for AP being changed instead if static WEP is used in the AP
connection. Fix the issue by not setting TX key index when configuring a
TDLS key.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-07-31 18:34:16 +03:00 committed by Jouni Malinen
parent 9d86f37f78
commit dc01de8a0e

View file

@ -4869,6 +4869,7 @@ static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss,
int ifindex; int ifindex;
struct nl_msg *msg; struct nl_msg *msg;
int ret; int ret;
int tdls = 0;
/* Ignore for P2P Device */ /* Ignore for P2P Device */
if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
@ -4880,8 +4881,10 @@ static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss,
__func__, ifindex, ifname, alg, addr, key_idx, set_tx, __func__, ifindex, ifname, alg, addr, key_idx, set_tx,
(unsigned long) seq_len, (unsigned long) key_len); (unsigned long) seq_len, (unsigned long) key_len);
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
if (key_idx == -1) if (key_idx == -1) {
key_idx = 0; key_idx = 0;
tdls = 1;
}
#endif /* CONFIG_TDLS */ #endif /* CONFIG_TDLS */
msg = nlmsg_alloc(); msg = nlmsg_alloc();
@ -4971,7 +4974,7 @@ static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss,
* If we failed or don't need to set the default TX key (below), * If we failed or don't need to set the default TX key (below),
* we're done here. * we're done here.
*/ */
if (ret || !set_tx || alg == WPA_ALG_NONE) if (ret || !set_tx || alg == WPA_ALG_NONE || tdls)
return ret; return ret;
if (is_ap_interface(drv->nlmode) && addr && if (is_ap_interface(drv->nlmode) && addr &&
!is_broadcast_ether_addr(addr)) !is_broadcast_ether_addr(addr))