Bug 135 - Ipv4 tracing events do not have enough parameters
: Ipv4 tracing events do not have enough parameters
Status: RESOLVED FIXED
: ns-3
internet-stack
: pre-release
: All All
: P3 enhancement
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2008-02-07 13:20 EDT by
Modified: 2008-02-11 10:03 EDT (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-02-07 13:20:13 EDT
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 From 2008-02-07 13:25:11 EDT -------
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 From 2008-02-11 00:21:26 EDT -------
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 From 2008-02-11 06:14:27 EDT -------
(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 From 2008-02-11 09:40:26 EDT -------
I support the change.
------- Comment #5 From 2008-02-11 10:03:41 EDT -------
-> http://code.nsnam.org/ns-3-dev/rev/084b07dceafb