Development discussion of WireGuard
 help / color / mirror / Atom feed
* Windows: wintun MTU is not set
@ 2021-03-10 13:36 kay
  2021-03-10 14:02 ` Jason A. Donenfeld
  0 siblings, 1 reply; 3+ messages in thread
From: kay @ 2021-03-10 13:36 UTC (permalink / raw)
  To: wireguard

Hi Everyone,

I noticed that the desired MTU is not set on the wintun interface.

I tried to set MTU after I create an interface:

        interfaces, err := winipcfg.GetIPInterfaceTable(windows.AF_UNSPEC)
        if err != nil {
                return err
        }
        for _, iface := range interfaces {
                if iface.InterfaceLUID == luid {
                        log.Printf("Iface: %+#v", iface)
                        iface.NLMTU = 1302
                        err = iface.Set()
                        if err != nil {
                                log.Printf("failed to set MTU: %s", err)
                        }
                }
        }

but it fails with "The parameter is incorrect." for AF_INET. Setting
MTU for AF_INET6 works with no issues.

Any idea how I can set MTU without netsh?

Regards,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Windows: wintun MTU is not set
  2021-03-10 13:36 Windows: wintun MTU is not set kay
@ 2021-03-10 14:02 ` Jason A. Donenfeld
  2021-03-10 14:13   ` kay
  0 siblings, 1 reply; 3+ messages in thread
From: Jason A. Donenfeld @ 2021-03-10 14:02 UTC (permalink / raw)
  To: kay; +Cc: WireGuard mailing list

Try using the object returned by luid.IPInterface(windows.AF_INET). Or
in your example, use AF_INET instead of AF_UNSPEC.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Windows: wintun MTU is not set
  2021-03-10 14:02 ` Jason A. Donenfeld
@ 2021-03-10 14:13   ` kay
  0 siblings, 0 replies; 3+ messages in thread
From: kay @ 2021-03-10 14:13 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: WireGuard mailing list

Thanks. The following code worked for me:

        luid := winipcfg.LUID(tun.LUID())
        iface, err := luid.IPInterface(windows.AF_INET)
        if err != nil {
                return err
        }
        iface.NLMTU = 1302
        err = iface.Set()
        if err != nil {
                return fmt.Errorf("failed to set MTU: %s", err)
        }

On Wed, Mar 10, 2021 at 3:03 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> Try using the object returned by luid.IPInterface(windows.AF_INET). Or
> in your example, use AF_INET instead of AF_UNSPEC.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-10 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 13:36 Windows: wintun MTU is not set kay
2021-03-10 14:02 ` Jason A. Donenfeld
2021-03-10 14:13   ` kay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).