Skip to contentSkip to conversation

Dump the tcp_sock structure for every packet

DISCUSSION Aaron Isotton 1 participant 2 messages May 28, 2006 – May 29, 2006 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi,

I'm doing some kernel hacking to evaluate different TCP congestion control algorithms in a WLAN mesh network.

I need to output some TCP parameters (such as window sizes et al) over time; what I'd wish to do is outputting them to a character device whenever a packet comes in/is sent.

I've written the device code, now I just need to output the parameters using that device. The easiest way would be simply outputting the whole tcp_sock structure to the device, and then reading it in from user space.

The problem is that I don't know where exactly in the TCP implementation the packets are transmitted/received, i.e. where I should send the data over to the device implementation.

The ideal case would of course be some kind of callback/hook function; I imagine there might be something like this for the netfilter modules, but I have no idea.

Can anybody help me with this?

Thank you,
Aaron

Signature · 2 lines
Aaron Isotton | http://www.isotton.com/
I'll give you a definite maybe. --Samuel Goldwyn
#2 lore raw
In reply to a message not in the archive
Quoted 2 lines · Alan Menegotto

The last routine done in tcp is tcp_transmit_skb, which passes the skb down to the IP layer. See net/ipv4/tcp_output.c for details.

Ok, thank you very much. Is there some similar function for incoming packets too?

Greetings,
Aaron

Signature · 2 lines
Aaron Isotton | http://www.isotton.com/
I'll give you a definite maybe. --Samuel Goldwyn