mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-10 04:30:20 +02:00
hotfix(pmtud/tcp): return an error if no MSS destination server worked
This commit is contained in:
@@ -12,6 +12,8 @@ import (
|
|||||||
"github.com/qdm12/gluetun/internal/pmtud/ip"
|
"github.com/qdm12/gluetun/internal/pmtud/ip"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var errTCPServersUnreachable = errors.New("all TCP servers are unreachable")
|
||||||
|
|
||||||
// findHighestMSSDestination finds the destination with the highest
|
// findHighestMSSDestination finds the destination with the highest
|
||||||
// MSS amongst the provided destinations.
|
// MSS amongst the provided destinations.
|
||||||
func findHighestMSSDestination(ctx context.Context, familyToFD map[int]fileDescriptor,
|
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
|
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",
|
logger.Debugf("server %s has the highest MSS %d allowing to test the MTU up to %d",
|
||||||
dst, mss, maxPossibleMTU)
|
dst, mss, maxPossibleMTU)
|
||||||
|
|||||||
Reference in New Issue
Block a user