micropython / micropython/micropython
IPv4 address can persist well after wifi AP connection is lost
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 22.1k
- Forks
- 9k
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 16
Description
MicroPython v1.19.1 on 2022-09-20; Raspberry Pi Pico W with RP2040
As noted in a comment in #9455:
wlan.status() of 3 means:
#define CYW43_LINK_UP (3) Connect to wifi with an IP address
as opposed to:
#define | CYW43_LINK_NOIP (2) Connected to wifi, but no IP address
But the device will still have an IP address even when it has become disconnected from the wifi Access Point (at least when it disconnects through the mechanism in 9455). Is this an intended feature, emergent feature, or bug? The IP address also sometimes returns 0.0.0.0, which I suspect is the wlan.status() == 2 case, and is at least is easy to check for.
From #8994:
The idea with soft reset is that it resets Python state but not necessarily hardware state. Eg soft reset won't put GPIO back to a default state, or disable USB. Any hardware that's left untouched after a soft reset should still be in a valid state, and if code expects to run after a soft reset then it must be aware that hardware peripherals can be in a variety of states when MicroPython code starts running.
But this doesn't seem to fall within the realm of hardware state, since the device shows an IP address at times when it doesn't actually have a connection to an AP and, particularly in the DHCP case, doesn't have a valid IP address.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the wlan.status() values and CYW43_LINK_UP/CYW43_LINK_NOIP references described here, then compare the disconnect path from #9455 with the soft-reset context in #8994. Done means the behavior of the reported IP address after access-point loss is defined and covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- embedded-iot, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100