Fallback on 1320 if ICMP is blocked

This commit is contained in:
Quentin McGaw
2025-10-03 13:55:59 +00:00
parent 5b1dc295fe
commit ccc2f306b9
3 changed files with 26 additions and 32 deletions

View File

@@ -120,7 +120,13 @@ func updateToMaxMTU(ctx context.Context, vpnInterface string,
const pingTimeout = time.Second
vpnLinkMTU, err = pmtud.PathMTUDiscover(ctx, serverIP, vpnLinkMTU, pingTimeout, logger)
if err != nil {
return fmt.Errorf("path MTU discovering: %w", err)
if errors.Is(err, pmtud.ErrMTUNotFound) {
const conservativeMTU = 1300
vpnLinkMTU = conservativeMTU
logger.Debugf("using a conservative MTU of %d (%s)", conservativeMTU, err)
} else {
return fmt.Errorf("path MTU discovering: %w", err)
}
}
err = netlinker.LinkSetMTU(link, vpnLinkMTU)