Drop packets in Ipv4L3Protocol::Receive if interface is down
authorTom Henderson <tomh@tomh.org>
Fri, 28 Nov 2008 07:21:26 -0800
changeset 3958 7658bcc28d8d
parent 3956 0339a8ad5983
child 3959 ec65107df095
Drop packets in Ipv4L3Protocol::Receive if interface is down
src/internet-stack/ipv4-l3-protocol.cc
--- a/src/internet-stack/ipv4-l3-protocol.cc	Fri Nov 28 06:05:27 2008 -0800
+++ b/src/internet-stack/ipv4-l3-protocol.cc	Fri Nov 28 07:21:26 2008 -0800
@@ -522,8 +522,17 @@
       ipv4Interface = *i;
       if (ipv4Interface->GetDevice () == device)
         {
-          m_rxTrace (packet, index);
-          break;
+          if (ipv4Interface->IsUp ())
+            {
+              m_rxTrace (packet, index);
+              break;
+            } 
+          else
+            {
+              NS_LOG_LOGIC ("Dropping received packet-- interface is down");
+              m_dropTrace (packet);
+              return;
+            }
         }
       index++;
     }
@@ -1075,7 +1084,7 @@
   Ptr<Ipv4Interface> interface = GetInterface (ifaceIndex);
   interface->SetDown ();
 
-  // Remove all routes that are going through this interface
+  // Remove all static routes that are going through this interface
   bool modified = true;
   while (modified)
     {