summaryrefslogtreecommitdiffhomepage
path: root/device.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-04-18 16:39:14 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-04-18 16:42:30 +0200
commit26a56a652eeeece7677ba4f1896da34c83930652 (patch)
tree27f4a4a2925287dd3087916a867b81882c806c93 /device.go
parent0b940a756838efcb90363ad99cb085d077b78e96 (diff)
Allow determining name
Diffstat (limited to 'device.go')
-rw-r--r--device.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/device.go b/device.go
index 79ec0b8..5adf33a 100644
--- a/device.go
+++ b/device.go
@@ -255,7 +255,15 @@ func NewDevice(tun TUNDevice, logger *Logger) *Device {
device.isClosed.Set(false)
device.log = logger
+
device.tun.device = tun
+ mtu, err := device.tun.device.MTU()
+ if err != nil {
+ logger.Error.Println("Trouble determining MTU, assuming 1420:", err)
+ mtu = 1420
+ }
+ device.tun.mtu = int32(mtu)
+
device.peers.keyMap = make(map[NoisePublicKey]*Peer)
// initialize anti-DoS / anti-scanning features