Skip to content

softAPConfig fails with "DHCPS Set Netmask Failed! 0x5001" #9069

Closed
@TD-er

Description

@TD-er

Board

ESP32-S2

Device Description

Hardware Configuration

Version

latest master (checkout manually)

IDE Name

PlatformIO

Operating System

Windows 11

Flash frequency

40MHz

PSRAM enabled

yes

Upload speed

115200

Description

I call WiFi.softAPConfig with 192.168.4.1 for both IP and gateway and 255.255.255.0 as subnet mask.

This is during the setup process, so there is no STA interface active, only the AP interface.

The error is ESP_ERR_ESP_NETIF_INVALID_PARAMS

As far as I can see it is generated here (???)
https://github.com/espressif/esp-idf/blob/5524b692ee5d04d7a1000eb0c41640746fc67f3c/components/esp_netif/lwip/esp_netif_lwip.c#L2260-L2279

The comment suggests you need to set the IP of the interface first, but it is set in the same function. (set_esp_interface_ip)

I found this PR which might be related?
https://github.com/espressif/arduino-esp32/pull/6731/files

Apparently this has been an issue which went unnoticed for quite a while but a user reported it was not working anymore when I switched to ESP32 SDK 4.4.4.20230310

Using ESP32 SDK 4.4.4.20230208 was apparently still working.

Might be broken in this commit in esp-idf???
espressif/esp-idf@a71fa82

Sketch

-

Debug Message

[ 11104][D][WiFiGeneric.cpp:1043] _eventCallback(): Arduino Event: 0 - WIFI_READY
[ 11108][V][WiFiGeneric.cpp:395] _arduino_event_cb(): AP Started
[ 11109][D][WiFiGeneric.cpp:1043] _eventCallback(): Arduino Event: 10 - AP_START
[ 11216][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring SoftAP static IP: 192.168.4.1, MASK: 255.255.255.0, GW: 192.168.4.1
[ 11218][V][WiFiGeneric.cpp:146] set_esp_interface_ip(): SoftAP: 192.168.4.1 | Gateway: 192.168.4.1 | DHCP Start: 0.0.0.0 | Netmask: 255.255.255.0
[ 11230][V][WiFiGeneric.cpp:193] set_esp_interface_ip(): DHCP Server Range: 192.168.4.2 to 192.168.4.12
[ 11239][E][WiFiGeneric.cpp:201] set_esp_interface_ip(): DHCPS Set Netmask Failed! 0x5001

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions