Skip to content
Snippets Groups Projects
Commit 948fe545 authored by Nik | Klampfradler's avatar Nik | Klampfradler
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
Branches master
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment