src/internet-node/ipv4-l3-protocol.cc
changeset 2711 83addb15f632
parent 2602 d9262bff6df2
child 2796 33fb53176f97
--- a/src/internet-node/ipv4-l3-protocol.cc	Fri Mar 21 15:58:20 2008 -0700
+++ b/src/internet-node/ipv4-l3-protocol.cc	Fri Mar 21 17:26:01 2008 -0700
@@ -415,6 +415,26 @@
   return 0;
 }
 
+int32_t 
+Ipv4L3Protocol::FindInterfaceIndexForDevice (Ptr<NetDevice> device) const
+{
+  NS_LOG_FUNCTION;
+  NS_LOG_PARAMS (this << device);
+
+  uint32_t ifIndex = 0;
+  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); 
+       i != m_interfaces.end (); 
+       i++, ifIndex++)
+    {
+      if ((*i)->GetDevice () == device)
+        {
+          return ifIndex;
+        }
+    }
+
+  return -1;
+}
+
 Ptr<Ipv4Interface>
 Ipv4L3Protocol::FindInterfaceForDevice (Ptr<const NetDevice> device)
 {