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.