-
Notifications
You must be signed in to change notification settings - Fork 7.6k
IPADDR_NONE conflicting defines #6760
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
Comments
One possible way to correct this issue is to delete the declaration of INADDR_NONE from IPAddress completely. Searching through the Arduino project, the only file affected is ETH.cpp:393: |
PR 6659 notes: Hopefully this will be fixed in the IDF. |
@mrengineer7777 -
Please check https://github.com/espressif/arduino-esp32/pull/6659/files and you will see that the PR does all you have commented in your issue report. |
It is already fixed in IDF, but it has not been backported to the 4.4. yet. |
You can manually apply all the necessary changes to your local files - it seems you use PIO. Using Arduino IDE and updating it to 2.0.3 works fine for this issue, because it already has the all those header files changes commited to the main GitHub repository. |
@SuGlider Thanks for pointing out the modifications to the other files. I just made those changes and I'm still getting a compile error if I include "IPAddress.h". I'll do some more digging and see if I can create a simple sketch to repro the issue. I will note "lwip/inet.h" is still referenced in multiple files, including "netdb.h", which I use to convert an IP string to ip_addr_t. |
See updated sketch above which reproduces the issue. Note that it doesn't happen if `#include "Arduino.h" is called first, but the library I'm compiling doesn't include Arduino.h (by design), so it exhibits the same issue. Also note the IP lookup likely won't work without WiFi being up. We are just testing for a successful compile here. |
The PR#6659 solves the INADDR_NONE for the ESP32 Arduino framework. There is nothing that we can do to fix any combination of Arduino/IDF users may want to create. |
This is not a pure Arduino Sketch... it is a mix of IDF LWIP and Arduino... which only needs IPAddress Class for a log_v(). |
Fair point. I'm creating an Arduino library but it does need some IDF calls. That makes me wonder how esp_ping.c avoided the URL lookup issue. Will look into it tomorrow.
Accepted. I will close out this issue. Thanks for the clarifications! |
@mrengineer7777 Check these libraries for Ping: https://github.com/pbecchi/ESP32_ping |
…tro default Según espressif/arduino-esp32#6760 la biblioteca LwIP y Arduino requieren valores distintos para el valor INADDR_NONE. Dependiendo de el orden de inclusión de librerías, la declaración de WiFiAPClass::softAPConfig() puede ver el valor 0xFFFFFFFF en lugar de 0 para lease_start. El código interno asume 0 para valor por omisión, y por lo tanto la inicialización de softAP falla y el valor recibido es 0xFFFFFFFF. Para lidiar con esto, se pasa explícitamente 0 como lease_start en lugar de depender del default.
It really helps to call the #include "Arduino. h" first |
Board
Adafruit Feather ESP32
Device Description
ESP32-C3-DevKitC-02
Hardware Configuration
None
Version
v2.0.3
IDE Name
VSCODE w/ PIO
Operating System
Win10
Flash frequency
40Mhz
PSRAM enabled
no
Upload speed
115200
Description
I have run into an issue while creating a new "PingClass" library to replace the deprecated ping.h and esp_ping.h libraries.
This issue is mentioned in issue #6247, #6610. Even when applying the fix in #6659 to my copy of IPAddress.cpp/h, I still get the error seen below.
I have resolved the issue in my class by dropping all references to String and IPAddress, and just using C strings. However, I believe the definitions still conflict. Definitions:
IPAddress.cpp:
IPAddress INADDR_NONE(0, 0, 0, 0);
IPAddress.h:
extern IPAddress INADDR_NONE;
inet.h:
#define INADDR_NONE IPADDR_NONE
ip4_addr.h:
#define IPADDR_NONE ((u32_t)0xffffffffUL)
I believe
INADDR_NONE
expands in IPAddress.h as:IPAddress(0,0,0,0)
, which works with the constructor. But if inet.h is included it may expand as:((u32_t)0xffffffffUL)(0, 0, 0, 0)
.Note also that 0.0.0.0 is a completely different IP than IPADDR_NONE=255.255.255.255.
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: