mirage/mirage-tcpip — pull request #87 by nojb (2014-12-04 23:49:20+00:00)
Title: Stackv4: Keep listening for DHCP offers

This little patch does two things:

1. Moves the code that configures IPv4 address, netmask and gateways after receiving a successful lease out of the `Dhcp_clientv4` module. It doesn't make much sense that this module makes available a `Dhcp.offer Lwt_stream.t` to listen for offers and then does all the configuring inside itself. Who else is going to consume this stream of offers if not the IPv4 implementation!? This code is then moved to `Stackv4` which seems a much better place for it. Another nice consequence is that it simplifies the signature of `Dhcp_client.Make` considerably, as it no longer needs to take `Ethif` and `Ipv4` as arguments. I am not aware of any standalone use of the `Dhcp_clientv4.Make` functor outside of `Stackv4`, so this change in signature should not break anything.

2. Keeps listening for incoming DHCP offers in the `Stackv4` code and reconfigures `Ipv4` as necesary. This actually will not make much difference in the short term because the DHCP code is quite cavalier about the whole thing and does not pay attention to lease times or anything like that and just sleeps for 1 hour after getting a successful lease. But it seems better to have slightly more robust code here in preparation for when things improve on the DHCP side.