Tux

...making Linux just a little more fun!

Query on linux source code


Tue, 17 Jun 2008 17:37:55 +0930

Hi Guys,

I was finally able to do the compilation process. Thanks for the help.

Another question:

1. I am using a tcpdump network sniffer to capture packets of the tcp header. I wanted to analyze a specific variable like smoothed rtt (srtt). I already changed the header file to include this new srtt variable into the option side of the tcp.h header file and also change the tcp_input.c source code to incorporate the said variable into the options side. I am confused whether tcp_input.c is the correct code to change since tcp_output.c and tcp.c is also in the linux kernel code. I am also confused how to output this new srtt variable into the tcp header so as to be captured by the tcpdump and be seen in the tracefiles.

Is there a specific function in the code to be manipulated to do the task? Any help would be appreciated.

Thank you very much in advance.

Cheers,

Dom


Top    Back


René Pfeiffer [lynx at luchs.at]


Tue, 17 Jun 2008 15:25:38 +0200

Hello, Dom!

On Jun 17, 2008 at 1737 +0930, Ignacio, Domingo Jr Ostria - igndo001 appear= ed and said:

> [...]
> 1. I am using a tcpdump network sniffer to capture packets of the tcp
> header. I wanted to analyze  a specific variable like smoothed rtt
> (srtt). I already changed the header file to include this new srtt
> variable into  the option side of the tcp.h header file and also change
> the tcp_input.c source code to incorporate the said variable into the
> options side. I am confused whether tcp_input.c is the  correct code to
> change since tcp_output.c and tcp.c is also in the linux kernel code. I
> am also confused how to output this new srtt variable into the tcp
> header so as to be captured by the tcpdump and be seen in the
> tracefiles. Is there a specific function in the code to be manipulated
> to do the task? [...]

The TCP state machine is quite a complex piece of code, so you should take a look at the packet flow. The documentation is a bit scarce. While preparing my article for LG #135 I found http://vger.kernel.org/~davem/tcp_output.html and the links at http://www.linuxfoundation.org/en/Net:TCP to be useful.

I don't think you can add the srtt variable to the TCP header. The header has not field for this information left. The best way to capture this is to watch sender and receiver by using kprobes (http://www.linuxfoundation.org/en/Net:TcpProbe shows you an example) or by use the getsockopt() call I used in the example code of my articles. If you find another way, I'd like to know about it.

Best, René.


Top    Back