Add more useful information to the Drop trace source
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed May 06 18:25:16 2009 +0100 (10 months ago)
changeset 3959166a0ca01817
parent 3958 f6c7282ed078
child 3960 db962781a610
Add more useful information to the Drop trace source
src/internet-stack/ipv4-l3-protocol.cc
src/internet-stack/ipv4-l3-protocol.h
     1.1 --- a/src/internet-stack/ipv4-l3-protocol.cc	Wed May 06 18:24:45 2009 +0100
     1.2 +++ b/src/internet-stack/ipv4-l3-protocol.cc	Wed May 06 18:25:16 2009 +0100
     1.3 @@ -521,7 +521,7 @@
     1.4  
     1.5    if (!ipHeader.IsChecksumOk ()) 
     1.6      {
     1.7 -      m_dropTrace (packet);
     1.8 +      m_dropTrace (ipHeader, packet, DROP_BAD_CHECKSUM, index);
     1.9        return;
    1.10      }
    1.11  
    1.12 @@ -666,7 +666,7 @@
    1.13    if (!found)
    1.14      {
    1.15        NS_LOG_WARN ("No route to host.  Drop.");
    1.16 -      m_dropTrace (packet);
    1.17 +      m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, 0);
    1.18        return;
    1.19      }
    1.20  
    1.21 @@ -739,7 +739,7 @@
    1.22        // Should send ttl expired here
    1.23        // XXX
    1.24        NS_LOG_LOGIC ("Not for me (TTL expired).  Drop");
    1.25 -      m_dropTrace (packet);
    1.26 +      m_dropTrace (ipHeader, packet, DROP_TTL_EXPIRED, ifIndex);
    1.27        return true;
    1.28      }
    1.29    ipHeader.SetTtl (ipHeader.GetTtl () - 1);
     2.1 --- a/src/internet-stack/ipv4-l3-protocol.h	Wed May 06 18:24:45 2009 +0100
     2.2 +++ b/src/internet-stack/ipv4-l3-protocol.h	Wed May 06 18:25:16 2009 +0100
     2.3 @@ -60,6 +60,14 @@
     2.4  
     2.5    void SetNode (Ptr<Node> node);
     2.6  
     2.7 +
     2.8 +  enum DropReason 
     2.9 +    {
    2.10 +      DROP_TTL_EXPIRED,
    2.11 +      DROP_NO_ROUTE,
    2.12 +      DROP_BAD_CHECKSUM,
    2.13 +    };
    2.14 +
    2.15    /**
    2.16     * \param protocol a template for the protocol to add to this L4 Demux.
    2.17     * \returns the L4Protocol effectively added.
    2.18 @@ -248,7 +256,9 @@
    2.19  
    2.20    TracedCallback<Ptr<const Packet>, uint32_t> m_txTrace;
    2.21    TracedCallback<Ptr<const Packet>, uint32_t> m_rxTrace;
    2.22 -  TracedCallback<Ptr<const Packet> > m_dropTrace;
    2.23 +
    2.24 +  // <ip-header, payload, reason, ifindex> (ifindex not valid if reason is DROP_NO_ROUTE)
    2.25 +  TracedCallback<const Ipv4Header &, Ptr<const Packet>, DropReason, uint32_t> m_dropTrace;
    2.26  
    2.27    Ipv4RoutingProtocolList m_routingProtocols;
    2.28