[Ns-bugs] [Bug 806] New: TCP doesn't work over a CSMA link
code@nsnam.ece.gatech.edu
code at nsnam.ece.gatech.edu
Thu Feb 4 10:02:50 PST 2010
http://www.nsnam.org/bugzilla/show_bug.cgi?id=806
Summary: TCP doesn't work over a CSMA link
Product: ns-3
Version: ns-3.7
Platform: All
OS/Version: All
Status: NEW
Severity: critical
Priority: P5
Component: internet-stack
AssignedTo: ns-bugs at isi.edu
ReportedBy: wdr at bell-labs.com
Estimated Hours: 0.0
Basically, TCP does not work over a CSMA link. Period.
The problem: In 3.7, csma_net_device.cc enforces the rule that e'net packets
must have a minimum of 46 bytes of payload. It does so by padding short packets
with zeros.
This shouldn't be a problem, because the IP header has a length field, so the
stack should just ignore the extra padding. However, when the IP layer removes
the IP header from the packet and passes the remainder on to the TCP layer, the
IP layer doesn't pass the payload length to TCP. Instead, TCP assumes
everything left in the packet is valid data.
The result: when one end sends a simple ACK (40 bytes of IP+TCP headers, no
application data), CSMA appends 6 bytes of zeros. The TCP stack on the other
end assumes those 6 bytes are application data, and tries to pass them up to
the application on its end. The result is much confusion.
One solution: When the IP layer strips the IP header from a packet, if the
resulting packet size is greater than the payload length, the IP layer could
remove the extra bytes from the end of the packet.
I don't know all the places that's necessary, but one is in
Ipv4L3Protocol::Receive() in ipv4-l3-protocol.cc. To test, I added the
following after the RemoveHeader() call:
// Existing code -- line 459 in ipv4-l3-protocol.cc, 3.7 Stable:
packet->RemoveHeader (ipHeader);
// Added:
if (ipHeader.GetPayloadSize () < packet->GetSize ())
{
packet->RemoveAtEnd (packet->GetSize () - ipHeader.GetPayloadSize ());
}
After that, TCP worked properly over a CSMA link.
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Ns-bugs
mailing list