Question

I am trying to trace the congestion window of a particular TCP connection in the kernel. The easiest way, I assume would be to use a printk or a printf and print out the corresponding variable which I assume is snd_cwnd in the kernel.

Is there a more standard way to do this? Ideally, I would like to observe how various important TCP parameters change for a particular TCP connection.

Was it helpful?

Solution

You're quite right about using printk, to dump specific data actually printk is the best option.

To observe parameters of particular TCP connection, you might take help of netfilter hooking. Using netfilter kernel module (http://fcns.eu/2010/02/15/netfilter-hooks/) you can track a particular connection and can check every tcp packets you desire.

OTHER TIPS

printk is only usable if you are using low-speed transfers. Using fast transfers the number of changes on these parameters is large and will overflow the dmesg buffer that printk uses. In the past I hacked around some code to using relayfs buffers between kernel and user-space when these parameters changed. These days there is systemtap that should be useful to get inside information in an efficient manner.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top