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

(-)a/ns3/ns-allinone-3.14.1/ns-3.14.1/src/internet/model/ipv4-l3-protocol.cc (-4 / +16 lines)
 Lines 654-659   Ipv4L3Protocol::Send (Ptr<Packet> packet, Link Here 
654
    }
654
    }
655
}
655
}
656
656
657
uint128_t Ipv4L3Protocol::GetIpIdentificationKey(Ipv4Address source,
658
                                                 Ipv4Address destination,
659
                                                 uint8_t protocol)
660
{
661
  uint128_t src = (uint128_t)source.Get() & 0xffffffff;
662
  uint128_t dst = (uint128_t)destination.Get() & 0xffffffff;
663
  uint128_t key = protocol | (dst << 8) | (src << 40);
664
  return key;
665
}
666
  
657
// XXX when should we set ip_id?   check whether we are incrementing
667
// XXX when should we set ip_id?   check whether we are incrementing
658
// m_identification on packets that may later be dropped in this stack
668
// m_identification on packets that may later be dropped in this stack
659
// and whether that deviates from Linux
669
// and whether that deviates from Linux
 Lines 676-683   Ipv4L3Protocol::BuildHeader ( Link Here 
676
  if (mayFragment == true)
686
  if (mayFragment == true)
677
    {
687
    {
678
      ipHeader.SetMayFragment ();
688
      ipHeader.SetMayFragment ();
679
      ipHeader.SetIdentification (m_identification[protocol]);
689
      uint128_t ipIdKey = GetIpIdentificationKey(source, destination, protocol);
680
      m_identification[protocol]++;
690
      ipHeader.SetIdentification (m_identification[ipIdKey]);
691
      m_identification[ipIdKey]++;
681
    }
692
    }
682
  else
693
  else
683
    {
694
    {
 Lines 686-693   Ipv4L3Protocol::BuildHeader ( Link Here 
686
      // identification requirement:
697
      // identification requirement:
687
      // >> Originating sources MAY set the IPv4 ID field of atomic datagrams
698
      // >> Originating sources MAY set the IPv4 ID field of atomic datagrams
688
      //    to any value.
699
      //    to any value.
689
      ipHeader.SetIdentification (m_identification[protocol]);
700
      uint128_t ipIdKey = GetIpIdentificationKey(source, destination, protocol);
690
      m_identification[protocol]++;
701
      ipHeader.SetIdentification (m_identification[ipIdKey]);
702
      m_identification[ipIdKey]++;
691
    }
703
    }
692
  if (Node::ChecksumEnabled ())
704
  if (Node::ChecksumEnabled ())
693
    {
705
    {
(-)a/ns3/ns-allinone-3.14.1/ns-3.14.1/src/internet/model/ipv4-l3-protocol.h (-1 / +9 lines)
 Lines 289-294   private: Link Here 
289
   * \param iif Input Interface
289
   * \param iif Input Interface
290
   */
290
   */
291
  void HandleFragmentsTimeout ( std::pair<uint64_t, uint32_t> key, Ipv4Header & ipHeader, uint32_t iif);
291
  void HandleFragmentsTimeout ( std::pair<uint64_t, uint32_t> key, Ipv4Header & ipHeader, uint32_t iif);
292
  
293
  /**
294
   * \brief Compute IP identification key from source, destination and protocol, used to access
295
   * the IP identification map.
296
   **/
297
  uint128_t GetIpIdentificationKey(Ipv4Address source,
298
                                   Ipv4Address destination,
299
                                   uint8_t protocol);
292
300
293
  typedef std::vector<Ptr<Ipv4Interface> > Ipv4InterfaceList;
301
  typedef std::vector<Ptr<Ipv4Interface> > Ipv4InterfaceList;
294
  typedef std::list<Ptr<Ipv4RawSocketImpl> > SocketList;
302
  typedef std::list<Ptr<Ipv4RawSocketImpl> > SocketList;
 Lines 299-305   private: Link Here 
299
  L4List_t m_protocols;
307
  L4List_t m_protocols;
300
  Ipv4InterfaceList m_interfaces;
308
  Ipv4InterfaceList m_interfaces;
301
  uint8_t m_defaultTtl;
309
  uint8_t m_defaultTtl;
302
  std::map<uint8_t, uint16_t> m_identification; //!< Identification (for each protocol)
310
  std::map<uint128_t, uint16_t> m_identification; //!< Identification (for each protocol)
303
  Ptr<Node> m_node;
311
  Ptr<Node> m_node;
304
312
305
  TracedCallback<const Ipv4Header &, Ptr<const Packet>, uint32_t> m_sendOutgoingTrace;
313
  TracedCallback<const Ipv4Header &, Ptr<const Packet>, uint32_t> m_sendOutgoingTrace;

Return to bug 1955