diff --git a/src/internet/model/icmpv6-l4-protocol.cc b/src/internet/model/icmpv6-l4-protocol.cc index 6d02650ed..02f580013 100644 --- a/src/internet/model/icmpv6-l4-protocol.cc +++ b/src/internet/model/icmpv6-l4-protocol.cc @@ -142,7 +142,11 @@ Icmpv6L4Protocol::GetTypeId() "Multicast RS maximum retransmission duration (0 means unbound).", TimeValue(Seconds(0)), MakeTimeAccessor(&Icmpv6L4Protocol::m_rsMaxRetransmissionDuration), - MakeTimeChecker()); + MakeTimeChecker()) + .AddTraceSource("FailedDad", + "Duplicate Address detected during DAD, the address is now INVALID", + MakeTraceSourceAccessor(&Icmpv6L4Protocol::m_failedDadAddressTrace), + "ns3::Ipv6Address::TracedCallback"); return tid; } @@ -873,6 +877,7 @@ Icmpv6L4Protocol::HandleNA(Ptr packet, if (ifaddr.GetState() == Ipv6InterfaceAddress::TENTATIVE || ifaddr.GetState() == Ipv6InterfaceAddress::TENTATIVE_OPTIMISTIC) { + m_failedDadAddressTrace(ifaddr.GetAddress()); interface->SetState(ifaddr.GetAddress(), Ipv6InterfaceAddress::INVALID); } } diff --git a/src/internet/model/icmpv6-l4-protocol.h b/src/internet/model/icmpv6-l4-protocol.h index 7f9802626..fa7565a3f 100644 --- a/src/internet/model/icmpv6-l4-protocol.h +++ b/src/internet/model/icmpv6-l4-protocol.h @@ -28,6 +28,7 @@ #include "ns3/ipv6-address.h" #include "ns3/random-variable-stream.h" +#include "ns3/traced-callback.h" #include @@ -697,6 +698,12 @@ class Icmpv6L4Protocol : public IpL4Protocol EventId m_handleRsTimeoutEvent; IpL4Protocol::DownTargetCallback6 m_downTarget; //!< callback to Ipv6::Send + + /** + * The trace fired when a DAD fails, changing the address state to INVALID. + * Includes the address whose state has been changed. + */ + ns3::TracedCallback m_failedDadAddressTrace; }; } /* namespace ns3 */