]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/govpn/common.go
Allow 9000 MTUs on TAP interfaces, consider Ethernet header size
[govpn.git] / src / govpn / common.go
index fbafd56ab680de6afc61eb50f41890e1ed1babfc..d3f8ec04a595ad62cf960ccfd1ca70310411212f 100644 (file)
@@ -1,6 +1,6 @@
 /*
 GoVPN -- simple secure free software virtual private network daemon
-Copyright (C) 2014-2015 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2014-2016 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -27,10 +27,12 @@ import (
 
 const (
        TimeoutDefault = 60
+       EtherSize      = 14
+       MTUMax         = 9000 + EtherSize
+       MTUDefault     = 1500 + EtherSize
 )
 
 var (
-       MTU     int
        Version string
 )
 
@@ -52,10 +54,10 @@ func ScriptCall(path, ifaceName string) ([]byte, error) {
        return out, err
 }
 
-// Zero each byte
-func sliceZero(data []byte) {
+// Zero each byte.
+func SliceZero(data []byte) {
        for i := 0; i < len(data); i++ {
-               data[i] = '\x00'
+               data[i] = 0
        }
 }