-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks! Glad to see almost all the other uses were just in tests.
@@ -344,7 +345,8 @@ func newRemoteIPMatcher(cidrRange *v3corepb.CidrRange) (*remoteIPMatcher, error) | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this old redundant net.IP
cast was about, but now it's actually necessary. :)
scripts/vet.sh
Outdated
@@ -89,6 +89,10 @@ git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' ':(exclude)*. | |||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: s/ipnet/netip/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
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%interface
part 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.PareAddr
which support IPv6 addresses with zones and also returns parsing errors.RELEASE NOTES: