mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-14 06:57:31 +00:00
wgengine: adapt to wireguard-go changes
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:

committed by
Josh Bleecher Snyder

parent
d76334d2f0
commit
aa6856a9eb
@@ -308,16 +308,20 @@ func newUserspaceEngineAdvanced(conf EngineConfig) (_ Engine, reterr error) {
|
||||
// Ping every single-IP that peer routes.
|
||||
// These synthetic packets are used to traverse NATs.
|
||||
var ips []netaddr.IP
|
||||
allowedIPs := deviceAllowedIPs.EntriesForPeer(peer)
|
||||
for _, ipNet := range allowedIPs {
|
||||
if ones, bits := ipNet.Mask.Size(); ones == bits && ones != 0 {
|
||||
ip, ok := netaddr.FromStdIP(ipNet.IP)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
var allowedIPs []netaddr.IPPrefix
|
||||
deviceAllowedIPs.EntriesForPeer(peer, func(stdIP net.IP, cidr uint) bool {
|
||||
ip, ok := netaddr.FromStdIP(stdIP)
|
||||
if !ok {
|
||||
logf("[unexpected] bad IP from deviceAllowedIPs.EntriesForPeer: %v", stdIP)
|
||||
return true
|
||||
}
|
||||
ipp := netaddr.IPPrefix{IP: ip, Bits: uint8(cidr)}
|
||||
allowedIPs = append(allowedIPs, ipp)
|
||||
if ipp.IsSingleIP() {
|
||||
ips = append(ips, ip)
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
if len(ips) > 0 {
|
||||
go e.pinger(peerWGKey, ips)
|
||||
} else {
|
||||
|
@@ -59,11 +59,9 @@ func NewLogger(logf logger.Logf) *Logger {
|
||||
// but there's not much we can do about that.
|
||||
logf("%s", new)
|
||||
}
|
||||
std := logger.StdLogger(wrapper)
|
||||
ret.DeviceLogger = &device.Logger{
|
||||
Debug: std,
|
||||
Info: std,
|
||||
Error: std,
|
||||
Verbosef: logger.WithPrefix(wrapper, "[v2] "),
|
||||
Errorf: wrapper,
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
@@ -46,12 +46,11 @@ func TestLogger(t *testing.T) {
|
||||
// Then if logf also attempts to write into the channel, it'll fail.
|
||||
c <- ""
|
||||
}
|
||||
x.DeviceLogger.Info.Println(tt.in)
|
||||
x.DeviceLogger.Errorf(tt.in)
|
||||
got := <-c
|
||||
if tt.omit {
|
||||
continue
|
||||
}
|
||||
tt.want += "\n"
|
||||
if got != tt.want {
|
||||
t.Errorf("Println(%q) = %q want %q", tt.in, got, tt.want)
|
||||
}
|
||||
|
Reference in New Issue
Block a user