wg-quick set_mtu_up - largest or smallest MTU?

M P Robert mprobert at gmail.com
Fri Nov 3 13:12:30 UTC 2023


I was looking at the auto MTU detection in wg-quick.

It appears that wg-quick is taking the LARGEST of all endpoint MTUs

https://github.com/WireGuard/wireguard-tools/blob/13f4ac4cb74b5a833fa7f825ba785b1e5774e84f/src/wg-quick/linux.bash#L134

In a scenario where you have different peers on different network devices or routes with different MTUs, I would think you would want to take the SMALLEST mtu from all peers in order to avoid having fragmentation talking to the peers on networks with smaller MTUs.

Or perhaps fragmentation for some peers is faster than selecting a smaller packet size for all peers?  Or I am missing something (more likely).  Happy to be educated on this point.

I don't have git-send-email setup at this point, but just in case this is a valid issue, I've attached a sample fix for set_mtu_up that will take the smallest of the discovered peer MTUs rather than the largest.  I'm not a bash guy, so just take it for illustration purposes.

Thanks!

-Matt


-------------- next part --------------
A non-text attachment was scrubbed...
Name: wg-quick.set_mtu_up.sh
Type: application/octet-stream
Size: 912 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20231103/47e972c9/attachment.obj>
-------------- next part --------------




More information about the WireGuard mailing list