Thread: Where is the TCP source code in Ubuntu 10.04?

  1. #1
    Registered User
    Join Date
    Jan 2012
    Posts
    37

    Where is the TCP source code in Ubuntu 10.04?

    I was wondering if anyone knows where the TCP source code is located in Ubuntu 10.04
    I ask because I would like to modify the code (like how Cal Tech modify it to FAST TCP)
    I try the directory usr/src/linux/net/ipv4 (This directory may not be 100% correct but I will check when I get back to my Linux computer), but I could not find the TCP.c file.
    Unless this file does not exist?

    If it does not exist then would you happen to know which file I would want to look at so I could modify just like the FAST-TCP?

    I have attached a TCP.c file that I have found and downloaded, but I really do not believe this has to be the correct file. For one I cannot find this in my Linux Desktop and two this is like 3000 lines of codes; it would take me forever to read and understand the code lol.

    Thanks for the help.
    Attached Files Attached Files
    • File Type: c .c (86.5 KB, 355 views)

  2. #2
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    If in doubt, try LXR: LXR linux/net/ipv4/

    Scroll down and you'll see a bunch of tcp_xxx.c files that have all the necessary code.

    -------

    But honestly, if you're put off by reading 3k lines of code, you shouldn't try to modify it.

  3. #3
    Registered User
    Join Date
    Jan 2012
    Posts
    37
    The code I attached on my first post is where I got the link you have posted. To be honest looking through all those codes are unreasonable.
    I see all the multiple tcp_xxx.c files, but I do not know which one I need to modify to create/make similar like the FAST-TCP
    Also I would like to know where is the TCP code is located in Linux (Ubuntu 10.04); if you have any idea where it is.

    Thanks

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    And the ignorant one when observing the work of the expert will say "It must be an illusion"
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    all of the files are relevant. it's clear that you don't understand the scope of what you're hoping to accomplish. kernel code for basic network protocols is not something for beginners to toy with. kernel programmers are generally highly experienced professional developers. if this doesn't describe you, then you're going to have a lot of difficulty understanding this task.

  6. #6
    Registered User
    Join Date
    Jan 2012
    Posts
    37
    Well even with discouragement I would still at least try. If it is still okay would like to ask questions.

    So when I go to the directory on my Desktop Linux usr/src/linux-headers-2.6.32-38/net/ipv4 I do not see any files in c/c++/h.
    Though the only file I do see is Kconfig and Makefile and a folder call netfilter.

    I was told that the TCP was a pre-compiled, so I assume that the tcp.c code doesn't exist in the Desktop. Is that correct?

  7. #7
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    I confess, this had me mildly curious.

    From what I understand this "FAST TCP" thing significantly changes the network congestion protocol.

    Okay...

    Do you understand that the "FAST TCP" implementation seems best used in large clusters?

    In other words, you aren't going to get a faster download from your favorite pr0n sites.

    On the other hand, if you are supercomputing on your local network having hundreds of machines, enough that congestion is a thing, this could really help.

    Of course, if you are responsible for hundreds of machines it is unlikely you'd have so little experience thinking you patch this into the "Linux" kernel all by yourself easily.

    Soma

  8. #8
    Registered User
    Join Date
    Jan 2012
    Posts
    37
    phantomotap:

    I actually did not know that FAST TCP best usage is in multiple machines, but thank you for telling me something new.
    I am not doing any that big.

    Right now I am looking where I need to modify the TCP so I can make something similar like the FAST TCP for just my Desktop.

    Does anyone know a forum or any places where I could learn Kernel so I can continue on this research?

    Someone told me that there are two parts to this - the kernel code, and the user-space code
    Also that I
    need to install the source repositories and then download/install the sources.
    Does this sounds familiar to anyone?

  9. #9
    Registered User ledow's Avatar
    Join Date
    Dec 2011
    Posts
    435
    geewhan - seriously, you're doing the equivalent of asking a board full of model rocket enthusiasts where the code NASA uses to run the MIR space station is, and hoping you can just dive in and change stuff in it after a quick read through once you DO find it (and, also, seem to be of the believe that you could make MIR orbit Mars instead by just tweaking the code a bit).

    Linux's TCP stack is some tens of thousands of lines of code. Windows TCP is the same. BSD's stack is the same. All of them different, all of them the product of DECADES of work (all TCP stacks can be traced back to 1960's Unix roots) by industry big-names (e.g. the people who invented the Internet and the people who keep it running now). I'd be amazed if you'd ever compiled a kernel from scratch, if I'm honest (given that you have no idea what a Makefile is), let alone could understand more than 1% of the file (hell, even the comments in Linux kernel code baffle me at times).

    I reckon if I sat and pored over it for a decade of two, I'd have only slightly more understanding of what that code does, why it does it the way it does, and where improvements could theoretically be made. And I spend my life building networks and writing programs.

    Trust me on this - seriously, trust me. If you can't manage to download the code, find the relevant .c/.h files and compile a modified version of them (hell, with one space extra in a printf), then you are not going to be able to perform any miracles ripping apart a TCP stack for at least the next five years, no matter how clever you are or hard you try.

    And what, exactly, do you think you're going to do that the people who DID write that code (that you can't even find, let alone understand) wouldn't have done for you if it provided any benefit? Hell, Google even pretty much abandoned their SPDY SSL protocol and they invented it and could prove it gave real-world benefits because of the upkeep burden of the code!

    You are seriously coming across like a petulant child insisting that if Daddy would just let you take the walls out of the house, you could build it again in a more efficient manner.

    - Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
    - A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
    - The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.

  10. #10
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by geewhan View Post
    Does anyone know a forum or any places where I could learn Kernel so I can continue on this research?
    Welcome to Linux From Scratch!

    It would likely take me a year or more just to compile Linux from scratch without changing a single line of code.
    But, who knows you might be a Genius; The Linux Kernel is the main piece of Linux; this site should have some info on it.

    NOTE: The people who compile/work with the Linux Kernel would almost all have the knowledge this site supplies.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  11. #11
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by stahta01 View Post
    It would likely take me a year or more just to compile Linux from scratch without changing a single line of code.
    Where is the TCP source code in Ubuntu 10.04?-219-o-rly-jpg

  12. #12
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    @manasij7479: I figure the Linux Kernel must be harder than Compiling MinGW GCC; I spent a few days on that before I gave up.
    Note: This was trying to compile under windows which is harder than under Linux.

    I am a windows programmer; who knows a some Linux/Unix command syntax.
    Learning the required Linux Knowledge that compiling the Linux from scratch likely assumes would take me several weeks to learn.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  13. #13
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by stahta01 View Post
    @manasij7479: I figure the Linux Kernel must be harder than Compiling MinGW GCC; I spent a few days on that before I gave up.
    Note: This was trying to compile under windows which is harder than under Linux.
    Compiling the toolchain is actually the hardest part, in my opinion.
    After you have that ready, it is mostly a matter of placing the right source in the right directory and invoking make.
    There is much more going on under the hood, but on Linux, that is pretty much done automagically if the dependencies are not messed up. (which the LFS book describes very well)

  14. #14
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    back in the late 90's, on my PentiumII, it took about 25 minutes to build a linux 1.6 kernel. granted, the kernel is much bigger now, but on a fast machine, even with full optimisations turned on, it certainly shouldn't take any more than that. my dual core linux laptop builds all of gcc 4.7 in about 4 hours or less.

  15. #15
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Hmm, I built gcc 4.7 a while ago on a dual core laptop and it couldn't have taken much more than an hour, I think, if that, including the standard libraries. For sure kernel builds on a contemporary machine are like 5-10 minutes. Configuring the thing is what takes the better part of a year .

    I ask because I would like to modify the code (like how Cal Tech modify it [...] looking through all those codes are unreasonable.
    Ah -- this must be from the "Things from Cal Tech you can do at home this weekend" list.
    Last edited by MK27; 05-30-2012 at 03:54 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. is object code the same as assembly source code?
    By c_weed in forum Tech Board
    Replies: 3
    Last Post: 01-05-2012, 07:25 PM
  2. Problem With Code In Ubuntu ,please Help Me
    By krisvamc in forum C Programming
    Replies: 2
    Last Post: 04-12-2007, 11:55 PM
  3. Problem With Code In Ubuntu ,please Help Me
    By krisvamc in forum Linux Programming
    Replies: 0
    Last Post: 04-12-2007, 05:08 PM