Tux

...making Linux just a little more fun!

tcp.c and tcp_input inquiry


Fri, 30 May 2008 12:13:58 +0930

Hi guys,

Good day!

I am currently doing my phd in telecommunications working on tcp. I found the document tcp_input.c and tc.c source code document at a website but browsing through my kernel, I cannot find the source codes mentioned. Thus, this inquiry.

It would be appreciated if you can kindly help me on my questions since I am new to tcp.

1. I am using fedora core6 linux and I cannot find the file tcp_input.c and tcp.c in the kernel. Where can I find this code in the kernel since I need to do some modification on the tcp header as part of my thesis?

2. What are the steps in inserting an estimated value into a kernel variable?

I have already visited the linux kernel faq and I cannot find the answer to my questions ( or maybe I need to browse more:-(). I hope you can shed light on the above queries. Thank you very much in advance.

Cheers,

Dom Ignacio


Top    Back


Mulyadi Santosa [mulyadi.santosa at gmail.com]


Fri, 30 May 2008 09:51:44 +0700

Hello...

On Fri, May 30, 2008 at 9:43 AM, Ignacio, Domingo Jr Ostria - igndo001 <DomingoJr.Ignacio@postgrads.unisa.edu.au> wrote:

> Hi guys,
>
> Good day!
>
> I am currently doing my  phd in telecommunications  working on tcp. I found
> the document tcp_input.c  and tc.c source code document at a website  but
> browsing through my kernel, I cannot find the source codes mentioned.  Thus,
> this inquiry.
>
> It would be appreciated if you can kindly help me on my questions since I am
> new to tcp.
>
> 1.      I am using fedora core6 linux and I cannot find the file
> tcp_input.c  and tcp.c in the kernel. Where can I find this code in the
> kernel  since I need to do some modification on the tcp header as part of my
> thesis?

IIRC, check net/ipv4 directory inside Linux kernel source tree. Most likely, you need to check sk_buff structure. To speed up the search, use cscope or utilize online tool such as lxr.linux.no

> 2.      What are the steps  in inserting an estimated value into a kernel
> variable?

I don't get it..... can you elaborate?

regards,

Mulyadi.


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Fri, 30 May 2008 00:17:48 -0400

On Fri, May 30, 2008 at 12:13:58PM +0930, Ignacio, Domingo Jr Ostria - igndo001 wrote:

>    Hi guys,
> 
>    Good day!
> 
>    I am currently doing my  phd in telecommunications  working on tcp. I
>    found the document tcp_input.c  and tc.c source code document at a
>    website  but browsing through my kernel, I cannot find the source codes
>    mentioned.  Thus, this inquiry.
> 
>    It would be appreciated if you can kindly help me on my questions since I
>    am new to tcp.
> 
>    1.      I am using fedora core6 linux and I cannot find the file
>    tcp_input.c  and tcp.c in the kernel. Where can I find this code in the
>    kernel  since I need to do some modification on the tcp header as part of
>    my thesis?

Oh, good - an easy one. :)

ben@Tyr:~$ find /usr/src/linux-2.6.20 -name 'tcp.c' -o -name 'tcp_input.c'
/usr/src/linux-2.6.20/fs/ocfs2/cluster/tcp.c
/usr/src/linux-2.6.20/net/ipv4/tcp.c
/usr/src/linux-2.6.20/net/ipv4/tcp_input.c
>    2.      What are the steps  in inserting an estimated value into a kernel
>    variable?

[blink] That sounds like getting sent to get a gasket stretcher or a hundred yards of flight line. An estimated value? Either somebody is playing with your mind, or you've misunderstood your assignment.

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *


Top    Back


Piyush_Mundra [Piyush_Mundra at satyam.com]


Fri, 30 May 2008 11:59:50 +0530

Hi,

It might be that your FC6 is not having the kernel source code in the /usr/src directory. If possible do one thing:

Download any tar of latest kernel 2.6 and build it. Then u will be able to find the files in the /usr/src/ <kernel-number> directory.

To build a kernel from scratch there are lots of sites out there which will help u out.

Happy kernel building.

Cheers,

Piyush


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Fri, 30 May 2008 08:34:29 -0400

[ eliding querent ]

On Fri, May 30, 2008 at 11:59:50AM +0530, Piyush_Mundra wrote:

>    Hi,
> 
>    It might be that your FC6 is not having the kernel source code in the
>    /us                r/src directory. If possible do one thing:
> 
>    Download any tar of latest kernel 2.6 and build it. Then u will be able to
>    find the files in the /usr/src/ <kernel-number> directory.
> 
>    To build a kernel from scratch there are lots of sites out there which
>    will help u out.
> 
>    Happy kernel building.
Hi, Piyush -

Welcome to TAG and thanks for trying to help out; I appreciate that. The list policy violations, on the other hand, not so much.

1) You clearly have not read The Answer Gang FAQ or "Asking Questions of The Answer Gang" - strike one, a big one. It's considered rude, netiquette-wise, to just jump into a group without understanding its culture and policies.

http://linuxgazette.net/faq/ask-the-gang.html http://linuxgazette.net/faq/members-faq.html

2) Top-posting is considered rude pretty much everywhere.

3) Sending HTML mail instead of plain text - you're just stacking them up, aren't you? This is inconsiderate of other people's bandwidth, as well as requiring our Mailbag Editor to mess about deleting the unnecessary extra copy of your mail. Turn that off, please.

4) I don't know who this "u" is that you keep talking to, but I'd appreciate it if you'd leave him out of TAG. The second person informal pronoun - the standard English construction used in these cases - is "you"; please use it if that's what you mean. A reasonable amount of attention paid to spelling and grammar is also considered polite in communicating with other people.

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Fri, 30 May 2008 08:42:53 -0400

On Fri, May 30, 2008 at 11:59:50AM +0530, Piyush_Mundra wrote:

>    Hi,
> 
>    It might be that your FC6 is not having the kernel source code in the
>    /us                r/src directory. If possible do one thing:
As far as I'm aware, no Linux distro contains a
"/us                r/src"
directory. They generally do have a "/usr/src" directory, though.

>    Download any tar of latest kernel 2.6 and build it. Then u will be able to
>    find the files in the /usr/src/ <kernel-number> directory.
It is not necessary to build anything - the ".c" files are the source code, not the compiled programs.

>   To build a kernel from scratch there are lots of sites out there which
>   will help u out.
>
>   Happy kernel building.

None of which, unfortunately, is related to the question that was asked.

I've also just noticed that Piyush's post was not CCd to the original querent, so I'm re-adding him to the list.

-- 
* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *


Top    Back


Ben Okopnik [ben at linuxgazette.net]


Mon, 2 Jun 2008 18:30:04 -0400

----- Forwarded message from "Ignacio, Domingo Jr Ostria - igndo001" <DomingoJr.Ignacio@postgrads.unisa.edu.au> -----

Subject: RE: [TAG] tcp.c and tcp_input inquiry
Date: Mon, 2 Jun 2008 12:52:53 +0930
From: "Ignacio, Domingo Jr Ostria - igndo001" <DomingoJr.Ignacio@postgrads.unisa.edu.au>
To: Ben Okopnik <ben@linuxgazette.net>
Hi Ben,

Thank you for the reply.

I used 2.6.18-1.2798.fc6-i586 and going into the path file: /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux, I can only find the header file tcp.h and there is no tcp.c or any source codes available. I just wonder whether I have to rebuild the kernel again or grab the latest fedora core release to get the source codes. The tcp.c and the tcp_input files must be somewhere hidden in the kernel but I cannot just find it. Would appreciate your help guys and thank you in advance... cheers, dom

----- End forwarded message -----


Top    Back


René Pfeiffer [lynx at luchs.at]


Tue, 3 Jun 2008 01:41:00 +0200

On Jun 02, 2008 at 1830 -0400, Ben Okopnik appeared and said:

> ----- Forwarded message from "Ignacio, Domingo Jr Ostria - igndo001" <DomingoJr.Ignacio@postgrads.unisa.edu.au> -----
>
> Subject: RE: [TAG] tcp.c and tcp_input inquiry
> Date: Mon, 2 Jun 2008 12:52:53 +0930
> From: "Ignacio, Domingo Jr Ostria - igndo001" <DomingoJr.Ignacio@postgrads.unisa.edu.au>
> To: Ben Okopnik <ben@linuxgazette.net>
>
> Hi Ben,
> Thank you for the reply.
> I used  2.6.18-1.2798.fc6-i586 and going into the path file:
> /usr/src/kernels/2.6.18-1.2798.fc6-i586/include/linux, I can only find
> the header file tcp.h and there is no tcp.c or any source codes
> available. I just wonder whether I have to rebuild the kernel again or
> grab the latest fedora core release to get the source codes. The tcp.c
> and the tcp_input files must be somewhere hidden in the kernel but I
> cannot just find it. Would appreciate your help guys and thank you in
> advance... cheers, dom

Try the following:

cd /usr/src/kernels/2.6.18-1.2798.fc6-i586
find . -type f -name tcp.h
find . -type f -name tcp.c

On my system it produces the following (albeit with a different kernel version):

lynx@nightfall:/lib/modules/2.6.24.4/build$ find . -type f -name tcp.h
./fs/ocfs2/cluster/tcp.h
./include/config/nfsd/tcp.h
./include/config/iscsi/tcp.h
./include/linux/tcp.h
./include/net/tcp.h
lynx@nightfall:/lib/modules/2.6.24.4/build$ find . -type f -name tcp.c
./fs/ocfs2/cluster/tcp.c
./net/ipv4/tcp.c
lynx@nightfall:/lib/modules/2.6.24.4/build$

The command "cd /lib/modules/`uname -r`/build" will often take you to the source tree for your running kernel version (mind the `, they are important).

If this doesn't provide a similar output the chances are that you still don't have the kernel source. You can always use the source from www.kernel.org and compile it.

Cheers, René.


Top    Back


Deividson Okopnik [deivid.okop at gmail.com]


Mon, 2 Jun 2008 21:36:36 -0300

Just something important for this thread:

>> I just wonder whether I have to rebuild the kernel again or
>> grab the latest fedora core release to get the source codes.

I see a little misunderstanding there

You do NOT need to compile your kernel to see the source. If the .c file you are looking for is not there, it means you dont have the kernel source (thus cant build/compile it).

As René said - www.kernel.org is a good start to download it.


Top    Back



Tue, 3 Jun 2008 14:14:15 +0930

Hi guys,

Thank you very much for the help. I finally found the codes after getting the source from www.kernel.org and building it. It was a great help. One more question guys, is there a tcp option part in the code ( tcp.c or tcp_input.c) where I can modify and/or insert a new variable like congestion window or rtt? Any help would be appreciated.

Cheers, dom


Top    Back


René Pfeiffer [lynx at luchs.at]


Tue, 3 Jun 2008 12:06:24 +0200

ed and said:

> Hi guys,
>  Thank you very much for the help. I finally found the codes after
>  getting the source from www.kernel.org and building it.

Great. :)

> [...] One more question guys, is there a tcp option part in the
>  code ( tcp.c or tcp_input.c) where I can modify and/or insert a new
>  variable like congestion window or rtt? Any help would be
>  appreciated.

The recent kernels starting with 2.6.13 allow TCP congestion algorithms added as a module. http://acs.lbl.gov/TCP-tuning/linux-2.6.13-tcp.txt has some short information about that. At the end of my article in LG #135 (http://www.luchs.at/linuxgazette/135/pfeiffer.html links to a mirror, I can't reach the main site right now) you can find links to implementations of congestion algorithms. The code of most modules isn't too big and you might use one of the implementations to see how it works.

Cheers, René.

-- 
  )\._.,--....,'``.  fL  Let GNU/Linux work for you while you take a nap.
 /,   _.. \   _\  (`._ ,. R. Pfeiffer <lynx at luchs.at> + http://web.luchs.at/
`._.-(,_..'--(,_..'`-.;.'  - System administration + Consulting + Teaching -
Got mail delivery problems? http://web.luchs.at/information/blockedmail.php


Top    Back