I don't know which one port is responsible for that: wireguard-2,1 wireguard-kmod-0.0.20220615 wireguard-tools-1.0.20210914_1 Problem: In config file I have: [Interface] ... MTU = 1400 When I start wireguard for the first time, wg0 interface has MTU 1460. But if I restart it one or more times, it set MTU correctly to 1400. Finally, each time when the server has restarted I need to restart wireguard one or more time by hands to make it set MTU to correct value. I use wireguard with kernel module.
Please also specify FreeBSD version and if possible paste the shell output when starting wireguard. It should output the ifconfig command it is using (most likely: ifconfig wg0 mtu 1400). https://git.zx2c4.com/wireguard-tools/tree/src/wg-quick/freebsd.bash#n183 Could be a bug/race condition in wg-quick and/or the kernel module.
13.1-RELEASE-p3 Right after server restarted: # ifconfig | grep wg0 wg0: flags=80c1<UP,RUNNING,NOARP,MULTICAST> metric 0 mtu 1460 # service wireguard restart [#] ifconfig wg0 destroy [#] ifconfig wg create name wg0 [#] wg setconf wg0 /dev/stdin [#] ifconfig wg0 inet 10.200.200.3/24 alias [#] ifconfig wg0 mtu 1400 [#] ifconfig wg0 up [#] route -q -n add -inet 10.10.10.0/24 -interface wg0 [+] Backgrounding route monitor # ifconfig | grep wg0 wg0: flags=80c1<UP,RUNNING,NOARP,MULTICAST> metric 0 mtu 1460 # service wireguard restart ... # ifconfig | grep wg0 wg0: flags=80c1<UP,RUNNING,NOARP,MULTICAST> metric 0 mtu 1400
Adding kevans@ probably he has an idea.
Sorry, this stalled a bit. wg(4) sets the mtu exactly twice: upon clone creation, and upon request with the ioctl. The ioctl apparently didn't fail, so it naturally happened after cloning succeeded and the MTU should've stuck without much of anything to race against. CC jhb@, maybe there's some other part of the stack that may fiddle with the MTU after the interface is created, but I don't think so...
Are there any ifconfig invocations in your PreUp/PostUp hooks?
(In reply to crest from comment #5) No. Here is config: [Interface] Address = 10.2.2.3/24 PrivateKey = *** MTU = 1400 [Peer] PublicKey = *** PresharedKey = *** AllowedIPs = 10.2.2.0/24 Endpoint = *.*.*.*:5555 PersistentKeepalive = 60