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 <christina@tailscale.com>

Co-authored-by: Christina Wen <christina@tailscale.com>
This commit is contained in:
Christina Wen 2020-09-15 14:14:33 -04:00 committed by GitHub
parent 761fe19e5f
commit e862f90e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,18 +173,18 @@ func (r *linuxRouter) Set(cfg *Config) error {
return err
}
newAddrs, err := cidrDiff("addr", r.addrs, cfg.LocalAddrs, r.addAddress, r.delAddress, r.logf)
if err != nil {
return err
}
r.addrs = newAddrs
newRoutes, err := cidrDiff("route", r.routes, cfg.Routes, r.addRoute, r.delRoute, r.logf)
if err != nil {
return err
}
r.routes = newRoutes
newAddrs, err := cidrDiff("addr", r.addrs, cfg.LocalAddrs, r.addAddress, r.delAddress, r.logf)
if err != nil {
return err
}
r.addrs = newAddrs
switch {
case cfg.SNATSubnetRoutes == r.snatSubnetRoutes:
// state already correct, nothing to do.