View | Details | Raw Unified | Return to bug 1056
Collapse All | Expand All

(-)a/src/devices/csma/csma-net-device.cc (-6 / +15 lines)
 Lines 322-327    Link Here 
322
        p->AddHeader (llc);
322
        p->AddHeader (llc);
323
        //
323
        //
324
        // This corresponds to the length interpretation of the lengthType field,
325
        // but with an LLC/SNAP header added to the payload as in IEEE 802.2
326
        //
327
        lengthType = p->GetSize ();
328
329
        //
324
        // All Ethernet frames must carry a minimum payload of 46 bytes.  The
330
        // All Ethernet frames must carry a minimum payload of 46 bytes.  The
325
        // LLC SNAP header counts as part of this payload.  We need to padd out
331
        // LLC SNAP header counts as part of this payload.  We need to padd out
326
        // if we don't have enough bytes.  These must be real bytes since they
332
        // if we don't have enough bytes.  These must be real bytes since they
 Lines 335-346    Link Here 
335
            p->AddAtEnd (padd);
341
            p->AddAtEnd (padd);
336
          }
342
          }
337
        //
343
        NS_ASSERT_MSG (p->GetSize () <= GetMtu (),
338
        // This corresponds to the length interpretation of the lengthType field,
339
        // but with an LLC/SNAP header added to the payload as in IEEE 802.2
340
        //
341
        lengthType = p->GetSize ();
342
        NS_ASSERT_MSG (lengthType <= GetMtu (),
343
          "CsmaNetDevice::AddHeader(): 802.3 Length/Type field with LLC/SNAP: "
344
          "CsmaNetDevice::AddHeader(): 802.3 Length/Type field with LLC/SNAP: "
344
          "length interpretation must not exceed device frame size minus overhead");
345
          "length interpretation must not exceed device frame size minus overhead");
345
      }
346
      }
 Lines 721-726    Link Here 
721
  //
722
  //
722
  if (header.GetLengthType () <= 1500)
723
  if (header.GetLengthType () <= 1500)
723
    {
724
    {
725
      NS_ASSERT (packet->GetSize () >= header.GetLengthType ());
726
      uint32_t padlen = packet->GetSize () - header.GetLengthType ();
727
      NS_ASSERT (padlen <= 46);
728
      if (padlen > 0)
729
        {
730
          packet->RemoveAtEnd (padlen);
731
        }
732
724
      LlcSnapHeader llc;
733
      LlcSnapHeader llc;
725
      packet->RemoveHeader (llc);
734
      packet->RemoveHeader (llc);
726
      protocol = llc.GetType ();
735
      protocol = llc.GetType ();

Return to bug 1056