Repository navigation
Append the zone ID after compressing the address in IPAddr#to_s - #127
Merged
Merged
Conversation
IPAddr#to_s ran its zero-compression and IPv4-tail regexps on the output of #to_string, which already ends with the zone ID. That had two effects for IPv6 addresses with a zone ID: * Anchored patterns no longer matched, so "::%eth0" was printed as "::0%eth0", and "::ffff:192.168.1.2%eth0" as "::ffff:c0a8:102%eth0" instead of using the dotted IPv4 tail. * The leading-zero stripping also applied to the zone ID, so "fe80::1%0ab" was printed as "fe80::1%ab", naming a different zone. Build the compressed form from the bare address and append the zone ID at the end.
Collaborator
|
Thanks. Zone IDs like
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
IPAddr#to_sruns compression on the string with the zone already appended, soIPAddr.new("::%eth0").to_sgives"::0%eth0", an IPv4-mapped address with a zone loses its dotted form, and zone ids like%0abbecome%ab(a different interface). The fix compresses the bare address, then appends the zone. Test added.