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

re-order softAP setup #118

Merged
merged 2 commits into from
Dec 24, 2021
Merged

Conversation

cgmckeever
Copy link
Collaborator

I swear, saying HI yesterday was not to get this MR in ;)

Im not 100% positive this is correct, but it fixes.
Prior to this change, every time I would connect to the AP to do the configure, I would get and IP of 169.254.128.129
Some painful googling, it looks like this is something that has creeped into the underlying ESP codebase.

espressif/esp-idf#6108

I finally found this reference, and doing this swap was the only thing that would allow the client to get a proper IP repeatably

esp8266/Arduino#8326


IPAddress ip(192, 168, 1, 1);
IPAddress NMask(255, 255, 255, 0);
WiFi.softAPConfig(ip, ip, NMask);

// Need to wait to get IP
delay(500);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this comment and this delay is probably incorrect now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

@nrwiersma
Copy link
Owner

Nice catch, thanks.

@nrwiersma nrwiersma merged commit a2c4bc6 into nrwiersma:master Dec 24, 2021
@kirillandy
Copy link

kirillandy commented Mar 31, 2022

Thanks to this and esp8266/Arduino#8326 I could resolve my own softAP DHCP problem. It's such a minor, simple fix but it made a world of a difference. Thanks a lot to everyone!
I can add a bit of info on the weird default IP address @cgmckeever mentioned, if anyone finds this useful. I got one myself, it was 169.254.X.Y. I was using a callback function in Win32 to catch interface IP address changes and whenever I received this address, I would look into the MIB_UNICASTIPADDRESS_ROW structure for more info:
Row->DadState was NL_DAD_STATE::IpDadStatePreferred
Row->PrefixOrigin was NL_PREFIX_ORIGIN::IpPrefixOriginWellKnown
Row->SuffixOrigin was NL_SUFFIX_ORIGIN::NlsoLinkLayerAddress
I am not very well-read on these specifics but if you consult MSDN (here), you'll read that the host part of the address is generated from the MAC address of the host. What this means or why this happens I don't know. But FYI, in any case.

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.

3 participants