mirror of
https://github.com/DJSundog/wg-portal.git
synced 2024-11-23 07:03:50 -05:00
fix default mtu handling
This commit is contained in:
parent
6fd4089766
commit
ec60dd136a
@ -390,6 +390,9 @@ func (u *UserManager) validateOrCreateDevice(dev wgtypes.Device, ipAddresses []s
|
||||
device.Mtu = 0
|
||||
device.PersistentKeepalive = 16 // Default
|
||||
device.IPsStr = strings.Join(ipAddresses, ", ")
|
||||
if mtu == wireguard.WireGuardDefaultMTU {
|
||||
mtu = 0
|
||||
}
|
||||
device.Mtu = mtu
|
||||
|
||||
res := u.db.Create(&device)
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"github.com/milosgajdos/tenus"
|
||||
)
|
||||
|
||||
const WireGuardDefaultMTU = 1420
|
||||
|
||||
func (m *Manager) GetIPAddress() ([]string, error) {
|
||||
wgInterface, err := tenus.NewLinkFrom(m.Cfg.DeviceName)
|
||||
if err != nil {
|
||||
@ -107,7 +109,7 @@ func (m *Manager) SetMTU(mtu int) error {
|
||||
}
|
||||
|
||||
if mtu == 0 {
|
||||
mtu = 1420 // WireGuard default MTU
|
||||
mtu = WireGuardDefaultMTU
|
||||
}
|
||||
|
||||
if err := wgInterface.SetLinkMTU(mtu); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user