diff --git a/internal/pmtud/tcp/mss.go b/internal/pmtud/tcp/mss.go index a8abe208..ea9b751b 100644 --- a/internal/pmtud/tcp/mss.go +++ b/internal/pmtud/tcp/mss.go @@ -12,6 +12,8 @@ import ( "github.com/qdm12/gluetun/internal/pmtud/ip" ) +var errTCPServersUnreachable = errors.New("all TCP servers are unreachable") + // findHighestMSSDestination finds the destination with the highest // MSS amongst the provided destinations. func findHighestMSSDestination(ctx context.Context, familyToFD map[int]fileDescriptor, @@ -65,6 +67,10 @@ func findHighestMSSDestination(ctx context.Context, familyToFD map[int]fileDescr } } + if mss == 0 { // no MSS found for any destination + return netip.AddrPort{}, 0, fmt.Errorf("%w (%d servers)", errTCPServersUnreachable, len(dsts)) + } + maxPossibleMTU = ip.HeaderLength(dst.Addr().Is4()) + constants.BaseTCPHeaderLength + mss logger.Debugf("server %s has the highest MSS %d allowing to test the MTU up to %d", dst, mss, maxPossibleMTU)