]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Fix TDLS key configuration to not set TX key index
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 31 Jul 2013 15:34:16 +0000 (18:34 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 31 Jul 2013 15:34:16 +0000 (18:34 +0300)
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>

src/drivers/driver_nl80211.c

index 83d4a236bb1000bf17942483b23b6c499cba13dd..e674d9d9ed9cc7a6b82c607167c6e75711d15adf 100644 (file)
@@ -4869,6 +4869,7 @@ static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss,
        int ifindex;
        struct nl_msg *msg;
        int ret;
+       int tdls = 0;
 
        /* Ignore for 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,
                   (unsigned long) seq_len, (unsigned long) key_len);
 #ifdef CONFIG_TDLS
-       if (key_idx == -1)
+       if (key_idx == -1) {
                key_idx = 0;
+               tdls = 1;
+       }
 #endif /* CONFIG_TDLS */
 
        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),
         * we're done here.
         */
-       if (ret || !set_tx || alg == WPA_ALG_NONE)
+       if (ret || !set_tx || alg == WPA_ALG_NONE || tdls)
                return ret;
        if (is_ap_interface(drv->nlmode) && addr &&
            !is_broadcast_ether_addr(addr))