--- a/RELEASE_NOTES Thu May 12 14:13:48 2011 -0700
+++ b/RELEASE_NOTES Thu May 12 21:19:07 2011 -0700
@@ -72,6 +72,7 @@
- bug 1038 - Time::Get*Seconds () return signed integer while actually returning unsigned
- bug 445 - Is the class name Scalar in nstime.h appropriate?
- bug 1044 - Seconds (1e-9) creates Time that is not IsPositive ()
+ - bug 1056 - CSMA: padding not handled correctly for LLC encapsulation
Known issues
------------
--- a/src/csma/model/csma-net-device.cc Thu May 12 14:13:48 2011 -0700
+++ b/src/csma/model/csma-net-device.cc Thu May 12 21:19:07 2011 -0700
@@ -322,6 +322,13 @@
p->AddHeader (llc);
//
+ // This corresponds to the length interpretation of the lengthType
+ // field but with an LLC/SNAP header added to the payload as in
+ // IEEE 802.2
+ //
+ lengthType = p->GetSize ();
+
+ //
// All Ethernet frames must carry a minimum payload of 46 bytes. The
// LLC SNAP header counts as part of this payload. We need to padd out
// if we don't have enough bytes. These must be real bytes since they
@@ -335,12 +342,7 @@
p->AddAtEnd (padd);
}
- //
- // This corresponds to the length interpretation of the lengthType field,
- // but with an LLC/SNAP header added to the payload as in IEEE 802.2
- //
- lengthType = p->GetSize ();
- NS_ASSERT_MSG (lengthType <= GetMtu (),
+ NS_ASSERT_MSG (p->GetSize () <= GetMtu (),
"CsmaNetDevice::AddHeader(): 802.3 Length/Type field with LLC/SNAP: "
"length interpretation must not exceed device frame size minus overhead");
}
@@ -721,6 +723,14 @@
//
if (header.GetLengthType () <= 1500)
{
+ NS_ASSERT (packet->GetSize () >= header.GetLengthType ());
+ uint32_t padlen = packet->GetSize () - header.GetLengthType ();
+ NS_ASSERT (padlen <= 46);
+ if (padlen > 0)
+ {
+ packet->RemoveAtEnd (padlen);
+ }
+
LlcSnapHeader llc;
packet->RemoveHeader (llc);
protocol = llc.GetType ();