bug 1046: DSDV: NULL callback

This commit is contained in:
Tom Henderson committed 2011-08-17 16:50:38 -07:00
1 parent eb7d38f909
commit fa0dfb51c7
1 file changed
+27 -4
+27 -4
View File
@@ -368,6 +368,12 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p,
Ipv4Address dst = header.GetDestination ();
Ipv4Address origin = header.GetSource ();
// DSDV is not a multicast routing protocol
if (dst.IsMulticast ())
{
return false;
}
// Deferred route request
if (EnableBuffering == true && idev == m_lo)
{
@@ -396,9 +402,18 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p,
{
if (dst == iface.GetBroadcast () || dst.IsBroadcast ())
{
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 (header.GetTtl () > 1)
{
NS_LOG_LOGIC ("Forward broadcast. TTL " << (uint16_t) header.GetTtl ());
@@ -420,8 +435,16 @@ RoutingProtocol::RouteInput (Ptr<const Packet> p,
if (m_ipv4->IsDestinationAddress (dst, iif))
{
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;
}
RoutingTableEntry toDst;