mirage/mirage — pull request #319 by nojb (2014-11-10 16:26:41+00:00)
Title: RFC: Initial support for IPv6

I have started working on integrating IPv6 to the current code base. I made a first stab at modifying the signatures in `V2.mli` and `V2_LWT.mli` and would appreciate any comments on this. The commit message follows. I am particularly interested in discussing the last three points of the list.

Initial support for IPv6

Summary of changes:

- Moved ARP stuff from ETHIF to IPV4. In particular, ETHIF no longer
has a type called `ipv4addr`.

- Make a new signature IP which is included in both IPV4 and IPV6. The
idea is that TCP and UDP should be functors of IP only and should work
the same way regardless of whether it is an IPV4 or IPV6.

- IPV4 includes IP and should include anything else that only makes
sense for IPv4 (e.g. the ARP stuff).

- IPV6 includes IP and should include anything else that only makes
sense for IPv6 (nothing currently).

- Rename `ipv4addr` to `ipaddr` since it should not matter whether it is
a v4 addr or a v6 addr most of the time.

- Rename TCPV4 to TCP and UDPV4 to UDP.

- STACKV4 is now called STACK (better name anyone?). Since it would be
useful to run both IPv4 and IPv6 at the same time, this module now
contains submodules IPV{4,6}, UDP{4,6}, TCPV{4,6} and associated
functions & types.

- Removed the function `allocate_frame' from the IP signature.

In the current IPV4 module this function does two very different
things: 1) allocates an ethernet frame, and 2) performs address
resolution. In order to present an uniform interface for IPV4 and
IPV6 we believe it is better to separate these two functions.
Furthermore, there is no need to expose packet allocation (which
happens in the IP layer) to the higher layers. Thus we replaced the
`allocate_frame` and the `write`/`writev` function by a single
function called `write`/`writev`. The payload to be transmitted is
passed as value with type `buffer -> buffer list`. This function
receives the header of the ethernet frame to be sent and returns the
whole packet.

- Added a function `checksum` to IP which is used to compute checksums
by upper-layer protocols such as UDP & TCP.