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:
+4
-3
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user