dns: Support link local IPv6 addresses#7889
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7889 +/- ##
==========================================
+ Coverage 81.84% 81.93% +0.09%
==========================================
Files 377 377
Lines 38120 38117 -3
==========================================
+ Hits 31201 31233 +32
+ Misses 5603 5573 -30
+ Partials 1316 1311 -5
|
|
As mentioned offline:
|
8b9bae2 to
5d78fd2
Compare
I've replaced all usages of net.ParseIP and added a line in vet.sh to catch usages in the future. PTAL. |
dfawley
left a comment
There was a problem hiding this comment.
Great, thanks! Glad to see almost all the other uses were just in tests.
| } | ||
|
|
||
| func (sim *remoteIPMatcher) match(data *rpcData) bool { | ||
| return sim.ipNet.Contains(net.IP(net.ParseIP(data.peerInfo.Addr.String()))) |
There was a problem hiding this comment.
Not sure what this old redundant net.IP cast was about, but now it's actually necessary. :)
| git grep -e 'context.Background()' --or -e 'context.TODO()' -- "*_test.go" | grep -v "benchmark/primitives/context_test.go" | grep -v "credential | ||
| s/google" | grep -v "internal/transport/" | grep -v "xds/internal/" | grep -v "security/advancedtls" | grep -v 'context.WithTimeout(' | not grep -v 'context.WithCancel(' | ||
|
|
||
| # Disallow usage of net.ParseIP in favour of ipnet.ParseAddr as the former |
|
Would this be taken care of as well with this change: #3272? |
Fixes: #7882 #3272
Link local IPv6 addresses have the format
[IPv6-address%interface]:port, notice the extra%interfacepart which is called thezone. Unlike link local IPv4 addresses, link local IPv6 addresses are not globally unique, instead they can be re-used for each network interface. As a result, the interface is required to disambiguate link local IPv6 addresses (see wikipedia).Since net.ParseIP doesn't support such addresses, the PR replaces usages of net.ParseIP with the new
ipnet.PareAddrwhich support IPv6 addresses with zones and also returns parsing errors.RELEASE NOTES: