-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
IPAddress construction and comparison are buggy on Arduino 3 #9724
Labels
Status: Awaiting triage
Issue is waiting for triage
Comments
mathieucarbou
added a commit
to mathieucarbou/arduino-esp32
that referenced
this issue
May 29, 2024
This was referenced May 29, 2024
mathieucarbou
added a commit
to mathieucarbou/arduino-esp32
that referenced
this issue
May 29, 2024
Note: the workaround could be to not use the constructor and proceed like that:
|
mathieucarbou
added a commit
to mathieucarbou/arduino-esp32
that referenced
this issue
May 30, 2024
me-no-dev
pushed a commit
that referenced
this issue
May 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Board
N/A
Device Description
N/A
Hardware Configuration
N/A
Version
v3.0.0
IDE Name
N/A
Operating System
N/A
Flash frequency
N/A
PSRAM enabled
no
Upload speed
N/A
Description
The origin of this bug request comes for a bug report in my ESPAsyncWebServer maintained fork here: mathieucarbou/ESPAsyncWebServer#26
The root of the problem lies in the fact that when connected to a WiFi, both should be true.
But the second one is false.
This is because the library uses behind the new
IPAddress
construction with anip_addr_t
(following some updates from the ESPHome team). This is not wrong, but the new implementation has flaws.The issue lies at several places:
For IPv4, it should only compare
_address.dword[IPADDRESS_V4_DWORD_INDEX]
, not the full set of bytesWhich is not "clearing" the indexes 0, 1 and 2 to 0, to ensure the comparison operator works for IPv4
Any of this fix would work. I tested this one:
But I think both should be applied (also making sure that the compare operator is comparing the relevant information depending on the IP type)
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: