Handle ICMP not permitted errors

This commit is contained in:
Quentin McGaw
2025-10-14 17:56:04 +00:00
parent 6c25ee53f1
commit 5428580b8f
5 changed files with 22 additions and 3 deletions

View File

@@ -120,10 +120,10 @@ func updateToMaxMTU(ctx context.Context, vpnInterface string,
vpnLinkMTU, err = pmtud.PathMTUDiscover(ctx, vpnGatewayIP, vpnLinkMTU, pingTimeout, logger)
switch {
case err == nil:
logger.Infof("Setting VPN interface %s MTU to maximum valid MTU %d", vpnInterface, vpnLinkMTU)
case errors.Is(err, pmtud.ErrMTUNotFound):
logger.Infof("setting VPN interface %s MTU to maximum valid MTU %d", vpnInterface, vpnLinkMTU)
case errors.Is(err, pmtud.ErrMTUNotFound) || errors.Is(err, pmtud.ErrICMPNotPermitted):
vpnLinkMTU = int(originalMTU)
logger.Infof("Reverting VPN interface %s MTU to %d (due to: %s)",
logger.Infof("reverting VPN interface %s MTU to %d (due to: %s)",
vpnInterface, originalMTU, err)
default:
return fmt.Errorf("path MTU discovering: %w", err)