[RFC PATCH 0/4] Introduce per-peer MTU setting

leon at is.currently.online leon at is.currently.online
Tue Dec 28 23:45:21 UTC 2021

From: Leon Schuermann <leon at is.currently.online>

This patch series is an attempt to integrate a per-peer MTU setting
into WireGuard. With matching changes to the wireguard-tools,
individual MTU values can be set and retrieved for each registered

While Linux supports setting an MTU metric for specific FIB route
entries [which I've only found out after implementing this :)], and
thus allows to lower the MTU for individual peers, this appears to
disable regular path MTU discovery (PMTUD) entirely on the
route. While regular PMTUD does not work over the tunnel link, it
should still be usable on the rest of the route.

Furthermore, with the goal of eventually introducing an in-band
per-peer PMTUD mechanism, keeping an internal per-peer MTU value does
not require modifying the FIB and thus potentially interfere with

In an effort to solve this issues, this patch series introduces a
rather generic framework for implementing these kinds of dynamic MTU
policies. By providing a hook in the netdevice implementation to
decide on the applicable MTU, very flexible designs can be built. I
suppose that these changes are rather controversial, or at least
require some more discussion. I'm sending this patchset to the
WireGuard development list in hopes to get some initial feedback on
the idea and implementation and would like to eventually submit the
non-WireGuard changes directly to the netdev ML.

The patches are currently based on v5.10, as that happens to be
what I was developing on. I'll gladly rebase to the latest
revision / wireguard-devel if requested.



Leon Schuermann (4):
  netdevice: add ndo_lookup_mtu for dynamically determining MTU
  net/ipv4: respect MTU determined by `ndo_lookup_mtu`
  net/ipv6: respect MTU determined by `ndo_lookup_mtu`
  net/wireguard: add per-peer MTU setting

 drivers/net/wireguard/allowedips.c |  2 +-
 drivers/net/wireguard/allowedips.h |  2 +-
 drivers/net/wireguard/device.c     | 20 ++++++++++++++++--
 drivers/net/wireguard/netlink.c    |  8 +++++++
 drivers/net/wireguard/peer.c       |  1 +
 drivers/net/wireguard/peer.h       |  1 +
 drivers/net/wireguard/queueing.h   |  2 +-
 include/linux/netdevice.h          | 12 +++++++++++
 include/net/ip.h                   | 34 ++++++++++++++++++++++--------
 include/net/ip6_route.h            | 14 ++++++++++--
 include/uapi/linux/wireguard.h     |  5 +++++
 net/ipv4/ip_forward.c              |  2 +-
 net/netfilter/nf_flow_table_core.c |  2 +-
 13 files changed, 87 insertions(+), 18 deletions(-)

base-commit: 2c85ebc57b3e1817b6ce1a6b703928e113a90442

More information about the WireGuard mailing list