Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

[ Create a new account ]

The Linux Networking Stack Exposed

Posted by CmdrTaco on Mon Aug 13, 2007 11:02 AM
from the august-rules dept.
An anonymous reader writes "The Linux source code is a great way to learn about the design of device drivers for a multitude of device types, including network device drivers. This article will show you the basic architecture of the Linux networking stack and dig into its interfaces for system calls, protocols, and device drivers."

Related Stories

This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • well (Score:5, Funny)

    by Anonymous Coward on Monday August 13, @11:07AM (#20213047)
    I doubt we're going to see any +5 funny mods in this one
    • well-Stripping packets. by Anonymous Coward (Score:3) Monday August 13, @11:25AM
    • Re:well (Score:5, Funny)

      I doubt we're going to see any +5 funny mods in this one

      Oh yeah?

      So, a UDP connection walks into a bar and it goes up to the bartender.

      "Hi bartender, " it says to the bartender.

      "Howdy, UDP connection. What'll it be?" the bartender asks.

      "I'll have a beer please. Here's a dollar," says the UDP connection.

      The bartender takes the dollar, looks at the UDP connection, and continues wiping glasses.

      "So, what'll it be?" the bartender asks the UDP connection.

      The UDP connection forks over another dollar and orders a beer again. The bartender takes the dollar and stares expectantly at the UDP connection as he continues to wipe glasses.

      "So, what are you gonna drink, little UDP connection?" the bartender asks.

      "I would like a beer please," and the UDP connection gives the bartender yet another dollar. The bartender takes the dollar and promptly starts wiping the counter. He looks thatthe UDP connection and asks,

      "Oh, hello there. Can I get you anything?"

      "Yes please," responds the UDP connection, "I'd like a beer. Here is a dollar." And the UDP connection gives the bartender yet another dollar.

      And so on...

      [ Parent ]
      • Re:well (Score:5, Funny)

        by weicco (645927) on Monday August 13, @12:15PM (#20213903)

        And when TCP walks into the bar and asks for beer bartender opens the tap and lets beer stream... But before that they have to shake hands three times.

        [ Parent ]
        • Re:well by owlstead (Score:2) Monday August 13, @01:36PM
          • Re:well by ATMD (Score:2) Monday August 13, @02:44PM
        • Re:well (Score:4, Informative)

          by kdemetter (965669) on Monday August 13, @04:29PM (#20217103)
          it would be more like :

          TCP : Can i get a beer ?
          Bartender : You asked for a beer ?
          TCP : Yes i did .
          Bartender : Ok , here's the beer , that will be ...
          TCP : did you just tell me how much to pay you ?
          Bartender : yes i did .
          TCP : ok , here's ...

          and say the bartender has bad hearing ;

          TCP : Can i get a beer ?
          Bartender : You asked for a lemonade ?
          TCP : no i didn't .
          TCP : Can i get a beer ?
          Bartender : Ok , here's the beer , that will be ...
          TCP : did you just tell me how much to pay you ?
          Bartender : yes i did .
          TCP : ok , here's ...

          TCP constantly verifies that the data was received , while udp only verifies that the data was correct . udp would end up with a lemonade , drink it , and just order a beer again .

          [ Parent ]
        • Re:well by Wolfger (Score:2) Tuesday August 14, @06:47AM
          • Re:well by weicco (Score:2) Tuesday August 14, @11:19AM
            • Re:well by Wolfger (Score:2) Tuesday August 14, @11:27AM
              • Re:well by weicco (Score:2) Tuesday August 14, @11:44AM
      • Re:well (Score:4, Funny)

        by riffzifnab (449869) on Monday August 13, @12:16PM (#20213921)
        (Last Journal: Wednesday October 03, @08:46AM)

        Oh yeah?

        So, a UDP connection walks into a bar and it goes up to the bartender.

        "Hi bartender, " it says to the bartender.

        "Howdy, UDP connection. What'll it be?" the bartender asks.

        "I'll have a beer please. Here's a dollar," says the UDP connection.

        The bartender takes the dollar, looks at the UDP connection, and continues wiping glasses.

        "So, what'll it be?" the bartender asks the UDP connection.

        The UDP connection forks over another dollar and orders a beer again. The bartender takes the dollar and stares expectantly at the UDP connection as he continues to wipe glasses.

        "So, what are you gonna drink, little UDP connection?" the bartender asks.

        "I would like a beer please," and the UDP connection gives the bartender yet another dollar. The bartender takes the dollar and promptly starts wiping the counter. He looks thatthe UDP connection and asks,

        "Oh, hello there. Can I get you anything?"

        "Yes please," responds the UDP connection, "I'd like a beer. Here is a dollar." And the UDP connection gives the bartender yet another dollar.

        And so on...
        [Memento joke here]

        So I guess writing stuff down on it's arms would turn the UDP connection into a TFTP session.
        [ Parent ]
      • Re:well by Almahtar (Score:3) Tuesday August 14, @01:27AM
    • Re:well by flydpnkrtn (Score:3) Monday August 13, @12:17PM
      • Re:well by Control Group (Score:2) Monday August 13, @12:30PM
    • Re:well by htiawe (Score:1) Monday August 13, @06:52PM
    • 3 replies beneath your current threshold.
  • Where's the NetBIOS? (Score:2, Funny)

    by filesiteguy (695431) on Monday August 13, @11:08AM (#20213049)
    (http://www.perfectreign.com/)
    How come I don't see any references to NetBIOS in the stack?
  • Expose it, babe! (Score:2, Funny)

    by Anonymous Coward on Monday August 13, @11:09AM (#20213069)
  • Personally I'd say Minix is much easier to navigate, simpler to understand and a much better starting point for new kernel developers or students to begin with (it was designed primarily as an academic project).

    I've tried digging around the Linux source code, but find a lot of it fairly confusing simply because of the amount of time and effort you have to invest in understanding the rest of it and general architecture.

    With Minix, you can pretty much jump in at any place (being very organized and well separated you can find what you're looking for fast), in 3.0 the core syscalls are separated into different files and the core kernel is only around 5000 lines which you can scan through fairly quickly.
  • Beg to differ (Score:3, Interesting)

    by Ancient_Hacker (751168) on Monday August 13, @11:41AM (#20213439)
    IMHO the networking stack is quite uninteresting. On the bottom, it's constrained by the networking protocols and network interfaces. On the top it's constrained by the Unix and socket interfaces. That doesnt leave a whole lot of room for innovative bits in the middle.
    • Unix sockets .. by rs232 (Score:2) Monday August 13, @12:02PM
    • Re:Beg to differ (Score:5, Funny)

      by Slashcrap (869349) on Monday August 13, @12:10PM (#20213867)
      IMHO the networking stack is quite uninteresting. On the bottom, it's constrained by the networking protocols and network interfaces.

      Yes, the Linux network stack has always been constrained by the fact that it has to handle networking.

      I contributed a series of highly innovative patches that added 3D Graphics and AJAX support to the Linux TCP/IP stack. Were those kernel developers interested? Were they fuck.

      Just another reason why Linux will continue to lag behind Windows and OSX in the innovation stakes.
      [ Parent ]
    • Re:Beg to differ by Daniel Phillips (Score:2) Monday August 13, @07:40PM
    • 1 reply beneath your current threshold.
  • Broken link (Score:1)

    by ekimminau (775300) on Monday August 13, @12:02PM (#20213751)
    (http://beamsport.com/ | Last Journal: Wednesday August 15, @06:03PM)
    The imbedded link is broken. Try here instead: http://www.ibm.com/developerworks/linux/library/l- linux-networking-stack/ [ibm.com]
  • When I saw this headline.... (Score:5, Funny)

    by LordPhantom (763327) on Monday August 13, @12:57PM (#20214429)
    .... I became so excited I nearly had a buffer overflow!
  • by viking80 (697716) on Monday August 13, @01:24PM (#20214769)
    (Last Journal: Sunday September 16, @03:39PM)
    Seems like both the TCP/IP bible and the TCP/IP packet layout is missing from this article, so here it is:
    1. the book: TCP/IP Illustrated, Volume 1 by W. Richard Stevens
    2.
    from netinet/ip.h /* Per RFC 791 */
    struct ip {
            uint8_t ip_hl:4, /* header length */
                            ip_v:4; /* version */
            uint8_t ip_tos; /* type of service */
            uint16_t ip_len; /* total length */
            uint16_t ip_id; /* identification */
            uint16_t ip_off; /* fragment offset field */
            uint8_t ip_ttl; /* time to live */
            uint8_t ip_p; /* protocol */
            uint16_t ip_sum; /* checksum */
            struct in_addr ip_src,ip_dst; /* source and dest address */
    };

    from netinet/tcp.h: /* Per RFC 793 */
    struct tcphdr {
            uint16_t th_sport; /* source port */
            uint16_t th_dport; /* destination port */
            tcp_seq th_seq; /* sequence number */
            tcp_seq th_ack; /* acknowledgement number */
            uint8_t th_x2:4, /* (unused) */
                            th_off:4; /* data offset */
            uint8_t th_flags;
            uint16_t th_win; /* window */
            uint16_t th_sum; /* checksum */
            uint16_t th_urp; /* urgent pointer */
    };
  • by Dareth (47614) on Monday August 13, @02:27PM (#20215533)
    ... or SCO might find some "new and improved" infringements on the Unix rights they don't own.

    SCO: How do we get our hands on the code for Linux?
    Lawyer: Pay me $$$ and I will get the courts to order it handed over.
    SCO: You are such a bargain!
  • I want those (Score:1)

    by widman (1107617) on Monday August 13, @06:19PM (#20218475)
    15 seconds back.
  • Re:OOOOhhh (Score:5, Funny)

    by A beautiful mind (821714) on Monday August 13, @11:23AM (#20213255)
    My server is like a beautiful exotic woman. She ignores the obvious attempts to get close to her, but if you know the right ports, she opens up. Of course, she encourages security and doesn't allow unprotected remote ehm...administration.
    [ Parent ]
    • Re:OOOOhhh by CodeShark (Score:1) Monday August 13, @11:38AM
      • Re:OOOOhhh by somersault (Score:2) Monday August 13, @11:52AM
        • Re:OOOOhhh by somersault (Score:2) Monday August 13, @03:41PM
        • 1 reply beneath your current threshold.
    • Re:OOOOhhh by PPH (Score:3) Monday August 13, @11:42AM
    • Re:OOOOhhh by Tribbin (Score:2) Monday August 13, @01:17PM
    • Re:OOOOhhh by CoolVibe (Score:2) Monday August 13, @01:45PM
    • Re:OOOOhhh by Agripa (Score:2) Monday August 13, @08:54PM
    • Re:OOOOhhh by mollymoo (Score:2) Tuesday August 14, @09:06PM
  • 2 replies beneath your current threshold.