aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tunnel/ifaceconfig.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-06-04 10:23:27 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-06-07 11:31:53 +0200
commita7a2e69d36176699e6381b48860582e06e40fccd (patch)
tree1ccfa18fe308915802346d46ccac6c20a8e3f4a6 /tunnel/ifaceconfig.go
parentui: remove hacks from confview (diff)
downloadwireguard-windows-a7a2e69d36176699e6381b48860582e06e40fccd.tar.xz
wireguard-windows-a7a2e69d36176699e6381b48860582e06e40fccd.zip
tunnel: don't fail on v6 family lookup unless using v6
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--tunnel/ifaceconfig.go30
1 files changed, 16 insertions, 14 deletions
diff --git a/tunnel/ifaceconfig.go b/tunnel/ifaceconfig.go
index a64a469b..2cc90e79 100644
--- a/tunnel/ifaceconfig.go
+++ b/tunnel/ifaceconfig.go
@@ -163,21 +163,23 @@ func configureInterface(conf *conf.Config, tun *tun.NativeTun) error {
}
ipif, err = luid.IPInterface(windows.AF_INET6)
- if err != nil {
- return err
- }
- if foundDefault6 {
- ipif.UseAutomaticMetric = false
- ipif.Metric = 0
- }
- if conf.Interface.MTU > 0 {
- ipif.NLMTU = uint32(conf.Interface.MTU)
- }
- ipif.DadTransmits = 0
- ipif.RouterDiscoveryBehavior = winipcfg.RouterDiscoveryDisabled
- err = ipif.Set()
- if err != nil {
+ if err != nil && firstGateway6 != nil {
+ log.Printf("Is IPv6 disabled by Windows?")
return err
+ } else if err == nil { // People seem to like to disable IPv6, so we make this non-fatal.
+ if foundDefault6 {
+ ipif.UseAutomaticMetric = false
+ ipif.Metric = 0
+ }
+ if conf.Interface.MTU > 0 {
+ ipif.NLMTU = uint32(conf.Interface.MTU)
+ }
+ ipif.DadTransmits = 0
+ ipif.RouterDiscoveryBehavior = winipcfg.RouterDiscoveryDisabled
+ err = ipif.Set()
+ if err != nil {
+ return err
+ }
}
err = luid.SetDNS(conf.Interface.DNS)