From 47ebd1e9a2bb48f0d33db1283101dab1d5053b4d Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Mon, 3 May 2021 13:05:00 -0700 Subject: [PATCH] wgengine/router: use net.IP.Equal instead of bytes.Equal to compare IPs Signed-off-by: Josh Bleecher Snyder --- wgengine/router/ifconfig_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wgengine/router/ifconfig_windows.go b/wgengine/router/ifconfig_windows.go index 9ee2f4cf2..2f948f15f 100644 --- a/wgengine/router/ifconfig_windows.go +++ b/wgengine/router/ifconfig_windows.go @@ -377,7 +377,7 @@ func configureInterface(cfg *Config, tun *tun.NativeTun) (retErr error) { NextHop: gateway, Metric: 0, } - if bytes.Compare(r.Destination.IP, gateway) == 0 { + if net.IP.Equal(r.Destination.IP, gateway) { // no need to add a route for the interface's // own IP. The kernel does that for us. // If we try to replace it, we'll fail to @@ -411,7 +411,7 @@ func configureInterface(cfg *Config, tun *tun.NativeTun) (retErr error) { // There's only one way to get to a given IP+Mask, so delete // all matches after the first. if i > 0 && - bytes.Equal(routes[i].Destination.IP, routes[i-1].Destination.IP) && + net.IP.Equal(routes[i].Destination.IP, routes[i-1].Destination.IP) && bytes.Equal(routes[i].Destination.Mask, routes[i-1].Destination.Mask) { continue }