+
+ if (val = 0) {
+ if (nvram_match(wl_var("plcphdr"), "long"))
+ val = WLC_PLCP_AUTO;
+ else
+ val = WLC_PLCP_SHORT;
+
+ bcom_ioctl(skfd, ifname, WLC_SET_PLCPHDR, &val, sizeof(val));
+ }
+ }
+
+ start_bcom(skfd, ifname);
+
+ if (!(v = nvram_get(wl_var("akm"))))
+ v = nvram_safe_get(wl_var("auth_mode"));
+
+ if (strstr(v, "wpa") || strstr(v, "psk")) {
+ /* Set up WPA */
+ if (nvram_match(wl_var("crypto"), "tkip"))
+ val = TKIP_ENABLED;
+ else if (nvram_match(wl_var("crypto"), "aes"))
+ val = AES_ENABLED;
+ else if (nvram_match(wl_var("crypto"), "tkip+aes"))
+ val = TKIP_ENABLED | AES_ENABLED;
+ else
+ val = 0;
+ bcom_ioctl(skfd, ifname, WLC_SET_WSEC, &val, sizeof(val));
+
+ if (val && strstr(v, "psk")) {
+ v = nvram_safe_get(wl_var("wpa_psk"));
+
+ if ((strlen(v) >= 8) && (strlen(v) < 63)) {
+ val = 4;
+ bcom_ioctl(skfd, ifname, WLC_SET_WPA_AUTH, &val, sizeof(val));
+
+ bcom_ioctl(skfd, ifname, WLC_GET_AP, &val, sizeof(val));
+ if (!val) {
+ /* Enable in-driver WPA supplicant */
+ wsec_pmk_t pmk;
+
+ pmk.key_len = (unsigned short) strlen(v);
+ pmk.flags = WSEC_PASSPHRASE;
+ strcpy(pmk.key, v);
+ bcom_ioctl(skfd, ifname, WLC_SET_WSEC_PMK, &pmk, sizeof(pmk));
+ bcom_set_int(skfd, ifname, "sup_wpa", 1);
+ }
+ }
+ } else {
+ val = 1;
+ bcom_ioctl(skfd, ifname, WLC_SET_EAP_RESTRICT, &val, sizeof(val));
+ }
+ } else {
+ val = 0;
+
+ bcom_ioctl(skfd, ifname, WLC_SET_WSEC, &val, sizeof(val));
+ bcom_ioctl(skfd, ifname, WLC_SET_WPA_AUTH, &val, sizeof(val));