From e862f90e3448993f0a0c6f7f335a5b6cb6b0e372 Mon Sep 17 00:00:00 2001 From: Christina Wen <37028905+c22wen@users.noreply.github.com> Date: Tue, 15 Sep 2020 14:14:33 -0400 Subject: [PATCH] wgengine/router/router_linux.go: fixed " route del failed" error (#756) * wgengine/router/router_linux.go: Switched `cidrDiff("addr")` and `cidrDiff("route")` order Signed-off-by: Christina Wen Co-authored-by: Christina Wen --- wgengine/router/router_linux.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wgengine/router/router_linux.go b/wgengine/router/router_linux.go index 6e8d8576e..3ed702a3f 100644 --- a/wgengine/router/router_linux.go +++ b/wgengine/router/router_linux.go @@ -173,17 +173,17 @@ func (r *linuxRouter) Set(cfg *Config) error { return err } - newAddrs, err := cidrDiff("addr", r.addrs, cfg.LocalAddrs, r.addAddress, r.delAddress, r.logf) + newRoutes, err := cidrDiff("route", r.routes, cfg.Routes, r.addRoute, r.delRoute, r.logf) if err != nil { return err } - r.addrs = newAddrs + r.routes = newRoutes - newRoutes, err := cidrDiff("route", r.routes, cfg.Routes, r.addRoute, r.delRoute, r.logf) + newAddrs, err := cidrDiff("addr", r.addrs, cfg.LocalAddrs, r.addAddress, r.delAddress, r.logf) if err != nil { return err } - r.routes = newRoutes + r.addrs = newAddrs switch { case cfg.SNATSubnetRoutes == r.snatSubnetRoutes: