diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-08-04 00:35:00 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-08-04 00:36:38 +0200 |
commit | 8a2df8127df53f2bc7505600ce3c0e90b8cdf71d (patch) | |
tree | 7ef59270c3b11273a9652cf878c19ddc072ad81c | |
parent | conf: remove workaround for erroneous hasendpoint flag (diff) | |
download | wireguard-windows-8a2df8127df53f2bc7505600ce3c0e90b8cdf71d.tar.xz wireguard-windows-8a2df8127df53f2bc7505600ce3c0e90b8cdf71d.zip |
winipcfg: do not set MTU in registry after setting it in iphlpapi
This reverts commit 3f07aa3f0fcd1153687bfb442c0c5b674216d595.
Fixed for wgnt 0.3.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | tunnel/defaultroutemonitor.go | 4 | ||||
-rw-r--r-- | tunnel/winipcfg/types.go | 19 |
2 files changed, 2 insertions, 21 deletions
diff --git a/tunnel/defaultroutemonitor.go b/tunnel/defaultroutemonitor.go index ac4241c9..2a107fda 100644 --- a/tunnel/defaultroutemonitor.go +++ b/tunnel/defaultroutemonitor.go @@ -105,9 +105,7 @@ func monitorDefaultRoutes(family winipcfg.AddressFamily, binder conn.BindSocketT return err } - // Having one MTU for both v4 and v6 kind of breaks the Windows model, so right now this just gets the - // second one which looks bad. However, internally, it doesn't seem like the Windows stack differentiates - // anyway, so it's probably fine. + // Having one MTU for both v4 and v6 kind of breaks the Windows model, unfortunately. clamper.ForceMTU(int(iface.NLMTU)) lastMTU = mtu } diff --git a/tunnel/winipcfg/types.go b/tunnel/winipcfg/types.go index 7309067b..b06f05dd 100644 --- a/tunnel/winipcfg/types.go +++ b/tunnel/winipcfg/types.go @@ -11,7 +11,6 @@ import ( "unsafe" "golang.org/x/sys/windows" - "golang.org/x/sys/windows/registry" ) const ( @@ -676,23 +675,7 @@ func (row *MibIPInterfaceRow) get() error { // Set method sets the properties of an IP interface on the local computer. // https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-setipinterfaceentry func (row *MibIPInterfaceRow) Set() error { - err := setIPInterfaceEntry(row) - if err != nil { - return err - } - if row.NLMTU == 0 || row.InterfaceLUID == 0 { - return nil - } - guid, err := row.InterfaceLUID.GUID() - if err != nil { - return err - } - key, err := registry.OpenKey(registry.LOCAL_MACHINE, `SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\`+guid.String(), registry.SET_VALUE) - if err != nil { - return err - } - defer key.Close() - return key.SetDWordValue("MTU", row.NLMTU) + return setIPInterfaceEntry(row) } // get method returns all table rows as a Go slice. |