[openbeosnetteam] My DHCP Status + half-working binary and source

  • From: "David Enderson" <DEnderson@xxxxxxxxxxxxxx>
  • To: <openbeosnetteam@xxxxxxxxxxxxx>
  • Date: Mon, 18 Oct 2004 11:43:11 -0500

Team,

As I promised, I was working on our DHCP client over the last two weeks
and have made quite a bit of progress.  I'm on the downslope--8 to 12
hours of work--to finishing a full DHCP negotiation.  Then it would just
be a matter of integrating the stand-alone client into a module for the
netstack, however you want to do that.

You've all been wanting to see some source, so here is my current
product.  I apologize for it being somewhat messy.

http://david.enderson.net/downloads/haiku/DHCP_Client_01.zip

It compiles and runs from the terminal on R5.  It should run fine on R5
without any setting changes, but if you want your packets to look
technically correct, you should change your IP settings in R5 to
manually specified and set the IP Address, Subnet mask, and Gateway to
0.0.0.0

It should display an IP address that your system was offered by your
local DHCP server.  It ends by saying negotiation failed because it did
fail in not finishing the negotiation completely.

I happen to be home sick today from work so I have another day to
continue working on it.  I hope to get it handling the rest of the
messages in a typical negotiation and that would almost bring the
standalone binary to an alpha state.

Here is what I have yet to do to get the standalone binary:
- Get MAC address from hardware
- Handle DHCPACK, DHCPNAK
- Issue DHCPREQUEST, DHCPRELEASE

I'm not handling anything in the "optional" field because I see no need
to.  The information contained they are specific to various routers, we
don't even know what the contents of "optional" means without
contacting/researching each manufacturer/model, and they aren't needed
for negotiation.

Once I get the standalone binary to an alpha state, I'll be ready to
start integrating with the netstack, so we need to discuss how that
would work.  You guys mentioned possibly making it a "module".  I got
the idea you weren't exactly sure how that would work, so maybe it
should be discussed a little since I'm getting close?

=== Code Issues ===

Have fun running my binary if you feel like it, and feel free to give
feedback on my code.  I'm sure it could use improvement.  Some
improvements I have planned that I didn't write anywhere in the source
comments, but other suggestions I may not have thought of, so feel free
to comment away.

You can see I tried to break things up and abstract them as much as
possible.  The DHCP_Message class is simply for constructing DHCP
packets, sending DHCP packets, parsing received DHCP packets, and
retrieving certain values from received packets.  My guess is that I'll
replace the DHCP_Client class with whatever structure is necessary for
integrating the DHCP client into the netstack.

--David

-----=+=-----
David Enderson
Programmer
Digital IMS
402.437.0137
denderson@xxxxxxxxxxxxxx

Other related posts:

  • » [openbeosnetteam] My DHCP Status + half-working binary and source