Bug 135

Summary: Ipv4 tracing events do not have enough parameters
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: internetAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P3    
Version: pre-release   
Hardware: All   
OS: All   

Description Gustavo J. A. M. Carneiro 2008-02-07 13:20:13 UTC
Regarding the trace event "/nodes/*/ipv4/drop",

void
Ipv4L3Protocol::SendRealOut (bool found,
                             Ipv4Route const &route,
                             Ptr<Packet> packet,
                             Ipv4Header const &ipHeader)
{
  NS_LOG_FUNCTION;
  NS_LOG_PARAMS (this << found << &route << packet << &ipHeader);

  if (!found)
    {
      NS_LOG_WARN ("No route to host.  Drop.");
      m_dropTrace (packet);
      return;
    }
[...]

In the user callback, only the IPv4 payload is received, but there is not information regarding the payload type, so I do not know how to decode the packet (is it UDP, TCP, or...?).

I propose to change the trace callback signature to include also the Ipv4 header:

      m_dropTrace (packet, ipHeader);
Comment 1 Gustavo J. A. M. Carneiro 2008-02-07 13:25:11 UTC
Oh, same thing applies for tx and rx events.  Currently it is not possible to find out what kind of IPv4 packet I am receiving or sending.  The Ipv4Header would allow that.

PS: the code in question is in src/internet-node/ipv4-l3-protocol.{cc,h}.
Comment 2 Tom Henderson 2008-02-11 00:21:26 UTC
is it really the same for tx/rx?  It looks like the header is pushed on before those trace events are called.

I don't mind expanding the callback but I am curious whether moving 
packet->AddHeader (ipHeader);
 to in front of the dropTrace() call would solve this also?
Comment 3 Gustavo J. A. M. Carneiro 2008-02-11 06:14:27 UTC
(In reply to comment #2)
> is it really the same for tx/rx?  It looks like the header is pushed on before
> those trace events are called.

You're right.

> 
> I don't mind expanding the callback but I am curious whether moving 
> packet->AddHeader (ipHeader);
>  to in front of the dropTrace() call would solve this also?
> 

It could.

Thanks for the suggestions.  I think you're right: rx/tx don't need to change; drop could be simply modified to add the IPv4 header before dropping.  Shall I go ahead and make this change?
Comment 4 Tom Henderson 2008-02-11 09:40:26 UTC
I support the change.
Comment 5 Gustavo J. A. M. Carneiro 2008-02-11 10:03:41 UTC
-> http://code.nsnam.org/ns-3-dev/rev/084b07dceafb