diff options
Diffstat (limited to '')
-rw-r--r-- | tunnel/winipcfg/types.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tunnel/winipcfg/types.go b/tunnel/winipcfg/types.go index b06f05dd..7309067b 100644 --- a/tunnel/winipcfg/types.go +++ b/tunnel/winipcfg/types.go @@ -11,6 +11,7 @@ import ( "unsafe" "golang.org/x/sys/windows" + "golang.org/x/sys/windows/registry" ) const ( @@ -675,7 +676,23 @@ 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 { - return setIPInterfaceEntry(row) + 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) } // get method returns all table rows as a Go slice. |