From bb3ae8b39beeb3aedf247add9153c1cd0e737938 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Fri, 23 Feb 2018 12:46:22 -0600 Subject: [PATCH] temporarily limit PMTU to 2048, as a workaround to some pathelogical behavior where a TCP stream carried over a UDP peer can throttle down to 0 in the presence of significant packet loss --- src/yggdrasil/session.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/yggdrasil/session.go b/src/yggdrasil/session.go index 47a4e987..5aeeacb6 100644 --- a/src/yggdrasil/session.go +++ b/src/yggdrasil/session.go @@ -152,6 +152,15 @@ func (ss *sessions) createSession(theirPermKey *boxPubKey) *sessionInfo { sinfo.myNonce = *newBoxNonce() sinfo.theirMTU = 1280 sinfo.myMTU = uint16(ss.core.tun.mtu) + if sinfo.myMTU > 2048 { + // FIXME this is a temporary workaround to an issue with UDP peers + // UDP links need to fragment packets (within ygg) to get them over the wire + // For some reason, TCP streams over UDP peers can get stuck in a bad state + // When this happens, TCP throttles back, and each TCP retransmission loses fragments + // On my wifi network, it seems to happen around the 22nd-23rd fragment of a large packet + // By setting the path MTU to something small, this should (hopefully) mitigate the issue + sinfo.myMTU = 2048 + } higher := false for idx := range ss.core.boxPub { if ss.core.boxPub[idx] > sinfo.theirPermPub[idx] {