Re: debug network packets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



apalaios@xxxxxxxxxxxx wrote:
there is a debug variable in the sock structure that you can enable at various points, and use in instrumentation to conditionally print out data at various points. I usually turn in on in sys_socket, or sys_connect, etc, based on information I have on hand at the time (process name, dest ip, etc).


I couldn't find the debug variable that u told me in the structure..

include/net/sock.h:

struct sock {
...
unsigned char           sk_debug;
...
};


I provide some more information about what i want to achieve.

I want to enable some debug messages concering htb and gred. The reason is that
i want to see the journey of the ip packet through the 2.6 kernel from start to
finish (ethernet interface up to htb and gred classification).

In the sch_htc.c i have found the following

/* debugging support; S is subsystem, these are defined:
  0 - netlink messages
  1 - enqueue
  2 - drop & requeue
  3 - dequeue main
  4 - dequeue one prio DRR part
  5 - dequeue class accounting
  6 - class overlimit status computation
  7 - hint tree
  8 - event queue
 10 - rate estimator
 11 - classifier
 12 - fast dequeue cache

 L is level; 0 = none, 1 = basic info, 2 = detailed, 3 = full
 q->debug uint32 contains 16 2-bit fields one for subsystem starting
 from LSB
 */
#ifdef HTB_DEBUG
#define HTB_DBG_COND(S,L) (((q->debug>>(2*S))&3) >= L)
#define HTB_DBG(S,L,FMT,ARG...) if (HTB_DBG_COND(S,L)) \

but still i don't know what should i change in order to see debug messages in my
dmesg...

It won't be in dmesg, it will be printed on the console, or in /var/log/messages
Also in the same file the following line exists
#define HTB_DEBUG 1     /* compile debugging support (activated by tc tool) */

This will give you debugging info within the scope of this particular file, not the entire tcp stack. You need to decide for yourself if that is sufficient for your needs. If you want to trace the path of a particular frame, or set of frames, you need to instrument the kernel on your own, or use iptables as I mentioned.
Do u know how i can use tc tool for viewing that debug messages?
Thx a lot

Never used tc.


Quoting Neil Horman <nhorman@xxxxxxxxxx>:


apalaios@xxxxxxxxxxxx wrote:

Thx but this means that i must recompile the kernel...right?
I ll check it thx again
Quoting Neil Horman <nhorman@xxxxxxxxxx>:


Thats right. The only other thing I could think of (that doesn't require kernel recompiles) would be to use iptables and the ip_queue or ip_log targets. By adding rules to the all the tables chains (INPUT, PREROUTING, POSTROUTING, OUTPUT, etc.), you could track all packets that matched certain criteria through various points in the kernel. And based on what you logged, or sent to the userspace queue (via netlink), you could probably track an individual packet.


Neil

apalaios@xxxxxxxxxxxx wrote:


Hi... do u know how i can "watch" the path that a packet follows after it

have


been received from the kernel?
I need a low level packet debuger or something else that shows what a

packet do


inside the kernel..

Any suggestion?
Thx


there is a debug variable in the sock structure that you can enable at various points, and use in instrumentation to conditionally print out data at various points. I usually turn in on in sys_socket, or sys_connect, etc, based on information I have on hand at the time (process name, dest ip, etc). That allows me to print out data for a particular socket as its datagrams traverse the IP stack.


HTH
Neil


----------------------------------------------------------------
This message was sent through the TEI of ATHENS by means of NOC. -
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html


--
/***************************************************
*Neil Horman
*Software Engineer
*Red Hat, Inc.
*nhorman@xxxxxxxxxx
*gpg keyid: 1024D / 0x92A74FA1
*http://pgp.mit.edu
***************************************************/






----------------------------------------------------------------
This message was sent through the TEI of ATHENS by means of NOC.


--
/***************************************************
 *Neil Horman
 *Software Engineer
 *Red Hat, Inc.
 *nhorman@xxxxxxxxxx
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/






----------------------------------------------------------------
This message was sent through the TEI of ATHENS by means of NOC.


--
/***************************************************
 *Neil Horman
 *Software Engineer
 *Red Hat, Inc.
 *nhorman@xxxxxxxxxx
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux