Skip to content

Commit

Permalink
pkg: Do not set MTU greater than 1450 for VXLAN
Browse files Browse the repository at this point in the history
MTU of a VXLAN interface in a pod VM becomes greater than 1450,
which is the maximum allowed size for VxLAN packets, when a CNI
plugin such as Calico IPIP uses a MTU greater than 1450. This may
cause undesirable packet fragmentation. This patch fixes the issue.

Fixes confidential-containers#67

Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
  • Loading branch information
yoheiueda authored and bpradipt committed Jul 1, 2022
1 parent dfe40ba commit 8db5ee9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/podnetwork/tunneler/vxlan/podnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

const (
podVxlanInterface = "vxlan0"
maxMTU = 1450
)

type podNodeTunneler struct {
Expand Down Expand Up @@ -64,6 +65,9 @@ func (t *podNodeTunneler) Setup(nsPath string, podNodeIPs []net.IP, config *tunn
}

mtu := int(config.MTU)
if mtu > maxMTU {
mtu = maxMTU
}
if err := podNS.SetMTU(podVxlanInterface, mtu); err != nil {
return fmt.Errorf("failed to set MTU of %s to %d on %s: %w", podVxlanInterface, mtu, nsPath, err)
}
Expand Down

0 comments on commit 8db5ee9

Please sign in to comment.