Skip to content

Cannot connect to WEP network with WiFi.enableInsecureWEP() #5359

Closed
@aaron-neal

Description

@aaron-neal

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: Wroom02
  • Core Version: 74ca42f
  • Development Env: Platformio
  • Operating System: Windows

Settings in IDE

  • Module: Generic ESP8266 Module
  • Flash Size: 2MB
  • lwip Variant: v2 Lower Memory
  • Reset Method: nodemcu
  • CPU Frequency: 160MHz

Problem Description

An existing working setup has stopped being able to connect to a WEP network. If i change AP settings to WPA2 everything works as expected. This has been since upgrading the git core, unfortunately I cannot pinpoint the exact previous working git version.

I have tried before WiFi begin:
WiFi.enableInsecureWEP(true);
WiFi.enableInsecureWEP();

WiFi error is 1 - Unreachable WiFi Network

All other device connect and work perfectly fine with the access point and the same credentials.

Here is a wifiscan output from the ESP, I have obscured the SSIDs, SSIDWPA2 is WPA2 encrytption and SSID WEP - WEP.

"SSID" : SSIDWEP,
"RSSI" : -30,
"encryption" : 5,
"BSSID" : 46:D9:E7:F3:35:B8,
"channel" : 6,
"isHidden" : false

"SSID" : SSIDWPA2,
"RSSI" : -30,
"encryption" : 4,
"BSSID" : 44:D9:E7:F3:35:B8,
"channel" : 6,
"isHidden" : false

MCVE Sketch

I will create an MVCE if required, but my setup routine looks like this:

 void wifiSetup(){
    WiFi.hostname(config.deviceID);
    WiFi.enableInsecureWEP(); 
    WiFi.mode(WIFI_AP_STA);

    if(config.wifiSettings.fixedSettings){
        Serial.println(F("Applying fixed wifi settings"));
        IPAddress staticIP, gateway, subnet, dns1, dns2;
        if(staticIP.fromString(config.wifiSettings.ip)){
            if(gateway.fromString(config.wifiSettings.gateway)){
                if(subnet.fromString(config.wifiSettings.mask)){
                    if(dns1.fromString(config.wifiSettings.dns1)){
                        if(dns1.fromString(config.wifiSettings.dns2)){
                            WiFi.config(staticIP, gateway, subnet, dns1, dns2);
                        } else {
                            Serial.println(F("Failed DNS2 Address conversion"));
                            WiFi.config(staticIP, gateway, subnet, dns1);
                        }
                    }else{
                        Serial.println(F("Failed DNS1 Address conversion"));
                        WiFi.config(staticIP, gateway, subnet);
                    }        
                } else Serial.println(F("Failed Net Mask conversion"));  
            } else Serial.println(F("Failed Gateway Address conversion"));
        } else Serial.println(F("Failed IP Address conversion"));
    }
    WiFi.softAP(config.apSSID, config.apPassword);    
    if(strlen(config.wifiSettings.ssid) != 0){
        Serial.println(F("Begin WiFi"));
        Serial.print(F("Connecting to "));
        Serial.println(config.wifiSettings.ssid);
        WiFi.begin(config.wifiSettings.ssid, config.wifiSettings.password);
    }
}

Debug Messages

mode : sta(84:f3:eb:46:dd:c3) + softAP(86:f3:eb:46:dd:c3)
add if0
Begin WiFi
Connecting to SSIDWEP
scandone
no SSIDWEP found, reconnect after 1s
reconnect
scandone
no SSIDWEP found, reconnect after 1s
reconnect
scandone
no SSIDWEP found, reconnect after 1s
reconnect
scandone
no SSIDWEP found, reconnect after 1s
reconnect
scandone
no SSIDWEP found, reconnect after 1s
reconnect
scandone
no SSIDWEP found, reconnect after 1s
reconnect
WiFi Failure - 1
Unreachable WiFi Network
scandone
del if0
mode : softAP(86:f3:eb:46:dd:c3)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions