src/internet/model/ipv4-l3-protocol.cc
changeset 9915 d4c2228d3c30
parent 9894 ac4e52a91d5d
child 10410 4d4eb8097fa3
--- a/src/internet/model/ipv4-l3-protocol.cc	Tue Jul 09 19:15:20 2013 +0200
+++ b/src/internet/model/ipv4-l3-protocol.cc	Tue Jul 09 19:21:07 2013 +0200
@@ -979,6 +979,29 @@
   return false;
 }
 
+bool
+Ipv4L3Protocol::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 
 Ipv4L3Protocol::SelectSourceAddress (Ptr<const NetDevice> device,
                                      Ipv4Address dst, Ipv4InterfaceAddress::InterfaceAddressScope_e scope)