]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_supplicant AP: Set static WEP keys if configured
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 15 Sep 2011 12:04:46 +0000 (15:04 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 15 Sep 2011 12:04:46 +0000 (15:04 +0300)
This is needed to configure static WEP keys to the driver through the
hostapd configuration structures.

wpa_supplicant/ap.c

index dd44523f2b0f1d79aa5deb7f83f231c4a143c734..ebac3b64926db68baec3d3eb5a97b8572323bdbc 100644 (file)
@@ -160,6 +160,22 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
                        return -1;
                os_memcpy(bss->ssid.wpa_psk->psk, ssid->psk, PMK_LEN);
                bss->ssid.wpa_psk->group = 1;
+       } else if (ssid->wep_key_len[0] || ssid->wep_key_len[1] ||
+                  ssid->wep_key_len[2] || ssid->wep_key_len[3]) {
+               struct hostapd_wep_keys *wep = &bss->ssid.wep;
+               int i;
+               for (i = 0; i < NUM_WEP_KEYS; i++) {
+                       if (ssid->wep_key_len[i] == 0)
+                               continue;
+                       wep->key[i] = os_malloc(ssid->wep_key_len[i]);
+                       if (wep->key[i] == NULL)
+                               return -1;
+                       os_memcpy(wep->key[i], ssid->wep_key[i],
+                                 ssid->wep_key_len[i]);
+                       wep->len[i] = ssid->wep_key_len[i];
+               }
+               wep->idx = ssid->wep_tx_keyidx;
+               wep->keys_set = 1;
        }
 
        /* Select group cipher based on the enabled pairwise cipher suites */