Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #5997: Use 65000 MTU upper bound for interfaces in encap mode #6006

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ const (
roundNumKey = "roundNum" // round number key in externalIDs.
initialRoundNum = 1
maxRetryForRoundNumSave = 5
// On Linux, OVS configures the MTU for tunnel interfaces to 65000.
// See https://github.com/openvswitch/ovs/blame/3e666ba000b5eff58da8abb4e8c694ac3f7b08d6/lib/dpif-netlink-rtnl.c#L348-L360
// There are some edge cases (e.g., Kind clusters) where the transport Node's MTU may be
// larger than that (e.g., 65535), and packets may be dropped. To account for this, we use
// 65000 as an upper bound for the MTU calculated in getInterfaceMTU, when encap is
// supported. For simplicity's sake, we also use this upper bound for Windows, even if it
// does not apply.
ovsTunnelMaxMTU = 65000
)

var (
Expand Down Expand Up @@ -1200,6 +1208,11 @@ func (i *Initializer) getInterfaceMTU(transportInterface *net.Interface) (int, e

isIPv6 := i.nodeConfig.NodeIPv6Addr != nil
mtu -= i.networkConfig.CalculateMTUDeduction(isIPv6)
if i.networkConfig.TrafficEncapMode.SupportsEncap() {
// See comment for ovsTunnelMaxMTU constant above.
mtu = min(mtu, ovsTunnelMaxMTU)
}

return mtu, nil
}

Expand Down
Loading