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

(-)a/RELEASE_NOTES (+1 lines)
 Lines 64-69    Link Here 
64
- Bug 2003 - Missing DSSS short PLCP preamble
64
- Bug 2003 - Missing DSSS short PLCP preamble
65
- Bug 2041 - TCP RTO needs unit tests
65
- Bug 2041 - TCP RTO needs unit tests
66
- Bug 2068 - Timestamp option conforms to RFC 7323
66
- Bug 2068 - Timestamp option conforms to RFC 7323
67
- Bug 2078 - Packet metadata disabling on a per-packet basis
67
- Bug 2116 - refactoring aggregation API
68
- Bug 2116 - refactoring aggregation API
68
- Bug 2120 - 802.11g networks are not compatible with 802.11b clients
69
- Bug 2120 - 802.11g networks are not compatible with 802.11b clients
69
- Bug 2141 - TCP DataSent callback now correctly notifies sent data, without missing bytes in particular conditions
70
- Bug 2141 - TCP DataSent callback now correctly notifies sent data, without missing bytes in particular conditions
(-)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->SetDirtyMetadata ();
1136
1137
1137
  delete[] data;
1138
  delete[] data;
1138
  return GetSerializedSize ();
1139
  return GetSerializedSize ();
(-)a/src/network/model/packet.cc (-5 / +24 lines)
 Lines 138-143    Link Here 
138
     * global UID
138
     * global UID
139
     */
139
     */
140
    m_metadata (static_cast<uint64_t> (Simulator::GetSystemId ()) << 32 | m_globalUid, 0),
140
    m_metadata (static_cast<uint64_t> (Simulator::GetSystemId ()) << 32 | m_globalUid, 0),
141
    m_dirtyMetadata (false),
141
    m_nixVector (0)
142
    m_nixVector (0)
142
{
143
{
143
  m_globalUid++;
144
  m_globalUid++;
 Lines 147-153    Link Here 
147
  : m_buffer (o.m_buffer),
148
  : m_buffer (o.m_buffer),
148
    m_byteTagList (o.m_byteTagList),
149
    m_byteTagList (o.m_byteTagList),
149
    m_packetTagList (o.m_packetTagList),
150
    m_packetTagList (o.m_packetTagList),
150
    m_metadata (o.m_metadata)
151
    m_metadata (o.m_metadata),
152
    m_dirtyMetadata (o.m_dirtyMetadata)
151
{
153
{
152
  o.m_nixVector ? m_nixVector = o.m_nixVector->Copy ()
154
  o.m_nixVector ? m_nixVector = o.m_nixVector->Copy ()
153
    : m_nixVector = 0;
155
    : m_nixVector = 0;
 Lines 164-169    Link Here 
164
  m_byteTagList = o.m_byteTagList;
166
  m_byteTagList = o.m_byteTagList;
165
  m_packetTagList = o.m_packetTagList;
167
  m_packetTagList = o.m_packetTagList;
166
  m_metadata = o.m_metadata;
168
  m_metadata = o.m_metadata;
169
  m_dirtyMetadata = o.m_dirtyMetadata;
167
  o.m_nixVector ? m_nixVector = o.m_nixVector->Copy () 
170
  o.m_nixVector ? m_nixVector = o.m_nixVector->Copy () 
168
    : m_nixVector = 0;
171
    : m_nixVector = 0;
169
  return *this;
172
  return *this;
 Lines 180-185    Link Here 
180
     * global UID
183
     * global UID
181
     */
184
     */
182
    m_metadata (static_cast<uint64_t> (Simulator::GetSystemId ()) << 32 | m_globalUid, size),
185
    m_metadata (static_cast<uint64_t> (Simulator::GetSystemId ()) << 32 | m_globalUid, size),
186
    m_dirtyMetadata (false),
183
    m_nixVector (0)
187
    m_nixVector (0)
184
{
188
{
185
  m_globalUid++;
189
  m_globalUid++;
 Lines 189-194    Link Here 
189
    m_byteTagList (),
193
    m_byteTagList (),
190
    m_packetTagList (),
194
    m_packetTagList (),
191
    m_metadata (0,0),
195
    m_metadata (0,0),
196
    m_dirtyMetadata (false),
192
    m_nixVector (0)
197
    m_nixVector (0)
193
{
198
{
194
  NS_ASSERT (magic);
199
  NS_ASSERT (magic);
 Lines 206-211    Link Here 
206
     * global UID
211
     * global UID
207
     */
212
     */
208
    m_metadata (static_cast<uint64_t> (Simulator::GetSystemId ()) << 32 | m_globalUid, size),
213
    m_metadata (static_cast<uint64_t> (Simulator::GetSystemId ()) << 32 | m_globalUid, size),
214
    m_dirtyMetadata (false),
209
    m_nixVector (0)
215
    m_nixVector (0)
210
{
216
{
211
  m_globalUid++;
217
  m_globalUid++;
 Lines 220-225    Link Here 
220
    m_byteTagList (byteTagList),
226
    m_byteTagList (byteTagList),
221
    m_packetTagList (packetTagList),
227
    m_packetTagList (packetTagList),
222
    m_metadata (metadata),
228
    m_metadata (metadata),
229
    m_dirtyMetadata (false),
223
    m_nixVector (0)
230
    m_nixVector (0)
224
{
231
{
225
}
232
}
 Lines 247-252    Link Here 
247
  m_nixVector = nixVector;
254
  m_nixVector = nixVector;
248
}
255
}
249
256
257
void
258
Packet::SetDirtyMetadata (void)
259
{
260
  m_dirtyMetadata = true;
261
}
262
250
Ptr<NixVector>
263
Ptr<NixVector>
251
Packet::GetNixVector (void) const
264
Packet::GetNixVector (void) const
252
{
265
{
 Lines 271-277    Link Here 
271
  NS_LOG_FUNCTION (this << header.GetInstanceTypeId ().GetName () << deserialized);
284
  NS_LOG_FUNCTION (this << header.GetInstanceTypeId ().GetName () << deserialized);
272
  m_buffer.RemoveAtStart (deserialized);
285
  m_buffer.RemoveAtStart (deserialized);
273
  m_byteTagList.Adjust (-deserialized);
286
  m_byteTagList.Adjust (-deserialized);
274
  m_metadata.RemoveHeader (header, deserialized);
287
  if (!m_dirtyMetadata)
288
    {
289
      m_metadata.RemoveHeader (header, deserialized);
290
    }
275
  return deserialized;
291
  return deserialized;
276
}
292
}
277
uint32_t
293
uint32_t
 Lines 298-304    Link Here 
298
  uint32_t deserialized = trailer.Deserialize (m_buffer.End ());
314
  uint32_t deserialized = trailer.Deserialize (m_buffer.End ());
299
  NS_LOG_FUNCTION (this << trailer.GetInstanceTypeId ().GetName () << deserialized);
315
  NS_LOG_FUNCTION (this << trailer.GetInstanceTypeId ().GetName () << deserialized);
300
  m_buffer.RemoveAtEnd (deserialized);
316
  m_buffer.RemoveAtEnd (deserialized);
301
  m_metadata.RemoveTrailer (trailer, deserialized);
317
  if (!m_dirtyMetadata)
318
    {
319
      m_metadata.RemoveTrailer (trailer, deserialized);
320
    }
302
  return deserialized;
321
  return deserialized;
303
}
322
}
304
uint32_t
323
uint32_t
 Lines 752-762    Link Here 
752
771
753
  size -= metaSize;
772
  size -= metaSize;
754
773
755
  uint32_t metadataDeserialized = 
774
  uint32_t metadataDeserialized =
756
    m_metadata.Deserialize (reinterpret_cast<const uint8_t *> (p), metaSize);
775
    m_metadata.Deserialize (reinterpret_cast<const uint8_t *> (p), metaSize);
757
  if (!metadataDeserialized)
776
  if (!metadataDeserialized)
758
    {
777
    {
759
      // meta-data not deserialized 
778
      // meta-data not deserialized
760
      // completely
779
      // completely
761
      return 0;
780
      return 0;
762
    }
781
    }
(-)a/src/network/model/packet.h (+16 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
   * Prevents the packet header and trailer removal from trying to
534
   * remove also non-existent metadata.
535
   *
536
   * A packet with a valid header (or trailer) can be created by direct
537
   * creation of a packet from a buffer with a proper header.
538
   * This is typical of ICMP Destination Unreachable.
539
   */
540
  void SetDirtyMetadata (void);
541
542
  /**
529
   * \brief Tag each byte included in this packet with a new byte tag.
543
   * \brief Tag each byte included in this packet with a new byte tag.
530
   *
544
   *
531
   * \param tag the new tag to add to this packet
545
   * \param tag the new tag to add to this packet
 Lines 542-547    Link Here 
542
   * packet).
556
   * packet).
543
   */
557
   */
544
  void AddByteTag (const Tag &tag) const;
558
  void AddByteTag (const Tag &tag) const;
559
545
  /**
560
  /**
546
   * \brief Retiurns an iterator over the set of byte tags included in this packet
561
   * \brief Retiurns an iterator over the set of byte tags included in this packet
547
   *
562
   *
 Lines 717-722    Link Here 
717
  ByteTagList m_byteTagList;      //!< the ByteTag list
732
  ByteTagList m_byteTagList;      //!< the ByteTag list
718
  PacketTagList m_packetTagList;  //!< the packet's Tag list
733
  PacketTagList m_packetTagList;  //!< the packet's Tag list
719
  PacketMetadata m_metadata;      //!< the packet's metadata
734
  PacketMetadata m_metadata;      //!< the packet's metadata
735
  bool m_dirtyMetadata;           //!< the packet's metadata are not check-safe
720
736
721
  /* Please see comments above about nix-vector */
737
  /* Please see comments above about nix-vector */
722
  Ptr<NixVector> m_nixVector; //!< the packet's Nix vector
738
  Ptr<NixVector> m_nixVector; //!< the packet's Nix vector

Return to bug 2078