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

(-)a/RELEASE_NOTES (+1 lines)
 Lines 35-40    Link Here 
35
- Bug 1939 - Aggregating the same object to two nodes produce unexpected results
35
- Bug 1939 - Aggregating the same object to two nodes produce unexpected results
36
- Bug 1977 - v4Ping verbose output when not explicitly stopped
36
- Bug 1977 - v4Ping verbose output when not explicitly stopped
37
- Bug 2057 - ARP and Ndisc caches should be updated by receiving valid L3 packets
37
- Bug 2057 - ARP and Ndisc caches should be updated by receiving valid L3 packets
38
- Bug 2078 - Packet metadata disabling on a per-packet basis
38
- Bug 2346 - SixLowPan ConpressionThreshold can be violated.
39
- Bug 2346 - SixLowPan ConpressionThreshold can be violated.
39
- Bug 2329 - TCP Veno implementation
40
- Bug 2329 - TCP Veno implementation
40
- Bug 2333 - TCP Scalable implementation
41
- Bug 2333 - TCP Scalable implementation
(-)a/src/internet/model/icmpv6-header.cc (+1 lines)
 Lines 1133-1138    Link Here 
1133
  i.ReadNtohU32 ();
1133
  i.ReadNtohU32 ();
1134
  i.Read (data, length);
1134
  i.Read (data, length);
1135
  m_packet = Create<Packet> (data, length);
1135
  m_packet = Create<Packet> (data, length);
1136
  m_packet->DisableMetadata ();
1136
1137
1137
  delete[] data;
1138
  delete[] data;
1138
  return GetSerializedSize ();
1139
  return GetSerializedSize ();
(-)a/src/network/model/packet-metadata.cc (+46 lines)
 Lines 49-54    Link Here 
49
}
49
}
50
50
51
void 
51
void 
52
PacketMetadata::Disable (void)
53
{
54
  NS_LOG_FUNCTION_NOARGS ();
55
  m_enabledOnPacket = false;
56
  m_data->m_count--;
57
  if (m_data->m_count == 0)
58
    {
59
      PacketMetadata::Recycle (m_data);
60
    }
61
}
62
63
void
52
PacketMetadata::Enable (void)
64
PacketMetadata::Enable (void)
53
{
65
{
54
  NS_LOG_FUNCTION_NOARGS ();
66
  NS_LOG_FUNCTION_NOARGS ();
 Lines 669-674    Link Here 
669
      m_metadataSkipped = true;
681
      m_metadataSkipped = true;
670
      return;
682
      return;
671
    }
683
    }
684
  if (!m_enabledOnPacket)
685
    {
686
      return;
687
    }
672
688
673
  struct PacketMetadata::SmallItem item;
689
  struct PacketMetadata::SmallItem item;
674
  item.next = m_head;
690
  item.next = m_head;
 Lines 691-696    Link Here 
691
      m_metadataSkipped = true;
707
      m_metadataSkipped = true;
692
      return;
708
      return;
693
    }
709
    }
710
  if (!m_enabledOnPacket)
711
    {
712
      return;
713
    }
714
694
  struct PacketMetadata::SmallItem item;
715
  struct PacketMetadata::SmallItem item;
695
  struct PacketMetadata::ExtraItem extraItem;
716
  struct PacketMetadata::ExtraItem extraItem;
696
  uint32_t read = ReadItems (m_head, &item, &extraItem);
717
  uint32_t read = ReadItems (m_head, &item, &extraItem);
 Lines 739-744    Link Here 
739
      m_metadataSkipped = true;
760
      m_metadataSkipped = true;
740
      return;
761
      return;
741
    }
762
    }
763
  if (!m_enabledOnPacket)
764
    {
765
      return;
766
    }
767
742
  struct PacketMetadata::SmallItem item;
768
  struct PacketMetadata::SmallItem item;
743
  item.next = 0xffff;
769
  item.next = 0xffff;
744
  item.prev = m_tail;
770
  item.prev = m_tail;
 Lines 761-766    Link Here 
761
      m_metadataSkipped = true;
787
      m_metadataSkipped = true;
762
      return;
788
      return;
763
    }
789
    }
790
  if (!m_enabledOnPacket)
791
    {
792
      return;
793
    }
794
764
  struct PacketMetadata::SmallItem item;
795
  struct PacketMetadata::SmallItem item;
765
  struct PacketMetadata::ExtraItem extraItem;
796
  struct PacketMetadata::ExtraItem extraItem;
766
  uint32_t read = ReadItems (m_tail, &item, &extraItem);
797
  uint32_t read = ReadItems (m_tail, &item, &extraItem);
 Lines 808-813    Link Here 
808
      m_metadataSkipped = true;
839
      m_metadataSkipped = true;
809
      return;
840
      return;
810
    }
841
    }
842
  if (!m_enabledOnPacket || !o.m_enabledOnPacket)
843
    {
844
      if (m_enabledOnPacket)
845
        {
846
          m_data->m_count--;
847
          if (m_data->m_count == 0)
848
            {
849
              PacketMetadata::Recycle (m_data);
850
            }
851
        }
852
853
      m_enabledOnPacket = false;
854
      return;
855
    }
856
811
  if (m_tail == 0xffff)
857
  if (m_tail == 0xffff)
812
    {
858
    {
813
      // We have no items so 'AddAtEnd' is 
859
      // We have no items so 'AddAtEnd' is 
(-)a/src/network/model/packet-metadata.h (-4 / +25 lines)
 Lines 152-160    Link Here 
152
  };
152
  };
153
153
154
  /**
154
  /**
155
   * \brief Enable the packet metadata
155
   * \brief Enable the packet metadata on all packets.
156
   *
157
   * Packet metadata must be enabled at the start of the
158
   * simulation, before any Packet exchange.
159
   * All the packets will have their metadata enabled,
160
   * except the ones where metadata are explicitly
161
   * disabled (\see Disable)
162
   *
156
   */
163
   */
157
  static void Enable (void);
164
  static void Enable (void);
165
166
  /**
167
   * \brief Disable, on a per-packet basis, the use of metadata.
168
   *
169
   * This must be used if metadata checking is globally enabled,
170
   * and if the packet is built in a manner (e.g. from a raw
171
   * byte buffer) such that the metadata is incomplete.
172
   */
173
  void Disable (void);
174
158
  /**
175
  /**
159
   * \brief Enable the packet metadata checking
176
   * \brief Enable the packet metadata checking
160
   */
177
   */
 Lines 657-663    Link Here 
657
  static void Deallocate (struct PacketMetadata::Data *data);
674
  static void Deallocate (struct PacketMetadata::Data *data);
658
675
659
  static DataFreeList m_freeList; //!< the metadata data storage
676
  static DataFreeList m_freeList; //!< the metadata data storage
660
  static bool m_enable; //!< Enable the packet metadata
677
  static bool m_enable; //!< Enable the packet metadata at global level
678
  bool m_enabledOnPacket; //!< Enable the packet metadata at packet level
661
  static bool m_enableChecking; //!< Enable the packet metadata checking
679
  static bool m_enableChecking; //!< Enable the packet metadata checking
662
680
663
  /**
681
  /**
 Lines 687-693    Link Here 
687
namespace ns3 {
705
namespace ns3 {
688
706
689
PacketMetadata::PacketMetadata (uint64_t uid, uint32_t size)
707
PacketMetadata::PacketMetadata (uint64_t uid, uint32_t size)
690
  : m_data (PacketMetadata::Create (10)),
708
  : m_enabledOnPacket (m_enable),
709
    m_data (PacketMetadata::Create (10)),
691
    m_head (0xffff),
710
    m_head (0xffff),
692
    m_tail (0xffff),
711
    m_tail (0xffff),
693
    m_used (0),
712
    m_used (0),
 Lines 700-706    Link Here 
700
    }
719
    }
701
}
720
}
702
PacketMetadata::PacketMetadata (PacketMetadata const &o)
721
PacketMetadata::PacketMetadata (PacketMetadata const &o)
703
  : m_data (o.m_data),
722
  : m_enabledOnPacket (o.m_enabledOnPacket),
723
    m_data (o.m_data),
704
    m_head (o.m_head),
724
    m_head (o.m_head),
705
    m_tail (o.m_tail),
725
    m_tail (o.m_tail),
706
    m_used (o.m_used),
726
    m_used (o.m_used),
 Lines 713-718    Link Here 
713
PacketMetadata &
733
PacketMetadata &
714
PacketMetadata::operator = (PacketMetadata const& o)
734
PacketMetadata::operator = (PacketMetadata const& o)
715
{
735
{
736
  m_enabledOnPacket = o.m_enabledOnPacket;
716
  if (m_data != o.m_data) 
737
  if (m_data != o.m_data) 
717
    {
738
    {
718
      // not self assignment
739
      // not self assignment
(-)a/src/network/model/packet.cc (-2 / +8 lines)
 Lines 247-252    Link Here 
247
  m_nixVector = nixVector;
247
  m_nixVector = nixVector;
248
}
248
}
249
249
250
void
251
Packet::DisableMetadata (void)
252
{
253
  m_metadata.Disable ();
254
}
255
250
Ptr<NixVector>
256
Ptr<NixVector>
251
Packet::GetNixVector (void) const
257
Packet::GetNixVector (void) const
252
{
258
{
 Lines 752-762    Link Here 
752
758
753
  size -= metaSize;
759
  size -= metaSize;
754
760
755
  uint32_t metadataDeserialized = 
761
  uint32_t metadataDeserialized =
756
    m_metadata.Deserialize (reinterpret_cast<const uint8_t *> (p), metaSize);
762
    m_metadata.Deserialize (reinterpret_cast<const uint8_t *> (p), metaSize);
757
  if (!metadataDeserialized)
763
  if (!metadataDeserialized)
758
    {
764
    {
759
      // meta-data not deserialized 
765
      // meta-data not deserialized
760
      // completely
766
      // completely
761
      return 0;
767
      return 0;
762
    }
768
    }
(-)a/src/network/model/packet.h (+17 lines)
 Lines 276-281    Link Here 
276
   * The input data is copied: the input
276
   * The input data is copied: the input
277
   * buffer is untouched.
277
   * buffer is untouched.
278
   *
278
   *
279
   * If the buffer also contains headers or trailers and these
280
   * must be later removed, it is advisable to use
281
   * Packet::SetDirtyMetadata as well.
282
   *
279
   * \param buffer the data to store in the packet.
283
   * \param buffer the data to store in the packet.
280
   * \param size the size of the input buffer.
284
   * \param size the size of the input buffer.
281
   */
285
   */
 Lines 526-531    Link Here 
526
  uint32_t Serialize (uint8_t* buffer, uint32_t maxSize) const;
530
  uint32_t Serialize (uint8_t* buffer, uint32_t maxSize) const;
527
531
528
  /**
532
  /**
533
   * \brief Disable, on a per-packet basis, the use of metadata.
534
   *
535
   * This must be used if metadata checking is globally enabled,
536
   * and if the packet is built in a way such that the metadata
537
   * is incomplete (e.g. from a raw byte buffer).
538
   *
539
   * \warning If a packet with disabled metadata is added to another,
540
   * the resulting packet will have its metadata disabled.
541
   */
542
  void DisableMetadata (void);
543
544
  /**
529
   * \brief Tag each byte included in this packet with a new byte tag.
545
   * \brief Tag each byte included in this packet with a new byte tag.
530
   *
546
   *
531
   * \param tag the new tag to add to this packet
547
   * \param tag the new tag to add to this packet
 Lines 542-547    Link Here 
542
   * packet).
558
   * packet).
543
   */
559
   */
544
  void AddByteTag (const Tag &tag) const;
560
  void AddByteTag (const Tag &tag) const;
561
545
  /**
562
  /**
546
   * \brief Retiurns an iterator over the set of byte tags included in this packet
563
   * \brief Retiurns an iterator over the set of byte tags included in this packet
547
   *
564
   *

Return to bug 2078