Drop packets in Ipv4L3Protocol::Receive if interface is down
authorTom Henderson <tomh@tomh.org>
Fri Nov 28 07:21:26 2008 -0800 (14 months ago)
changeset 39587658bcc28d8d
parent 3956 0339a8ad5983
child 3959 ec65107df095
Drop packets in Ipv4L3Protocol::Receive if interface is down
src/internet-stack/ipv4-l3-protocol.cc
     1.1 --- a/src/internet-stack/ipv4-l3-protocol.cc	Fri Nov 28 06:05:27 2008 -0800
     1.2 +++ b/src/internet-stack/ipv4-l3-protocol.cc	Fri Nov 28 07:21:26 2008 -0800
     1.3 @@ -522,8 +522,17 @@
     1.4        ipv4Interface = *i;
     1.5        if (ipv4Interface->GetDevice () == device)
     1.6          {
     1.7 -          m_rxTrace (packet, index);
     1.8 -          break;
     1.9 +          if (ipv4Interface->IsUp ())
    1.10 +            {
    1.11 +              m_rxTrace (packet, index);
    1.12 +              break;
    1.13 +            } 
    1.14 +          else
    1.15 +            {
    1.16 +              NS_LOG_LOGIC ("Dropping received packet-- interface is down");
    1.17 +              m_dropTrace (packet);
    1.18 +              return;
    1.19 +            }
    1.20          }
    1.21        index++;
    1.22      }
    1.23 @@ -1075,7 +1084,7 @@
    1.24    Ptr<Ipv4Interface> interface = GetInterface (ifaceIndex);
    1.25    interface->SetDown ();
    1.26  
    1.27 -  // Remove all routes that are going through this interface
    1.28 +  // Remove all static routes that are going through this interface
    1.29    bool modified = true;
    1.30    while (modified)
    1.31      {