diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-17 22:54:59 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-18 11:39:38 +0200 |
commit | 96e5d80a3e8c2b874b321bc5918971f8ea63d2c6 (patch) | |
tree | 71ca822435f2f0941b9969a9583cd1d07320f6a3 /tunnel/addressconfig.go | |
parent | global: go fmt for 1.17 build tags (diff) | |
download | wireguard-windows-96e5d80a3e8c2b874b321bc5918971f8ea63d2c6.tar.xz wireguard-windows-96e5d80a3e8c2b874b321bc5918971f8ea63d2c6.zip |
tunnel: support turning off automatic routing table
This supports the familiar "Table = off" syntax as on Linux, and then
interprets other valid values as simply "on".
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r-- | tunnel/addressconfig.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tunnel/addressconfig.go b/tunnel/addressconfig.go index 44bfd8ae..0dec95d0 100644 --- a/tunnel/addressconfig.go +++ b/tunnel/addressconfig.go @@ -138,9 +138,11 @@ func configureInterface(family winipcfg.AddressFamily, conf *conf.Config, tun *t deduplicatedRoutes = append(deduplicatedRoutes, &routes[i]) } - err = luid.SetRoutesForFamily(family, deduplicatedRoutes) - if err != nil { - return err + if !conf.Interface.TableOff { + err = luid.SetRoutesForFamily(family, deduplicatedRoutes) + if err != nil { + return err + } } ipif, err := luid.IPInterface(family) @@ -174,7 +176,7 @@ func configureInterface(family winipcfg.AddressFamily, conf *conf.Config, tun *t func enableFirewall(conf *conf.Config, tun *tun.NativeTun) error { doNotRestrict := true - if len(conf.Peers) == 1 { + if len(conf.Peers) == 1 && !conf.Interface.TableOff { nextallowedip: for _, allowedip := range conf.Peers[0].AllowedIPs { if allowedip.Cidr == 0 { |