chore(pmtud): clarify debug logs and fix log error message

This commit is contained in:
Quentin McGaw
2026-02-25 04:07:27 +00:00
parent d21953f62e
commit 0eeee5c496
2 changed files with 13 additions and 7 deletions
+9 -3
View File
@@ -13,7 +13,10 @@ import (
"github.com/qdm12/gluetun/internal/pmtud/tcp"
)
var ErrPMTUDFailICMPAndTCP = errors.New("PMTUD succeeded with ICMP but failed with TCP")
var (
ErrICMPOkTCPFail = errors.New("PMTUD succeeded with ICMP but failed with TCP")
ErrICMPFailTCPFail = errors.New("PMTUD failed with both ICMP and TCP")
)
// PathMTUDiscover discovers the maximum MTU using both ICMP and TCP.
// Multiple ICMP addresses and TCP addresses can be specified for redundancy.
@@ -77,8 +80,11 @@ func PathMTUDiscover(ctx context.Context, icmpAddrs []netip.Addr, tcpAddrs []net
return maxPossibleMTU, nil // only rely on ICMP PMTUD results
}
}
return 0, fmt.Errorf("%w - ignoring ICMP obtained MTU %d",
ErrPMTUDFailICMPAndTCP, maxPossibleMTU)
if icmpSuccess {
return 0, fmt.Errorf("%w - discarding ICMP obtained MTU %d",
ErrICMPOkTCPFail, maxPossibleMTU)
}
return 0, fmt.Errorf("%w", ErrICMPFailTCPFail)
}
logger.Debugf("TCP path MTU discovery found maximum valid MTU %d", mtu)
return mtu, nil