# HG changeset patch # Parent f6e415076d1aeedc7b2e3431e371f981187c1b9f # User Tommaso Pecorella # Date 1389738161 -3600 Bug 1817 - IPv4 Identification field should consider protocol as well. diff --git a/src/internet/model/ipv4-l3-protocol.cc b/src/internet/model/ipv4-l3-protocol.cc --- a/src/internet/model/ipv4-l3-protocol.cc +++ b/src/internet/model/ipv4-l3-protocol.cc @@ -91,8 +91,6 @@ } Ipv4L3Protocol::Ipv4L3Protocol() - : m_identification (0) - { NS_LOG_FUNCTION (this); } @@ -712,15 +710,18 @@ if (mayFragment == true) { ipHeader.SetMayFragment (); - ipHeader.SetIdentification (m_identification); - m_identification++; + ipHeader.SetIdentification (m_identification[protocol]); + m_identification[protocol]++; } else { ipHeader.SetDontFragment (); - // TBD: set to zero here; will cause traces to change - ipHeader.SetIdentification (m_identification); - m_identification++; + // RFC 6864 does not state anything about atomic datagrams + // identification requirement: + // >> Originating sources MAY set the IPv4 ID field of atomic datagrams + // to any value. + ipHeader.SetIdentification (m_identification[protocol]); + m_identification[protocol]++; } if (Node::ChecksumEnabled ()) { diff --git a/src/internet/model/ipv4-l3-protocol.h b/src/internet/model/ipv4-l3-protocol.h --- a/src/internet/model/ipv4-l3-protocol.h +++ b/src/internet/model/ipv4-l3-protocol.h @@ -396,7 +396,7 @@ Ipv4InterfaceList m_interfaces; //!< List of IPv4 interfaces. uint8_t m_defaultTos; //!< Default TOS uint8_t m_defaultTtl; //!< Default TTL - uint16_t m_identification; //!< Identification + std::map m_identification; //!< Identification (for each protocol) Ptr m_node; //!< Node attached to stack. /// Trace of sent packets