Improve logging in case of ICMP blocked
This commit is contained in:
@@ -119,14 +119,16 @@ func updateToMaxMTU(ctx context.Context, vpnInterface string,
|
|||||||
|
|
||||||
const pingTimeout = time.Second
|
const pingTimeout = time.Second
|
||||||
vpnLinkMTU, err = pmtud.PathMTUDiscover(ctx, serverIP, vpnLinkMTU, pingTimeout, logger)
|
vpnLinkMTU, err = pmtud.PathMTUDiscover(ctx, serverIP, vpnLinkMTU, pingTimeout, logger)
|
||||||
if err != nil {
|
switch {
|
||||||
if errors.Is(err, pmtud.ErrMTUNotFound) {
|
case err == nil:
|
||||||
const conservativeMTU = 1300
|
logger.Infof("Setting VPN interface %s MTU to maximum valid MTU %d", vpnInterface, vpnLinkMTU)
|
||||||
vpnLinkMTU = conservativeMTU
|
case errors.Is(err, pmtud.ErrMTUNotFound):
|
||||||
logger.Debugf("using a conservative MTU of %d (%s)", conservativeMTU, err)
|
const conservativeMTU = 1300
|
||||||
} else {
|
vpnLinkMTU = conservativeMTU
|
||||||
return fmt.Errorf("path MTU discovering: %w", err)
|
logger.Infof("Setting VPN interface %s MTU to a conservative MTU of %d (due to: %s)",
|
||||||
}
|
vpnInterface, conservativeMTU, err)
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("path MTU discovering: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = netlinker.LinkSetMTU(link, vpnLinkMTU)
|
err = netlinker.LinkSetMTU(link, vpnLinkMTU)
|
||||||
@@ -134,6 +136,5 @@ func updateToMaxMTU(ctx context.Context, vpnInterface string,
|
|||||||
return fmt.Errorf("setting VPN interface %s MTU to %d: %w", vpnInterface, vpnLinkMTU, err)
|
return fmt.Errorf("setting VPN interface %s MTU to %d: %w", vpnInterface, vpnLinkMTU, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Infof("VPN interface %s MTU set to maximum valid MTU %d", vpnInterface, vpnLinkMTU)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user