internet: Add SetDhcpv6Callback to trigger client on set M flag in RA
This commit is contained in:
committed by
Tommaso Pecorella
parent
460b25f5a5
commit
c3d3d81997
@@ -439,6 +439,15 @@ Icmpv6L4Protocol::HandleRA(Ptr<Packet> packet,
|
||||
|
||||
p->RemoveHeader(raHeader);
|
||||
|
||||
// If 'M' flag is set, we need to start DHCPv6.
|
||||
if (raHeader.GetFlagM())
|
||||
{
|
||||
if (!m_startDhcpv6.IsNull())
|
||||
{
|
||||
m_startDhcpv6(ipv6->GetInterfaceForDevice(interface->GetDevice()));
|
||||
}
|
||||
}
|
||||
|
||||
if (raHeader.GetLifeTime())
|
||||
{
|
||||
defaultRouter = src;
|
||||
|
||||
@@ -413,6 +413,16 @@ class Icmpv6L4Protocol : public IpL4Protocol
|
||||
*/
|
||||
Time GetDadTimeout() const;
|
||||
|
||||
/**
|
||||
* Set DHCPv6 callback.
|
||||
* Invoked when an RA is received with the M flag set.
|
||||
* \param cb the callback function
|
||||
*/
|
||||
void SetDhcpv6Callback(Callback<void, uint32_t> cb)
|
||||
{
|
||||
m_startDhcpv6 = cb;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* \brief Dispose this object.
|
||||
@@ -700,6 +710,12 @@ class Icmpv6L4Protocol : public IpL4Protocol
|
||||
* Includes the address whose state has been changed.
|
||||
*/
|
||||
ns3::TracedCallback<const Ipv6Address&> m_dadSuccessAddressTrace;
|
||||
|
||||
/**
|
||||
* The DHCPv6 callback when the M flag is set in a Router Advertisement.
|
||||
* Includes the interface on which the RA was received.
|
||||
*/
|
||||
Callback<void, uint32_t> m_startDhcpv6;
|
||||
};
|
||||
|
||||
} /* namespace ns3 */
|
||||
|
||||
Reference in New Issue
Block a user