[Ns-developers] Csma, ethernet length field, NSC and the link mtu...
Florian Westphal
fw at strlen.de
Tue Jul 22 16:08:46 PDT 2008
Hello ns-3 developers,
i'm currently writing a few ns-3 simulations to
demonstrate some of NSCs features.
I have encountered the following problem:
In my script[1], i'm building a simple csma network with a few TCP flows.
Now, all the trace files look bogus when viewed with tools like
tcpdump or wiresharhark, that is, I often see 'Ethernet 2 Frames'
without tcpdump or wireshark decoding the next protocol header.
The problem is that the MTU that is currently hardcoded
to 1500 byte in nsc is too large.
(I'd like to use the actual device MTU, but ->GetMtu()
just returns 0xFFFF...)
Now, length values are not allowed to exceed 1500 bytes
when a 802.3 LLC header is added (Values above are reserved for
Type-Ids).
Now, i worked around this by hardcoding an MTU of 1482.
This still looked strange to me, as this would not show
1514 bytes for the whole ethernet packet, as i expected.
So, i took a look at the csma code.
In CsmaNetDevice::AddHeader we have this:
case LLC: {
lengthType = p->GetSize () + header.GetSerializedSize () +
trailer.GetSerializedSize ();
LlcSnapHeader llc;
llc.SetType (protocolNumber);
p->AddHeader (llc);
} break;
This looks bogus -- Why is the LLC header size ignored?
And is the ethernet header really expected to be accounted for in the length field?
Also, could we add an NS_ASSERT in there that checks that the length is <= 1500 inside
the LLC label?
If I replace that header.GetSerializedSize() with an llc.GetSerializedSize()
the tcpdump/wireshark outputs look much saner to me, i.e.
I see an 1514 byte ethernet frame with a length field of 1500.
Of course this doesn't solve my actual problem, namely
how do I avoid hardcoding MTU values in the nsc glue?
Thoughts?
Regards, Florian
[1] http://strlen.de/fw/tcp-nsc-zoo.cc
--
Florian Westphal <fw at strlen.de> // http://www.strlen.de
1024D/F260502D 2005-10-20
Key fingerprint = 1C81 1AD5 EA8F 3047 7555 E8EE 5E2F DA6C F260 502D
More information about the Ns-developers
mailing list