Assignment 2

Implement the Internet Protocol (IP) and a subset of the Internet Control Message Protocol (ICMP). Your implementation will run as a user-level process on Linux and should interoperate with any IP implementation on the Internet. Turn in your source code and a written report that describes your design.

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 is responsible for calling ARP and attaching the Ethernet header.

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.

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. 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 are providing a general-purpose hash table tool that your IP implementation can use if you choose. 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.

Your implementation will be evaluated on its correctness, the elegance of its design, and its observable performance. Since memory copies are often a performance bottleneck in protocol implementations, to receive full credit on the assignment your IP should not copy incoming or outgoing message data.

Turn in a written report (postscript or PDF file, not an MS Word .doc file) that briefly describes your design, including the upper-level interface you settle on, and evaluates your implementation's performance. Also turn in the source code for your implementation, a Makefile, and a README that explains how to invoke your program.