read() returns too few data (TAP-mode: MTU != Ethernet Frame Size)

Bug #770492 reported by Stefan Braun
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyTap
Fix Committed
High
Dominik George

Bug Description

In TAP-Mode I had the problem that larger Ping packets and TCP connections after establishing didn't work over TAP<->pytap<->MyTestScript<->pytap<->TAP.

I found the problem in the read()-method of pytap.py. This code works in TAP-mode (I don't know the consequences in TUN-mode):
...
ETHERNET_HEADER_SIZE = 18
...
def read(self):
        data = os.read(self.__fd__, self.mtu + ETHERNET_HEADER_SIZE)
        return data

According to http://de.wikipedia.org/wiki/Maximum_Transmission_Unit#Beispiel_Ethernet and
http://de.wikipedia.org/w/index.php?title=Datei:Ethernetpaket.svg&filetimestamp=20090225134531
the Ethernet frame size is 18 Byte longer than the MTU (with activated VLAN it's 22 Bytes longer, but in Linux VLAN isn't activated as default).

Files:
Modified pytap.py: http://pastebin.com/gMB8zUfj
My current test project (Ethernet-tunnel via TCP): http://pastebin.com/SLpeRngY

summary: - read() returns too few data (MTU != Ethernet Frame Size)
+ read() returns too few data (TAP-Mode: MTU != Ethernet Frame Size)
description: updated
summary: - read() returns too few data (TAP-Mode: MTU != Ethernet Frame Size)
+ read() returns too few data (TAP-mode: MTU != Ethernet Frame Size)
Revision history for this message
Dominik George (natureshadow) wrote :

Thank you for the report, Stefan.

(Unfortunately Launchpad doesn't e-mail me on new bug reports anymore so I didn't see this earlier ....).

I have implemented a fix that only affects TAP mode, becuase TUN moder is not affected by this.

Please note that development has moved to http://git.proparity.net/redmine/projects/pytap .

Changed in pytap:
assignee: nobody → Dominik George (natureshadow)
importance: Undecided → High
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.