Skip to content

meshnet: set link MTU from the topology - #803

Open
kraney wants to merge 8 commits into
openconfig:mainfrom
kraney:meshnet-mtu
Open

kraney wants to merge 8 commits into
openconfig:mainfrom
kraney:meshnet-mtu

Conversation

@kraney

@kraney kraney commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

KNE ignored topo.Interface.mtu, so every meshnet link came up at the kernel default of 1500. Frames larger than that were dropped between pods, which breaks jumbo-frame tests.

This change passes the interface MTU from the KNE topology to meshnet, and meshnet sets it on both ends of every link.

Changes

  • CRD: adds an optional mtu field to the meshnet Topology link spec (Go type, meshnet base CRD, and manifests/meshnet/{grpc,vxlan}). The schema is structural, so without the CRD change the API server would drop the field.
  • KNE: GetNodeLinks and the Keysight node copy Interface.mtu into the link spec.
  • meshnet:
    • Both ends of a link get the same MTU: the larger of the two ends' requests. If neither end sets one, the daemon uses the new LINK_MTU env var, or leaves the kernel default when that isn't set either. Existing topologies are unchanged.
    • Same-node (veth) links are created with the MTU on both ends.
    • Cross-node gRPC links: each daemon sets the MTU of its own TAP. The daemon asked to create the far end looks the MTU up from its own Topology cache, so the wire protocol is unchanged.
    • Cross-node VXLAN links: best effort. The kernel caps a vxlan device at the node interface MTU minus about 50 bytes, so a jumbo MTU usually won't fit; meshnet then logs a warning and keeps the link at the default MTU.
    • The MTU is applied when an interface is created, not on every resync, so meshnet doesn't fight a NOS that sets the MTU of its own interfaces.
  • Docs: rewrites the MTU section of docs/performance_tuning.md.

Testing

  • Unit tests for LinkMTU, the Topology MTU lookups, and GetNodeLinks.
  • Netns tests (SetLinkMTU, veth MTU on both ends) pass under unshare -rnm.
  • go test passes for KNE topo/... and all of third_party/meshnet. golangci-lint reports no new issues.

Independent of #801; the two branches merge cleanly.

Add an optional mtu field to the Link of the meshnet Topology CRD (Go type and
the CRD schemas). The schema is structural, so without it the API server would
prune the field.

Part of b/577230109.
LinkMTU picks the MTU for both ends of a link: the larger of the two ends'
requests, else the LINK_MTU environment variable, else zero (kernel default).
SetLinkMTU sets the MTU of an interface in a pod network namespace.

Part of b/577230109.
meshnetd now applies the MTU from the Topology link spec. Both ends of a link
get the larger of the MTUs their two Link entries request, or LINK_MTU, or the
kernel default when neither is set, so existing topologies are unchanged.

- veth (same node): the pair is created with the MTU on both ends.
- gRPC (cross node): each daemon sets the MTU of its TAP; the daemon asked to
  create the remote end looks the MTU up from its own Topology cache, so the
  wire protocol is unchanged.
- VXLAN: the MTU is applied best effort, since the kernel caps a vxlan device
  at the node interface MTU less the encapsulation overhead.

MTUs are applied when an interface is created, not enforced on every resync,
so meshnetd does not fight a NOS that sets the MTU of its own interfaces.

Part of b/577230109.
Copy topo.Interface.mtu into the meshnet Topology link spec for every node,
including Keysight, so meshnet sets the MTU of the link.

Part of b/577230109.
@kraney
kraney requested review from bstoll and manizzzz November 3, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants