diff --git a/internal/configuration/settings/wireguard.go b/internal/configuration/settings/wireguard.go index c861e8e5..3edf133d 100644 --- a/internal/configuration/settings/wireguard.go +++ b/internal/configuration/settings/wireguard.go @@ -45,6 +45,7 @@ type Wireguard struct { // It has been lowered to 1320 following quite a bit of // investigation in the issue: // https://github.com/qdm12/gluetun/issues/2533. + // Note this should now be replaced with the PMTUD feature. MTU uint16 `json:"mtu"` // Implementation is the Wireguard implementation to use. // It can be "auto", "userspace" or "kernelspace". diff --git a/internal/vpn/tunnelup.go b/internal/vpn/tunnelup.go index 966f6f9a..ec0c4c22 100644 --- a/internal/vpn/tunnelup.go +++ b/internal/vpn/tunnelup.go @@ -95,6 +95,8 @@ func updateToMaxMTU(ctx context.Context, vpnInterface string, return fmt.Errorf("getting VPN interface by name: %w", err) } + originalMTU := link.MTU + // Note: no point testing for an MTU of 1500, it will never work due to the VPN // protocol overhead, so start lower than 1500 according to the protocol used. const physicalLinkMTU = 1500 @@ -123,10 +125,9 @@ func updateToMaxMTU(ctx context.Context, vpnInterface string, case err == nil: logger.Infof("Setting VPN interface %s MTU to maximum valid MTU %d", vpnInterface, vpnLinkMTU) case errors.Is(err, pmtud.ErrMTUNotFound): - const conservativeMTU = 1300 - vpnLinkMTU = conservativeMTU - logger.Infof("Setting VPN interface %s MTU to a conservative MTU of %d (due to: %s)", - vpnInterface, conservativeMTU, err) + vpnLinkMTU = int(originalMTU) + logger.Infof("Reverting VPN interface %s MTU to %d (due to: %s)", + vpnInterface, originalMTU, err) default: return fmt.Errorf("path MTU discovering: %w", err) }