bug 1046: Check AODV LocalDeliver callback before using it

This commit is contained in:
Tom Henderson
2011-04-15 15:45:50 -07:00
parent 3c78215274
commit 338eb54233
2 changed files with 28 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ since ns-3.10, in many cases referencing the Bugzilla bug number.
- Fixed the UanPhyGen::IsStateBusy method, error with logical OR
- CsmaNetDevice ReceiveErrorModel was not dropping the packet
- bug 1064 - Correct Friis propagation loss equation in spectrum module
- bug 1046 - Check Aodv LocalDeliver callback before using it
Known issues
------------

View File

@@ -385,6 +385,12 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
if (IsMyOwnAddress (origin))
return true;
// AODV is not a multicast routing protocol
if (dst.IsMulticast ())
{
return false;
}
// Broadcast local delivery/forwarding
for (std::map<Ptr<Socket> , Ipv4InterfaceAddress>::const_iterator j =
m_socketAddresses.begin (); j != m_socketAddresses.end (); ++j)
@@ -399,9 +405,18 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
return true;
}
UpdateRouteLifeTime (origin, ActiveRouteTimeout);
NS_LOG_LOGIC ("Broadcast local delivery to " << iface.GetLocal ());
Ptr<Packet> packet = p->Copy ();
lcb (p, header, iif);
if (lcb.IsNull () == false)
{
NS_LOG_LOGIC ("Broadcast local delivery to " << iface.GetLocal ());
lcb (p, header, iif);
// Fall through to additional processing
}
else
{
NS_LOG_ERROR ("Unable to deliver packet locally due to null callback " << p->GetUid () << " from " << origin);
ecb (p, header, Socket::ERROR_NOROUTETOHOST);
}
if (!EnableBroadcast)
{
return true;
@@ -438,8 +453,16 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p, const Ipv4Header &header,
UpdateRouteLifeTime (toOrigin.GetNextHop (), ActiveRouteTimeout);
m_nb.Update (toOrigin.GetNextHop (), ActiveRouteTimeout);
}
NS_LOG_LOGIC ("Unicast local delivery to " << dst);
lcb (p, header, iif);
if (lcb.IsNull () == false)
{
NS_LOG_LOGIC ("Unicast local delivery to " << dst);
lcb (p, header, iif);
}
else
{
NS_LOG_ERROR ("Unable to deliver packet locally due to null callback " << p->GetUid () << " from " << origin);
ecb (p, header, Socket::ERROR_NOROUTETOHOST);
}
return true;
}