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

LwipIntfDev - disconnect()/end() should not clear static IP settings #1866

Merged

Conversation

JAndrassy
Copy link
Contributor

when I wrote the test sketch for WiFi libraries I wanted to do begin with DHCP, then begin with static IP and then again begin with DHCP. I thought that disconnect() should clear the static IP for return to DHCP, but it turned out that all libraries I tested preserved the static IP settings over disconnect() (except my WiFiEspAT). I learned that the right way to return to DHCP is config(0) or config(INADDR_NONE). And this really worked in all libraries and in modern Ethernet libraries (the ones with config) too.
So the user of the library can config the static IP and then disconnect and later begin again with the same static IP.

Now WiFiTest and ModernEthernetTest do an additional begin/disconnect to test if the library preserves the static IP over disconnect. And they reported the your library resets the static IP in disconnect()/end().

The fix is easy and with the previous PR with the config with one and two parameters, the config(INADDR_NONE) works to return to DHCP.

The tests are:
WiFiTest
ModernEthernetTest

Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems okay, will be a noop once a new ::begin happens since the IP config is overwritten unconditionally there. Thx!

@earlephilhower earlephilhower merged commit 91183ca into earlephilhower:master Dec 1, 2023
12 checks passed
@JAndrassy JAndrassy deleted the intfdev_end_preserve_staticip branch December 1, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants