tun_windows: Stop checking minimum size of received TUN packets

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-02-06 20:22:04 +01:00
parent 73df1c0871
commit 46279ad0f9

View File

@ -15,7 +15,6 @@ import (
) )
const ( const (
TUN_MIN_PACKET_SIZE = 20
TUN_MAX_PACKET_SIZE = 1600 TUN_MAX_PACKET_SIZE = 1600
TUN_MAX_PACKET_EXCHANGE = 256 // Number of packets that can be exchanged at a time TUN_MAX_PACKET_EXCHANGE = 256 // Number of packets that can be exchanged at a time
TUN_EXCHANGE_BUFFER_SIZE = 410632 TUN_EXCHANGE_BUFFER_SIZE = 410632
@ -176,7 +175,7 @@ func (tun *nativeTun) Read(buff []byte, offset int) (int, error) {
tunPacket := &tun.rdBuff.packets[tun.rdNextPacket] tunPacket := &tun.rdBuff.packets[tun.rdNextPacket]
tun.rdNextPacket++ tun.rdNextPacket++
if tunPacket.size < TUN_MIN_PACKET_SIZE || TUN_MAX_PACKET_SIZE < tunPacket.size { if TUN_MAX_PACKET_SIZE < tunPacket.size {
// Invalid packet size. // Invalid packet size.
continue continue
} }