1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 01:05:15 +01:00

tun: fix fmt.Errorf format strings

Type tcpip.Error is not an error.

I've filed https://github.com/google/gvisor/issues/5314
to fix this upstream.

Until that is fixed, use %v instead of %w,
to keep vet happy.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder 2021-01-19 13:39:48 -08:00 committed by Jason A. Donenfeld
parent 7c5d1e355e
commit b00b2c2951

View File

@ -103,19 +103,19 @@ func CreateNetTUN(localAddresses []net.IP, dnsServers []net.IP, mtu int) (Device
} }
tcpipErr := dev.stack.CreateNIC(1, (*endpoint)(dev)) tcpipErr := dev.stack.CreateNIC(1, (*endpoint)(dev))
if tcpipErr != nil { if tcpipErr != nil {
return nil, nil, fmt.Errorf("CreateNIC: %w", tcpipErr) return nil, nil, fmt.Errorf("CreateNIC: %v", tcpipErr)
} }
for _, ip := range localAddresses { for _, ip := range localAddresses {
if ip4 := ip.To4(); ip4 != nil { if ip4 := ip.To4(); ip4 != nil {
tcpipErr = dev.stack.AddAddress(1, ipv4.ProtocolNumber, tcpip.Address(ip4)) tcpipErr = dev.stack.AddAddress(1, ipv4.ProtocolNumber, tcpip.Address(ip4))
if tcpipErr != nil { if tcpipErr != nil {
return nil, nil, fmt.Errorf("AddAddress(%v): %w", ip4, tcpipErr) return nil, nil, fmt.Errorf("AddAddress(%v): %v", ip4, tcpipErr)
} }
dev.hasV4 = true dev.hasV4 = true
} else { } else {
tcpipErr = dev.stack.AddAddress(1, ipv6.ProtocolNumber, tcpip.Address(ip)) tcpipErr = dev.stack.AddAddress(1, ipv6.ProtocolNumber, tcpip.Address(ip))
if tcpipErr != nil { if tcpipErr != nil {
return nil, nil, fmt.Errorf("AddAddress(%v): %w", ip4, tcpipErr) return nil, nil, fmt.Errorf("AddAddress(%v): %v", ip4, tcpipErr)
} }
dev.hasV6 = true dev.hasV6 = true
} }