DHCP client on PIC Micro

Hello.

I am embedded programmer working on a project implementing Ethernet functionality. The hardware is a PIC18F6620 and the TCP/IP stack was based on Jeremy Benthams TCP/IP Lean. The TCP/IP stack acquires its IP address through DHCP but I am having problems with some DCHP servers.

In its raw state Jeremy Benthams code worked with the first server we tried it with but not the second. The second router sent a 'bad DHCP packet error'. After looking through all the DHCP specification such as RFC 2131 and RFC 2132 I could find no problem with the implementation - it was extremely bare bones as you would expect with a TCP/IP stack running on a PIC micro, but seemed to adhere to the specification. I compared the DHCP discover packet with the one sent out on my windows machine and could find no real difference, the windows machine had many more options, but according to the specification they are just that, options. The only other difference was packet size, the windows packet was longer and padded with zero's at the end. I padded my DHCP packets out with zero's to make them the same size as the packets from the windows machine and this solved the problem. Now I have a problem with yet another DHCP server, this time it is a D-link DSL-G604T wireless router. This just simply ignores the discover packets as though they didn't exist, no error message (I am using ethereal to spy on the network traffic). I have had another check through the documentation about DHCP but have found no leads. One possibility was the fact that my client sets the broadcast flag and does not cope with a unicast response, however changing this flag made no difference.

I would appreciate any help or pointers possible. Is there some application or implementation guide for DHCP, for example where is the requirement for minimum packet length stated? Has any one implemented a DHCP client before and is aware of any pitfalls to watch out for and what this problem might be? Does anyone know of any other forums on which I could post this message?

Ben Thomas

Reply to
AbsoluteSoftware
Loading thread data ...

The minumum length of the DHCP data is 548 bytes per the RFC.

Paul Bosselaers

Reply to
Paul J. Bosselaers

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.