Commit 948fe545 authored by Dominik George's avatar Dominik George 🍻
Browse files

Allocate 22 bytes for Ethernet frame header in case we are handling

VLAN-tagged frames. We need to allocate the bytes before even knowing if
the frame we receive will in fact contain VLAN headers.
parent 56c39292
......@@ -86,13 +86,12 @@ class TapDevice:
'''
# In TUN-Mode a TUN-Header has to be added which is 4 bytes in size
# In TAP-Mode the ethernet frame has to be added which is 18 bytes large
# FIXME: handle the case, where Linux VLAN is enabled and another 4
# 4 bytes have to be added to the ethernet frame's size
# In TAP-Mode the ethernet frame has to be added which is 22 bytes
# (18 bytes ethernet frame header + 4 bytes possible VLAN ID) large
if self.mode == IFF_TUN:
data = os.read(self.__fd__, self.__mtu__ + 4)
data = os.read(self.__fd__, self.mtu + 4)
elif self.mode == IFF_TAP:
data = os.read(self.__fd__, self.__mtu__ + 18)
data = os.read(self.__fd__, self.mtu + 22)
return data
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment