Follow up patch for Click: Bug 760 - IP address removal can be painful
This commit is contained in:
@@ -434,6 +434,29 @@ Ipv4L3ClickProtocol::RemoveAddress (uint32_t i, uint32_t addressIndex)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4L3ClickProtocol::RemoveAddress (uint32_t i, Ipv4Address address)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << i << address);
|
||||
|
||||
if (address == Ipv4Address::GetLoopback())
|
||||
{
|
||||
NS_LOG_WARN ("Cannot remove loopback address.");
|
||||
return false;
|
||||
}
|
||||
Ptr<Ipv4Interface> interface = GetInterface (i);
|
||||
Ipv4InterfaceAddress ifAddr = interface->RemoveAddress (address);
|
||||
if (ifAddr != Ipv4InterfaceAddress ())
|
||||
{
|
||||
if (m_routingProtocol != 0)
|
||||
{
|
||||
m_routingProtocol->NotifyRemoveAddress (i, ifAddr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Ipv4Address
|
||||
Ipv4L3ClickProtocol::SelectSourceAddress (Ptr<const NetDevice> device,
|
||||
Ipv4Address dst, Ipv4InterfaceAddress::InterfaceAddressScope_e scope)
|
||||
|
||||
@@ -215,6 +215,7 @@ public:
|
||||
Ipv4InterfaceAddress GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const;
|
||||
uint32_t GetNAddresses (uint32_t interface) const;
|
||||
bool RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex);
|
||||
bool RemoveAddress (uint32_t interfaceIndex, Ipv4Address address);
|
||||
Ipv4Address SelectSourceAddress (Ptr<const NetDevice> device,
|
||||
Ipv4Address dst, Ipv4InterfaceAddress::InterfaceAddressScope_e scope);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user