From bf571e8260ba724cfc964ada003ab3c1d0e003e5 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 28 Nov 2008 07:21:26 -0800 Subject: [PATCH] Drop packets in Ipv4L3Protocol::Receive if interface is down --- src/internet-stack/ipv4-l3-protocol.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/internet-stack/ipv4-l3-protocol.cc b/src/internet-stack/ipv4-l3-protocol.cc index dc8c3f037..02ad9d3e8 100644 --- a/src/internet-stack/ipv4-l3-protocol.cc +++ b/src/internet-stack/ipv4-l3-protocol.cc @@ -522,8 +522,17 @@ Ipv4L3Protocol::Receive( Ptr device, Ptr p, uint16_t pr 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 @@ Ipv4L3Protocol::SetDown (uint32_t ifaceIndex) Ptr 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) {