handle ipv6 addresses suffixed with scope id #52
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #51, I get a lot of errors that Manyverse is crashing with this:
And it comes from this multiserver's net plugin. After a lot of investigation, I figured out why that IPv6 address is "invalid": all of these IPv6 addresses that I got reports from were all link-local addresses, and given multiple network interfaces on the device, the IPv6 addresses needs a suffix to disambiguate which network interface is that address related to. See IETF RFC 6874.
So to fix those kind of crashes, I just need to provide the zone id
%wlan0
or%en0
(or whatever) as a suffix on the IP address, so if we callserver.listen(port, host)
using thehost
shown below, then the crash is fixed!Read more: https://superuser.com/questions/99746/why-is-there-a-percent-sign-in-the-ipv6-address
What this PR does, however, is to hide the
%wlan0
for remote peers, because the RFC says:That's why I added some code in
stringify()
to remove the zone ID before sharing it with peers.