Repository navigation
Description
What happened?
A controller that runs only its access point (no Wi-Fi network configured) can't be updated from a client joined to WLED-AP while "Only allow update from same network/WiFi" is on (the default since 16.0.0). POST /update from 4.3.2.2 returns:
Access Denied
Client is not on local subnet.
The client is on WLED's own network, joined with the AP password. In that state the AP is the only way to reach the controller, so the default setting blocks every OTA update until the owner finds the option and turns it off.
To Reproduce Bug
- ESP32 on 16.0.1 with no Wi-Fi network configured, so only
WLED-AP(4.3.2.1) is up. - Security & Updates: "Only allow update from same network/WiFi" ticked, no PIN.
- Join a phone or PC to
WLED-AP(it gets4.3.2.x). - Upload any firmware at
http://4.3.2.1/update, orcurl -F [email protected] http://4.3.2.1/update. - Response:
401 Client is not on local subnet.
Expected Behavior
A client on WLED's own AP counts as "same network", and the update is accepted.
Install Method
Self-Compiled
What version of WLED?
16.0.1 (esp32dev env, plus a Bluetooth usermod; the code involved is unchanged from stock)
Which microcontroller/board are you seeing the problem on?
ESP32
Relevant log/trace output
$ curl -F [email protected] http://4.3.2.1/update # from 4.3.2.2, same-subnet on
HTTP 401 ... Access Denied ... Client is not on local subnet.
Anything else?
I think the cause is inSameSubnet() in wled00/wled_server.cpp: it compares the client with Network.localIP() / Network.subnetMask(), and localIP() is 0.0.0.0 when only the AP runs, so no client can match. inLocalSubnet() already treats 4.3.2.0/24 as local while apActive; inSameSubnet() doesn't.
I tried accepting the AP subnet in inSameSubnet() while apActive (about five lines), and with it the same upload from the same client returned 200 Update successful!. Happy to open a PR if that is the direction you'd want.
Hardware: GLEDOPTO GL-C-015WL-D (classic ESP32). Related: #5721 (a client really on another subnet, where the 401 is intended; this report is only about the AP client).
- I agree to follow this project's Code of Conduct
Activity