Removed IFF_NO_PI from TUN linux

This change was needed for the Linux TUN status hack
to work properly (not increment the error counter).

This commit also updates the TUN interface to allow for
the construction / removal of the TUN info headers in-place.
This commit is contained in:
Mathias Hall-Andersen
2017-12-04 21:39:06 +01:00
parent 9fef0ca2fb
commit 996c7c4d8a
4 changed files with 60 additions and 18 deletions
+4 -3
View File
@@ -127,8 +127,9 @@ func (device *Device) RoutineReadFromTUN() {
// read packet
elem.packet = elem.buffer[MessageTransportHeaderSize:]
size, err := device.tun.device.Read(elem.packet)
offset := MessageTransportHeaderSize
size, err := device.tun.device.Read(elem.buffer[:], offset)
if err != nil {
logError.Println("Failed to read packet from TUN device:", err)
device.Close()
@@ -139,7 +140,7 @@ func (device *Device) RoutineReadFromTUN() {
continue
}
elem.packet = elem.packet[:size]
elem.packet = elem.buffer[offset : offset+size]
// lookup peer