diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-06-28 23:45:45 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-06-28 23:45:45 +0200 |
commit | 1f0976a26c1d0a6b5eb2c0aa993f12d89f96eed2 (patch) | |
tree | 36771e8468214583a5c3f3441b36662c4108a58c /src/tun_linux.go | |
parent | 8236f3afa2eca0aae6c5da9560301c04d882c81b (diff) |
Work on UAPI
Cross-platform API (get operation)
Handshake initiation creation process
Outbound packet flow
Fixes from code-review
Diffstat (limited to 'src/tun_linux.go')
-rw-r--r-- | src/tun_linux.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/tun_linux.go b/src/tun_linux.go index d545dfa..cbbcb70 100644 --- a/src/tun_linux.go +++ b/src/tun_linux.go @@ -9,9 +9,7 @@ import ( "unsafe" ) -/* Platform dependent functions for interacting with - * TUN devices on linux systems - * +/* Implementation of the TUN device interface for linux */ const CloneDevicePath = "/dev/net/tun" @@ -45,7 +43,7 @@ func (tun *NativeTun) Read(d []byte) (int, error) { return tun.fd.Read(d) } -func CreateTUN(name string) (TUN, error) { +func CreateTUN(name string) (TUNDevice, error) { // Open clone device fd, err := os.OpenFile(CloneDevicePath, os.O_RDWR, 0) if err != nil { @@ -53,7 +51,7 @@ func CreateTUN(name string) (TUN, error) { } // Prepare ifreq struct - var ifr [18]byte + var ifr [128]byte var flags uint16 = IFF_TUN | IFF_NO_PI nameBytes := []byte(name) if len(nameBytes) >= IFNAMSIZ { |