mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 14:57:49 +00:00
net/interfaces: explicitly check netaddr.IP.Is6 in isUsableV6
Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
parent
3ff8a55fa7
commit
effee49e45
@ -548,7 +548,7 @@ func isUsableV4(ip netaddr.IP) bool {
|
||||
// (fc00::/7) are in some environments used with address translation.
|
||||
func isUsableV6(ip netaddr.IP) bool {
|
||||
return v6Global1.Contains(ip) ||
|
||||
(ip.IsPrivate() && !tsaddr.TailscaleULARange().Contains(ip))
|
||||
(ip.Is6() && ip.IsPrivate() && !tsaddr.TailscaleULARange().Contains(ip))
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -58,6 +58,8 @@ func TestIsUsableV6(t *testing.T) {
|
||||
{"zeros", "0000:0000:0000:0000:0000:0000:0000:0000", false},
|
||||
{"Link Local", "fe80::1", false},
|
||||
{"Global", "2602::1", true},
|
||||
{"IPv4 public", "192.0.2.1", false},
|
||||
{"IPv4 private", "192.168.1.1", false},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
Loading…
x
Reference in New Issue
Block a user