espressif / ESP8266_RTOS_SDK

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
http://bbs.espressif.com
Apache License 2.0
3.3k stars 1.57k forks source link

DHCP Server problem in softAP mode (GIT8266O-417) #847

Open umitech opened 4 years ago

umitech commented 4 years ago

Environment

Problem Description

The platform works well with SDK just the problem is that the clients (Android phones and Windows Laptop) can't get ip from the board. They try to get IP but fail everytime. I can say that I tested with all the old versions of different ESP8266 SDKs (RTOS v2, IDF, Arduino). We don't see this symptom with all of them. But with new SDK (stable 3.x and master branch) the problem exists.

Expected Behavior

Getting IP from platform DHCP server in softAP mode.

Actual Behavior

Starts to print "tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2" It repeats this message for 4 or 5 times and them client leaves the WiFi. This will repeat and repeat again.

Steps to repropduce

Just build and run the softAP example from SDK.

Debug Logs

I (379) wifi softAP: ESP_WIFI_MODE_AP I (3186) wifi softAP: wifi_init_softap finished. SSID:myssid password:mypassword

I (1560715) wifi softAP: station XX:XX:XX:XX:XX:XX join, AID=1 I (1565922) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 I (1568011) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 I (1571641) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 I (1578885) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 I (1593356) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 I (1596829) wifi softAP: station XX:XX:XX:XX:XX:XX leave, AID=1 I (1601839) wifi softAP: station XX:XX:XX:XX:XX:XX join, AID=1 I (1618918) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 I (1623366) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 I (1628361) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 I (1636958) tcpip_adapter: softAP assign IP to station,IP is: 192.168.4.2 I (1637967) wifi softAP: station XX:XX:XX:XX:XX:XX leave, AID=1 I (1641850) wifi softAP: station XX:XX:XX:XX:XX:XX join, AID=1

st1vms commented 1 year ago

By looking at master/components/tcpip_adapter/tcpip_adapter_lwip.c#L207

It seems the IP/GW/NETMASK fields are configured using default values of

192.168.4.1
192.168.4.1
255.255.255.0

when calling tcpip_adapter_init():