Implement the Internet Protocol (IP). Your implementation should run as a user-level process on Linux and interoperate with any IP implementation on the Internet. You should use the code available in interface.c and interface.h to send/receive messages to/from the Linux kernel. (See test.c for an example program that uses this interface.) Note that this interface allows you to send/receive complete IP datagrams (your code attaches/removes the IP header), but the kernel takes responsibility for forwarding each datagram out the appropriate port (your code does not have to call ARP to translate IP address into ethernet addresses).
The IP module you implement will be used to support TCP in later assignments, so you need to give some thought to the interface IP exports to higher level protocols. However, this interface is not specified by the assignment, and is free to change over the course of the semester. Also, you may want to write a test program that uses this interface to exercise your IP module, but this is not how we will test your implementation (see below).
How one implements IP on a router is not necessarily the same as how one implements IP on an end host. You are responsible for an end-host implementation only. There is no need to support routing, except as required by an end host with a single network port. One consequence of this restriction is that you can get by with a simple routing table. Your IP module should dump the contents of this routing table upon termination. See netstat -r on Unix for an example of how IP displays the contents of its routing table.
You need not support any IP options. However, your implementation should not crash if it receives a datagram with one or more options turned on. Such messages should be delivered to the high-level protocol with the options removed.
You need to support a subset of ICMP. Specifically, you should respond to ECHO packets. This is one way we plan to test that your implementation interoperates with an existing IP host. You should also interpret REDIRECT packets, which instruct IP to update its routing table. All other ICMP packets should be printed to standard output. This output need not be pretty as it will only be used for debugging purposes.
We have provided a general-purpose hash table tool for your IP implementation to use. The object file is map.o, and map.h contains the interface. You will also need the file types.h. The tool has a small test program and some documentation.
Turn in a written report (postscript or PDF format) that briefly
describes your design, including the upper-level interface you settle
on. Also turn in the source code for your implementation.