As preparation, make a copy of your Project 1 directory for Project 2.
Add a shell command, "dhcp", that spawns a DHCP protocol daemon.
For a passing grade, your DHCP protocol daemon should at least send a fresh DHCP_DISCOVER packet and receive a DHCP_OFFER packet in order to learn the IP address of the host you are on.
Higher grades will go to more complete implementations that also parse the lease time, subnet mask, and router address in the DHCP payload. Points will be awarded for completing the four steps of the DHCP state machine necessary to reach the "BOUND" state in Figure 18.28 of the text.
Constructing fresh DHCP packets should not be very hard after completing last week's assignment, but there are a few "gotchas" to be wary of.
control(ETH0, ETH_CTRL_GET_MAC,
(ulong)foo, 0);
will copy the six bytes of your MAC address
to the location pointed to by foo. dgram->chksum = checksum((uchar *)dgram, (4 * (dgram->ver_ihl & IPv4_IHL)));
write(ETH0, packet, length);
.