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

Development discussion of WireGuard

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ http://inbox.vuxu.org/wireguard \
		wireguard@lists.zx2c4.com
	public-inbox-index wireguard

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.wireguard


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git