-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add "Get Global IPv6 Address" and update the example. #7065
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
Conversation
|
I think this needs a short conversation about what "localIP" really means here. If it is just the assigned address, then scope should be a parameter in localIPv6 rather than making a new method. |
In IPv4 , only have remote address and local address. In IPv6, address which call "Local Link address" which is start with "fe80", is calculated by MAC address ,and can only used in LAN. Global IPv6 Address can be access on the internet. But they are all "local address". But I think making a new method is more easy for the user. |
Thanks for the PR @fryefryefrye. I'm adding this to 2.1.0 milestone because this needs more investigation and work. We will evaluate this PR soon. |
I suggest not trying to patch in support for just one additional address, but recognise that with IPv6 a device will usually have varying numbers of multiple addresses. e.g. Have a signature like Note that ArduinoCore-API now has IPAddress that supports both v4 and v6. Generally the client code doesn't want to care about which version of IP is being used. Note that local means this end of the connection (as opposed to the remote end), and is different from link-local. As discussed above, link-local are addresses starting with "fe80:". The equivalent in IPv4 is a "169.254" address, which is only assigned when there is no network, whereas with IPv6 they are always assigned. In IPv4 and endpoint usually only has one address, e.g. either a global address, private network address, or if no network then a link-local address (e.g. used in point-to-point connections). With IPv6 an endpoint will usually have multiple local addresses -- a link-local address (autogenerated), as well as one or more global scope addresses, including both globally routeable addresses and maybe unique local addresses ("fd.."), both stateless/EUI-64 addresses and maybe DHCP assigned addresses, and with privacy extensions possibly also some additional rotating addresses. For example, my local machine has 1x IPv4, and 7x IPv6 addresses. Although Arduino/lwIP may not yet support all these types of addresses, then interface should prepare for varying numbers of addresses. Generally when getting a single address, i.e. Without any knowledge of the intended destination, I suggest ordering local IP addresses as if the destination is a global address, if possible, i.e. preference global addresses (globally routable or unique local addresses) over link-local, and IPv6 over IPv4 (see RFC 6724). This won't always be what the user wants (e.g. in a dual stack network maybe they want to check the address in the logs of an IPv4 only destination), but if you only return a single address then you can't always know what will be needed. |
👋 Hello fryefryefrye, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
@sgryphon gave very good proposal. IPv6Address class will go into the history, now that IPAddress will support both v4 and v6. I will leave this open, just to reming me to add proper integration to the interfaces to get all assigned IPAddresses (both v4 and v6 flavors) |
Rather than have discussions across multiple issues and pull requests, I created a general IPv6 discussion that can be used: #9009 |
#5624 (comment)
Description of Change
Help to Get "Global IPv6 Address"
Tests scenarios
I have tested my Pull Request on Arduino-esp32 core v2.0.4 with ESP32.
log out put: