fix mtu to not overflow uint16

This commit is contained in:
dovholuknf
2020-07-31 11:38:00 -04:00
parent 00d862f996
commit 7bf7fb77da
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -259,12 +259,12 @@ func setTunInfo(s *dto.TunnelStatus, ipv4 string, ipv4mask int) {
log.Errorf("error reading MTU - using 0 for MTU: (%v)", err)
mtu = 0
}
umtu := uint16(mtu)
//set the tun info into the state
s.IpInfo = &dto.TunIpInfo{
Ip: ipv4,
DNS: Ipv4dns,
MTU: uint16(mtu),
MTU: umtu,
Subnet: ipv4MaskString(ipnet.Mask),
}
}
+1 -1
View File
@@ -120,7 +120,7 @@ func (t *RuntimeState) CreateTun(ipv4 string, ipv4mask int) error {
}
log.Infof("creating TUN device: %s", TunName)
tunDevice, err := tun.CreateTUN(TunName, 64*1024)
tunDevice, err := tun.CreateTUN(TunName, 64*1024 - 1)
if err == nil {
t.tun = &tunDevice
tunName, err2 := tunDevice.Name()