Skip to content

issues with IPv6 patch & IPAddress changes #5406

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

Closed
6 tasks done
d-a-v opened this issue Dec 1, 2018 · 7 comments
Closed
6 tasks done

issues with IPv6 patch & IPAddress changes #5406

d-a-v opened this issue Dec 1, 2018 · 7 comments
Assignees
Milestone

Comments

@d-a-v
Copy link
Collaborator

d-a-v commented Dec 1, 2018

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: any
  • Core Version: latest git
  • Development Env: any
  • Operating System: any

Settings in IDE

  • Module: any
  • Flash Mode: any
  • Flash Size: any
  • lwip Variant: v2
  • Reset Method: any
  • Flash Frequency: any
  • CPU Frequency: any
  • Upload Using: any
  • Upload Speed: any

Problem Description

Track issues from IPv6 + IPAddress changes

ref: 5c4db3a#commitcomment-31519816
@reaper7

Identified issues are:

  • use of struct ip_addr which is espressif and not lwIP.
    This structure has been renamed to struct ipv4_addr within the SDK which is stuck to lwIP-v1.4.
    struct ip_addr_tis the real name of that structure, but in arduino IPAddress should always be used.
  • use of ipaddr->addr is stuck to IPv4. It could be changed to ip_2_ip4(ipaddr)->addr
    with (this is defined in newer IPAddress.h but is needed for older cores):
#ifndef ip_2_ip4
// emulate lwIP-v2's ip_2_ip4(x) for lwIP-v1
#define ip_2_ip4(x) (x)
#endif
  • more generally IPAddress(ipaddr) should be used anywhere, thus generic, simple and portable wrappers should be proposed for external libraries to keep compatibility with older cores, and IPv6 at the same time (IPv6 is costless when using IPAddress)
  • INADDR_NONE should be restored as it was (sorry for that, IPNoAddress was an intermediary change that I forgot to revert)

MCVE Sketch

TBD, using at least EspAsyncTCP library, thingspeak library

@d-a-v d-a-v self-assigned this Dec 1, 2018
@d-a-v d-a-v added this to the 2.5.0 milestone Dec 1, 2018
@reaper7
Copy link
Contributor

reaper7 commented Dec 1, 2018

@d-a-v - tnx for open this issue :)

detailed compile errors for thingspeak->ReadField example:

In file included from C:\PROGRAMY\arduino_projekty\libraries\thingspeak-arduino\examples\ESP8266\ReadField\ReadField.ino:28:0:

C:\PROGRAMY\arduino_projekty\libraries\thingspeak-arduino\src/ThingSpeak.h:1729:23: error: 'INADDR_NONE' was not declared in this scope

  IPAddress customIP = INADDR_NONE;

                       ^

C:\PROGRAMY\arduino_projekty\libraries\thingspeak-arduino\src/ThingSpeak.h: In member function 'void ThingSpeakClass::setServer(const char*, unsigned int)':

C:\PROGRAMY\arduino_projekty\libraries\thingspeak-arduino\src/ThingSpeak.h:1700:20: error: 'INADDR_NONE' was not declared in this scope

   this->customIP = INADDR_NONE;

                    ^

C:\PROGRAMY\arduino_projekty\libraries\thingspeak-arduino\src/ThingSpeak.h: In member function 'void ThingSpeakClass::setServer()':

C:\PROGRAMY\arduino_projekty\libraries\thingspeak-arduino\src/ThingSpeak.h:1720:20: error: 'INADDR_NONE' was not declared in this scope

   this->customIP = INADDR_NONE;

                    ^

C:\PROGRAMY\arduino_projekty\libraries\thingspeak-arduino\src/ThingSpeak.h: In member function 'bool ThingSpeakClass::connectThingSpeak()':

C:\PROGRAMY\arduino_projekty\libraries\thingspeak-arduino\src/ThingSpeak.h:1744:24: error: 'INADDR_NONE' was not declared in this scope

   if(this->customIP == INADDR_NONE && NULL == this->customHostName)

                        ^

exit status 1
Błąd kompilacji dla płytki LOLIN(WEMOS) D1 R2 & mini.

@arcao
Copy link

arcao commented Dec 1, 2018

The same problem for me. Unable to compile project with my Syslog library:

C:\Users\Martin\Dropbox\_programovani\arduino\libraries\Syslog\src\Syslog.cpp: In member function 'bool Syslog::_sendLog(uint16_t, const char*)':

C:\Users\Martin\Dropbox\_programovani\arduino\libraries\Syslog\src\Syslog.cpp:188:46: error: 'INADDR_NONE' was not declared in this scope

   if ((this->_server == NULL && this->_ip == INADDR_NONE) || this->_port == 0)

                                              ^

C:\Users\Martin\Dropbox\_programovani\arduino\libraries\Syslog\src\Syslog.cpp: In member function 'bool Syslog::_sendLog(uint16_t, const __FlashStringHelper*)':

C:\Users\Martin\Dropbox\_programovani\arduino\libraries\Syslog\src\Syslog.cpp:234:46: error: 'INADDR_NONE' was not declared in this scope

   if ((this->_server == NULL && this->_ip == INADDR_NONE) || this->_port == 0)

@d-a-v
Copy link
Collaborator Author

d-a-v commented Dec 1, 2018

#5409 will fix these issues.

more generally IPAddress(ipaddr) should be used anywhere, thus generic, simple and portable wrappers should be proposed for external libraries to keep compatibility with older cores, and IPv6 at the same time (IPv6 is costless when using IPAddress)

There is no hack in #5409 thus no wrappers are needed (yet, and that's nice).
However, when IPv6 is enabled, updates are needed: Use IPAddress everywhere where struct ip_addr or struct ip_addr_t or u32_t or uint32_t are used, and this will work too with lwIP-v1.4 and this core (git/pre-2.5.0).

@devyte
Copy link
Collaborator

devyte commented Dec 2, 2018

Fixed via #5409 . Please open a new issue if there are further compile problems.

@devyte devyte closed this as completed Dec 2, 2018
@d-a-v
Copy link
Collaborator Author

d-a-v commented Dec 2, 2018

It is not fixed yet,
yesterday I fell asleep on my keyboard :-]

@d-a-v
Copy link
Collaborator Author

d-a-v commented Dec 3, 2018

Examples fromEspAsyncTCP, ThingSpeak and Syslog now compile fine with #5416.

@devyte
Copy link
Collaborator

devyte commented Dec 3, 2018

Closing via #5416 .

@devyte devyte closed this as completed Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants