Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×

TwIP - An IP Stack In a Tweet 81

Adam Dunkels writes "Inspired by the Twitter-sized program that crashes Mac OS X, I just wrote a really, really rudimentary IP stack called twIP, small enough to fit in a Twitter tweet. Although twIP is very far away from a real IP stack, it can do the first task of any IP stack: respond to pings. The entire source code can be found in this 128-character-long tweet. For those who are interested in low-level network programming, a code walkthrough with instructions on how to run the code under FreeBSD is available here. The FAQ: Q: why? A: for fun."
This discussion has been archived. No new comments can be posted.

TwIP - An IP Stack In a Tweet

Comments Filter:
  • by Gopal.V ( 532678 ) on Sunday August 30, 2009 @06:40PM (#29255147) Homepage Journal

    I tried this particular piece of code out and it works! Of course, the ping buffer and the IP swap is just so obviously simple ... WOW!

    The "everything is a file" unix philosophy really does kick in and pull its weight in this example. Sockets, network devices, hardware block devices ... You can write an app to do pretty much anything with any of these, with just file streams. Oh, yeah ... dd'ing entire flash drives, netcating sockets, rsync'ing root partitions over. I often am completely amazed by the complexity that simple pieces can produce.

    Now everyone - stop talking bad about twitter ... it's awesome, it's simple and it's given random people the idea that I'm interesting & intelligent ;)

  • Addendum (Score:5, Interesting)

    by Looce ( 1062620 ) * on Sunday August 30, 2009 @06:41PM (#29255157) Journal

    Haha! This article is rated purple (2 levels above the lowest -- black) already. Wow.

    Anyhow. The fact that the TwIP program requires an IP stack to work is the prime indication that it doesn't really do all that much. Since it can work with raw socket access, and switches the addresses around, well, props, but TFA's "header" code comment says this:

    updating the ICMP checksum

    which is then contradicted by the code comment before the address swap:

    Since we only swap bytes in the IP header, we do not need to update the IP header checksum.

    using ICMP and IP interchangeably..?

    timothy, take this down. Now. It's your only chance to save face with this article.

  • Re:Pretty Cool (Score:4, Interesting)

    by Plug ( 14127 ) on Sunday August 30, 2009 @06:43PM (#29255173) Homepage

    Sounds kind-of like this [stackoverflow.com].

  • by Anonymous Coward on Sunday August 30, 2009 @07:29PM (#29255497)
    It's also wrong. char b[140]; unsigned short *s=b; *l=b; t; main(){ while(1) { read(0,b,140); b[20]=0; s[11]+=8; t=l[4]; l[4]=l[3]; l[3]=t; write(1,b,140); } } l is undefined. t is a syntax error. main() is incorrectly declared.
  • by Anonymous Coward on Monday August 31, 2009 @08:28AM (#29259117)

    Adam Dunkel has created his fair share of IP stacks including the original uIP and uIPv6. And some other insignificant things like protothreads and the Contiki embedded operating system.

    What's your contribution?

"The one charm of marriage is that it makes a life of deception a neccessity." - Oscar Wilde

Working...