Bug 914

Summary: check local callback status before invoking LocalDelivery
Product: ns-3 Reporter: Tom Henderson <tomh>
Component: olsrAssignee: Gustavo J. A. M. Carneiro <gjcarneiro>
Status: RESOLVED DUPLICATE    
Severity: normal CC: ns-bugs
Priority: P5    
Version: pre-release   
Hardware: All   
OS: All   

Description Tom Henderson 2010-05-17 10:03:47 EDT
Reported by Ken Renard:

In ns3::olsr::RoutingProtocol::RouteInput(), the 'LocalDeliverCallback lcb' parameter might be passed in as a NULL callback if the higher level routing protocol (such as ListRouting) has already delivered this packet locally as a multicast packet.  My 'fix' is simply to check to make sure that lcb.IsNull() is false before trying to call it.  Attached is a simple program that demonstrates this.

Here is a simple patch for addressing this

> --- olsr-routing-protocol.cc    (revision 468)
> +++ olsr-routing-protocol.cc    (revision 469)
> @@ -3004,7 +3004,10 @@
>   if (m_ipv4->IsDestinationAddress (dst, iif))
>     {
>         NS_LOG_LOGIC ("Local delivery to " << dst);
> -        lcb (p, header, iif);
> +        if (lcb.IsNull() == false)
> +          {
> +            lcb (p, header, iif);
> +          }
>         return true;
>     } 

The method Ipv4L3Protocol::IsDestinationAddress() is undocumented, but it clearly returns true for any multicast or broadcast; it may be better to handle unicast, broadcast, and multicast with separate methods.
Comment 1 Gustavo J. A. M. Carneiro 2010-05-31 08:51:11 EDT

*** This bug has been marked as a duplicate of bug 926 ***