Monday, March 24, 2008

Haiku Project Proposal

Below is part of my project proposal for Haiku. I have removed the first part of the application that has personal information I would rather not post on this blog. Also this post expands on the content within the application with graphics and more detailed explanation.

Project Idea

What I will be trying to achieve this summer is to implement ICMP and an error-handling mechanism for the network stack. I have been reading the network stack code and already have a good understanding of how it works internally.

The main goals for this project are to:

Implement the ICMP module (for IPv4) as described in RFC792: This will require minor modifications to the IPv4, TCP and UDP modules. Right now the IPv4 header is being removed from the net_buffer before it is being passed to the other protocols (TCP, UDP or ICMP). Some ICMP messages require (in some cases) that the original IPv4 header + 64 bytes of the upper layer header (TCP/UDP in this case) be sent back as part of the ICMP header so that the receiving host can identify which packet caused the error.

Create an error-handling mechanism for IPv4, TCP and UDP: I will use the functions already set for the net_modules. Specifically error() and error_reply(). This will be implemented in such a way that the TCP and UDP modules are independent from the ICMP module and all messages are transmitted through the IPv4 module, like so:


The error-reporting mechanism will work as follows:

  • An ICMP message is received from a remote host and is passed to the ICMP module from the IPv4 module.

  • If the message is regarding a previously-sent packet by either the IPv4, TCP or UDP layers, the message will be sent to the IPv4 module using the error() function.

  • If the message is regarding a previously-sent packet by either the TCP or UDP layers, they are sent to these modules using their error() function and the message is handled accordingly. Otherwise they are processed and handled by the IPv4 module.

  • To reply to a message the TCP and UDP module will use the IPv4's reply_error() function to pass the reply message down to the ICMP module using the send_data() function.

Below is a graphic representation of this process:



Document the work described above: I plan to document all the work that I do. I will use this blog so that people can track my progress and also to show step-by-step how I implemented the work described above. I will also prepare a separate document which will more likely be based on the contents of this blog by the end of the summer. If time permits I would also like to document the whole inner-workings of the network stack based on this document.
I’m not sure who the author is, so I might have to start from scratch to avoid copyright issues.

2 comments:

Stephan Aßmus (stippi) said...

Very nice project proposal! I found just one spelling mistake:

Implement the ICMP module (for IPv4) are described in RFC792:

shoud be

Implement the ICMP module (for IPv4) as described in RFC792:


... otherwise the descriptions are nicely laid out and easy to follow. I find it obvious that your understanding of the existing codebase and your task is very good.

As already suggested on the Haiku mailing list, please consider using our built-in blogging feature of the Haiku website once you are actually accepted. :-)

axeld said...

Nice proposal!

The network stack overview document you've linked is also in our repository (docs/develop/net), and it was written by me - feel free to extend it to your needs.

I think it should either end up in a part of the Haiku-Book, or at least find its way to our website for now.