On 8/6/06, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote:
But IIRC someone wrote a DHCP client for us, and we might want to have a look at it before porting something. I just have no idea where it is in the repository, though. Does anybody know this?
David Enderson started one, but he didn't finished it and he was not very proud of his source code. I've attached what he sent to me a long time ago. This is what he had to say:
I know it is rough and only a start. I am very fastidious about my code and don't like sharing this because it is not check-in quality. :-)
I know that whether it is coded Object-Oriented or not depends on its final location also. Since I didn't know its final location, I just write it OO, and figured I could refactor it.
My DHCP client currently gets the IP from the DHCP server successfully...I think. Here's the catch. When I run the client again, my server gives me the exact same IP, yet according to my understanding of the spec, I have done everything I need to do.
(To test it, run it on BeOS R5.0.3, Netserver. Set all your IP info to static 0.0.0.0 for everything. Then run my executable DHCP client and it will print out the IP it gets. You can sniff the net traffic if you want to watch the packet conversation. I've been using Linux to sniff the conversation to make sure I had my packets formed to spec.)
I've learned the DHCP spec quite well, and the way a DHCP server allocates and keeps track of assignments is left up to the server. Different servers can keep track of things different ways. I suspect that my DHCP server (Cisco WRT54G) may only solidify the lease when the first traffic packets using the new IP are sent through its router. I have no way know that without actually changing the IP for the OS.
Bye, Waldemar Kornewald