Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS lookups fail if config portal was up. #688

Open
liebman opened this issue Aug 6, 2018 · 18 comments
Open

DNS lookups fail if config portal was up. #688

liebman opened this issue Aug 6, 2018 · 18 comments
Labels
Needs Feeback Developer needs feedback

Comments

@liebman
Copy link
Contributor

liebman commented Aug 6, 2018

Basic Infos

Development branch (current development branch git)

Hardware

WiFimanager Branch/Release: Development

Esp8266/Esp32: esp8266

Hardware: ESP-12e

Core Version: current master from git

Description

DNS name resolution fails if config portal was up. When autoconnect without portal DNS name resolution works fine.

Settings in IDE

Module: NodeMcu

Additional libraries: None

Sketch

#include <Arduino.h>
#include <WiFiManager.h>

const uint8_t PIN_TRGR = 14;
const char* AP_NAME = "DNSFail";
const char* server_name = "0.zoddotcom.pool.ntp.org";

void setup() {
    Serial.begin(76800);

    WiFiManager wm;
    
    if (digitalRead(PIN_TRGR) == 0)
    {
        wm.startConfigPortal(AP_NAME, NULL);
    }
    else
    {
        wm.autoConnect(AP_NAME);
    }
    

    Serial.println("connected...yeey :)");
}

void loop() {
    Serial.printf("lookup '%s' ... ", server_name);
    IPAddress address;
    if (!WiFi.hostByName(server_name, address))
    {
        Serial.println("FAILED!");
    }
    else
    {
        Serial.printf("%d.%d.%d.%d\n", address[0], address[1], address[2], address[3]);
    }

    delay(1000);
}

Debug Messages

Reset with pin 14 LOW - force config portal - DNS lookups fail.

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v00000000
~ld

SDK:2.2.1(cfd48f3)/Core:unspecified/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-13-g163bb82)/BearSSL:6d1cefc
*WM: [3] WIFI station disconnect 
scandone
*WM: [3] WiFi station enable 
del if0
mode : softAP(6a:c6:3a:ac:8b:4e)
*WM: [2] Disabling STA 
*WM: [2] Enabling AP 
*WM: [1] StartAP with SSID:  DNSFail
wifi evt: 8
*WM: [2] AP has anonymous access! 
bcn 0
del if1
usl
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
wifi evt: 7
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal 
*WM: [1] Starting Web Portal 
*WM: [3] dns server started with ip:  192.168.4.1
*WM: [2] HTTP server started 
mode : sta(68:c6:3a:ac:8b:4e) + softAP(6a:c6:3a:ac:8b:4e)
add if0
wifi evt: 8
wifi evt: 7
wifi evt: 7
scandone
*WM: [2] WiFi Scan done in 2198ms
*WM: [2] Config Portal Running, blocking, waiting for clients... 
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
add 1
aid 1
station: f0:98:9d:56:8e:81 join, AID = 1
wifi evt: 5
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 9
wifi evt: 7
wifi evt: 9
wifi evt: 7
wifi evt: 7
wifi evt: 9
wifi evt: 7
wifi evt: 7
*WM: [3] -> captive.apple.com 
*WM: [2] <- Request redirected to captive portal 
wifi evt: 7
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 17203ago
*WM: [3] -> captive.apple.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 17855ago
*WM: [3] -> captive.apple.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 18032ago
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
*WM: [2] <- HTTP Wifi 
*WM: [2] Scan is cached 20564ago
*WM: [1] 14 networks found
*WM: [2] DUP AP: ThicketLand
*WM: [2] AP:  -51 ThicketLand
*WM: [2] AP:  -65 DIRECT-7C-HP ENVY 5660 series
*WM: [2] AP:  -66 DIRECT-0WM2070 Series
*WM: [2] AP:  -69 Bob's Network
*WM: [2] AP:  -69 Bob's Guest Network
*WM: [2] AP:  -70 TC8717T24
*WM: [2] AP:  -74 T3WQBGGB
*WM: [2] AP:  -77 I'm Awesome
*WM: [2] AP:  -78 FBI Surveillance Van 
*WM: [2] AP:  -84 belkin.5f39
*WM: [2] AP:  -85 FWYTJ
*WM: [2] AP:  -92 Ladylike
*WM: [2] AP:  -93 MySpectrumWiFi38-2G
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [3] Sent config page 
*WM: [3] -> captive.apple.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresult: WL_IDLE_STATUS
scandone
*WM: [2] WiFi Scan done in 2195ms
*WM: [2] <- HTTP WiFi save  
*WM: [3] Method: POST
wifi evt: 7
*WM: [3] Sent wifi save page 
*WM: [2] process connect 
wifi evt: 7
wifi evt: 7
wifi evt: 7
*WM: [2] Connecting as wifi client... 
*WM: [3] WIFI station disconnect 
*WM: [1] Connecting to saved AP: ThicketLand
*WM: [3] WiFi station enable 
*WM: [3] enableSTA PERSISTENT ON 
*WM: [1] connectTimeout not set, ESP waitForConnectResult... 
wifi evt: 8
wifi evt: 2
wifi evt: 7
scandone
switch to channel 11
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 8
cnt 

connected with ThicketLand, channel 11
dhcp client start...
wifi evt: 0
ip:192.168.0.30,mask:255.255.255.0,gw:192.168.0.1
wifi evt: 3
*WM: [2] Connection result: WL_CONNECTED
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [1] Connect to new AP [SUCCESS] 
*WM: [1] Got IP Address: 
*WM: [1] 192.168.0.30 
*WM: [2] disconnect configportal 
station: f0:98:9d:56:8e:81 leave, AID = 1
rm wifi evt: 6
1
bcn 0
del if1
pm open,type:2 0
add if1
pm close 7
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
*WM: [1] config portal exiting 
connected...yeey :)
*WM: [3] unloading 
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
ERROR: send_offer (error -13)
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
ERROR: dhcps send nak (error -13)
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
wifi evt: 7
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7

Reset with pin 14 HIGH - use auto connect, DNS works.

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v00000000
~ld

SDK:2.2.1(cfd48f3)/Core:unspecified/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-13-g163bb82)/BearSSL:6d1cefc
*WM: [1] AutoConnect 
*WM: [2] Connecting as wifi client... 
*WM: [3] WIFI station disconnect 
swifi evt: 2
candone
*WM: [1] Connecting to saved AP: ThicketLand
*WM: [3] WiFi station enable 
*WM: [3] enableSTA PERSISTENT ON 
*WM: [1] connectTimeout not set, ESP waitForConnectResult... 
wifi evt: 8
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 8
cnt 

connected with ThicketLand, channel 11
dhcp client start...
wifi evt: 0
ip:192.168.0.30,mask:255.255.255.0,gw:192.168.0.1
wifi evt: 3
*WM: [2] Connection result: WL_CONNECTED
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [1] AutoConnect: SUCCESS 
*WM: [1] STA IP Address: 192.168.0.30
connected...yeey :)
*WM: [3] unloading 
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
wifi evt: 7
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 173.255.215.209
173.255.215.209

@tablatronix
Copy link
Collaborator

Cannot reproduce

SDK Version
2.2.1(cfd48f3)
Core Version
2_4_1

@tablatronix tablatronix added the Needs Feeback Developer needs feedback label Aug 6, 2018
@tablatronix
Copy link
Collaborator

Can you add a Serial.println(wm.getModeString(WiFi.getMode())); to make sure you are connected to sta when coming out of configportal, also does using configportaltimeout (and letting it timeout NOT saveing ) result in the same behavior ?

@tablatronix
Copy link
Collaborator

only this I could find with this offer_error is this
nodemcu/nodemcu-firmware#1985

@liebman
Copy link
Contributor Author

liebman commented Aug 6, 2018

I'll give the above print a try when I get home.

EDIT: i did notice that:

dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)

was started a second time as the config portal was exiting....

@tablatronix
Copy link
Collaborator

ok let me enable debugging and see if mine does also , I think that happens when you restart sta or change modes. Ill see if its related

@tablatronix
Copy link
Collaborator

tablatronix commented Aug 6, 2018

I tried it with sta failing and saved, both work, although I did get 1 error, probably a timing issue,

Might be a lib, bug, let me know which esp version you are compiling when you can

*WM: [1] config portal exiting 
STA+AP
connected...yeey :)
*WM: [3] unloading 
lookup 'example.com' ... [hostByName] request IP for: mtsu.edu
add if1
pm close 7
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
wifi evt: 6
[hostByName] Host: example.com lookup error: -5!
FAILED!
lookup 'example.com' ... [hostByName] request IP for: mtsu.edu
[hostByName] Host: example.com IP: 10.14.0.116
10.14.0.116

@liebman
Copy link
Contributor Author

liebman commented Aug 6, 2018

I'm getting "STA+AP" - even if I add WiFi.mode(WIFI_STA); before starting the config portal.

Adding a 30 second timeout yields this where it fails a few times then says its connected and starts working.

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v00000000
~ld

SDK:2.2.1(cfd48f3)/Core:unspecified/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-13-g163bb82)/BearSSL:6d1cefc
*WM: [3] WIFI station disconnect 
scandone
*WM: [3] WiFi station enable 
del if0
usl
mode : null
*WM: [2] Disabling STA 
*WM: [2] Enabling AP 
*WM: [1] StartAP with SSID:  DNSFail
modwifi evt: 8
e : softAP(6a:c6:3a:ac:8b:4e)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
wifi evt: 8
*WM: [2] AP has anonymous access! 
bcn 0
del if1
usl
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal 
*WM: [1] Starting Web Portal 
*WM: [3] dns server started with ip:  192.168.4.1
*WM: [2] HTTP server started 
mode : sta(68:c6:3a:ac:8b:4e) + softAP(6a:c6:3a:ac:8b:4e)
add if0
wifi evt: 8
scandone
*WM: [2] WiFi Scan done in 2198ms
*WM: [2] Config Portal Running, blocking, waiting for clients... 
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
*WM: [2] Portal Timeout In 0 seconds
*WM: [1] config portal has timed out 
*WM: [3] configportal abort 
*WM: [2] disconnect configportal 
bcn 0
del if1
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
*WM: [1] config portal exiting 
STA+AP
connected...yeey :)
*WM: [3] unloading 
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -6!
FAILED!
wifi evt: 2
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -6!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -6!
FAILED!
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with ThicketLand, channel 6
dhcp client start...
wifi evt: 0
ip:192.168.0.30,mask:255.255.255.0,gw:192.168.0.1
wifi evt: 3
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 162.248.241.94
162.248.241.94
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 162.248.241.94
162.248.241.94
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 162.248.241.94
162.248.241.94
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org IP: 162.248.241.94
162.248.241.94

@liebman
Copy link
Contributor Author

liebman commented Aug 6, 2018

And adding WiFi.mode(WIFI_STA); after the return from config portal also works.

@tablatronix
Copy link
Collaborator

Can you test one more thing?
Add a 2 second delay before when starting configportal to give esp time to connect, autoconnect=true?

@liebman
Copy link
Contributor Author

liebman commented Aug 7, 2018

Still fails. (autoconnect is true) Found also that After startConfigPortal() returns it's ALWAYS in 'STA+AP' Even if I had called WiFi.mode(WIFI_STA); before the delay before startConfigPortal()`.
Current sketch:

#include <Arduino.h>
#include <WiFiManager.h>

const char* AP_NAME = "DNSFail";
const char* server_name = "0.zoddotcom.pool.ntp.org";

void setup() {
    Serial.begin(76800);
    WiFi.mode(WIFI_STA);

    WiFiManager wm;

    Serial.printf("AutoConnect: %s\n", WiFi.getAutoConnect() ? "true" : "false");
    Serial.print("Before: ");
    Serial.println(wm.getModeString(WiFi.getMode()));

    delay(5000);
    wm.startConfigPortal(AP_NAME, NULL);

    Serial.print("After: ");
    Serial.println(wm.getModeString(WiFi.getMode()));

    Serial.println("connected...yeey :)");
}

void loop() {
    Serial.printf("lookup '%s' ... ", server_name);
    IPAddress address;
    if (!WiFi.hostByName(server_name, address))
    {
        Serial.println("FAILED!");
    }
    else
    {
        Serial.printf("%d.%d.%d.%d\n", address[0], address[1], address[2], address[3]);
    }

    delay(1000);
}

Results:

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v00000000
~ld

SDK:2.2.1(cfd48f3)/Core:unspecified/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-13-g163bb82)/BearSSL:6d1cefc
AutoConnect: true
Before: STA
wifi evt: 2
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with ThicketLand, channel 6
dhcp client start...
wifi evt: 0
ip:192.168.0.30,mask:255.255.255.0,gw:192.168.0.1
wifi evt: 3
*WM: [3] WiFi station enable 
*WM: [2] Enabling AP 
*WM: [1] StartAP with SSID:  DNSFail
mode : sta(68:c6:3a:ac:8b:4e) + softAP(6a:c6:3a:ac:8b:4e)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
wifi evt: 8
*WM: [2] AP has anonymous access! 
bcn 0
del if1
pm open,type:2 0
add if1
pm close 7
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal 
*WM: [1] Starting Web Portal 
*WM: [3] dns server started with ip:  192.168.4.1
*WM: [2] HTTP server started 
scandone
*WM: [2] WiFi Scan done in 2194ms
*WM: [2] Config Portal Running, blocking, waiting for clients... 
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
add 1
aid 1
station: f0:98:9d:56:8e:81 join, AID = 1
wifi evt: 5
wifi evt: 9
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 9
wifi evt: 9
wifi evt: 9
wifi evt: 7
wifi evt: 7
wifi evt: 7
*WM: [3] -> captive.apple.com 
*WM: [2] <- Request redirected to captive portal 
wifi evt: 7
wifi evt: 7
*WM: [2] NUM CLIENTS: 1 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresult: WL_CONNECTED
scandone
*WM: [2] WiFi Scan done in 2198ms
*WM: [3] -> captive.apple.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [2] Scan is cached 252ago
*WM: [3] -> captive.apple.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [2] Scan is cached 477ago
*WM: [2] <- HTTP Wifi 
*WM: [2] Scan is cached 1796ago
*WM: [1] 8 networks found
*WM: [2] DUP AP: ThicketLand
*WM: [2] AP:  -34 ThicketLand
*WM: [2] AP:  -35 T3WQBGGB
*WM: [2] AP:  -39 DIRECT-7C-HP ENVY 5660 series
*WM: [2] AP:  -82 Bob's Network
*WM: [2] AP:  -87 IFFU6
*WM: [2] AP:  -87 DIRECT-0WM2070 Series
*WM: [2] AP:  -89 KRASON-2G
*WM: [3] lastconxresult: WL_CONNECTED
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
*WM: [3] Sent config page 
*WM: [3] -> captive.apple.com 
*WM: [2] <- Request redirected to captive portal 
*WM: [2] <- HTTP Root 
*WM: [3] -> 192.168.4.1 
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [2] Scan is cached 4897ago
*WM: [2] <- HTTP WiFi save  
*WM: [3] Method: POST
*WM: [3] Sent wifi save page 
*WM: [2] process connect 
*WM: [2] Connecting as wifi client... 
*WM: [3] WIFI station disconnect 
state: 5 -> 0 (0)
rm 0
*WM: [1] Connecting to saved AP: ThicketLand
*WM: [3] WiFi station enable 
*WM: [3] enableSTA PERSISTENT ON 
*WM: [1] connectTimeout not set, ESP waitForConnectResult...  
wifi evt: 1
STA disconnect: 8
wifi evt: 8
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with ThicketLand, channel 6
dhcp client start...
wifi evt: 0
ip:192.168.0.30,mask:255.255.255.0,gw:192.168.0.1
wifi evt: 3
*WM: [2] Connection result: WL_CONNECTED
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [1] Connect to new AP [SUCCESS] 
*WM: [1] Got IP Address: 
*WM: [1] 192.168.0.30 
*WM: [2] disconnect configportal 
station: f0:98:9d:56:8e:81 leave, AID = 1
rm wifi evt: 6
1
bcn 0
del if1
pm open,type:2 0
add if1
pm close 7
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
*WM: [1] config portal exiting 
After: STA+AP
connected...yeey :)
*WM: [3] unloading 
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
wifi evt: 7
wifi evt: 7
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
wifi evt: 7
wifi evt: 7
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org
[hostByName] Host: 0.zoddotcom.pool.ntp.org lookup error: -5!
FAILED!
lookup '0.zoddotcom.pool.ntp.org' ... [hostByName] request IP for: 0.zoddotcom.pool.ntp.org

@tablatronix
Copy link
Collaborator

tablatronix commented Aug 7, 2018

Thats because there was a bug and I had to remove this

  // WiFi_Mode(_usermode); // restore users wifi mode, BUG https://github.com/esp8266/Arduino/issues/4372

@tablatronix
Copy link
Collaborator

How did you output this ?

SDK:2.2.1(cfd48f3)/Core:unspecified/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-13-g163bb82)/BearSSL:6d1cefc

@tablatronix
Copy link
Collaborator

Also it looks like your lookup failures have changed to a different error.. hmm

@liebman
Copy link
Contributor Author

liebman commented Aug 7, 2018

I'm using Debug port: Serial & Debug Level: WiFi

I wonder if the DNS issue is because AP is enabled and somehow the DNS lookup is being set there (and fails of course). esp8266/Arduino#4949 mentions this possibility in one of the comments. Would explain why it works if I set STA after the config portal exits.

@tablatronix
Copy link
Collaborator

Maybe, But I was in not seeing issues with the same mode. Shouldn't dns work on both interfaces?
Or are we breaking it when we do dnsServer.reset();

@tablatronix
Copy link
Collaborator

ok so if the subnets are the same, the loopback dns will be hit it seems.

Is this what you are seeing, is your sta ap dns the same subnet as your softap ?

@liebman
Copy link
Contributor Author

liebman commented Aug 7, 2018

Nope - 192.168.0.0/24 vs 192.168.4.0/24 Maybe there is something odd about how my router sends teh DNS server? (But it works in STA only mode)

@tablatronix
Copy link
Collaborator

strange I will try to see of that bug can be fixed for now, if that issue is still a problem or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Feeback Developer needs feedback
Projects
None yet
Development

No branches or pull requests

2 participants