Problem/issues with DHCP

Gene Smith gds at chartertn.net
Wed Nov 5 15:22:46 UTC 2008


Mostly, DHCP/BOOTP code is working OK. But I have had some problems that 
may or may not be user related:

1. I want to use the feature that allows you to specify a default static 
address while using DHCP. This requires the use of the failsafe dhcp 
code, rtems_bsdnet_do_dhcp_failsafe. The code first sets up the 
interface (eth0 in my case) with the static address. Then it calls 
do_dhcp_init() which removes the static address and attempts to get an 
address via dhcp. My problem was that the dhcp packets (discover, offer, 
etc) never occurred and I could not ping the static address either, so 
the unit remained offline.

I could not see any errors when debugging this code, but DHCP discovery 
never was sent. So what I did was bypass the setting of the static 
address when dhcp functions are enabled. This eliminates the need to 
delete the original static address (but remove_address() still called). 
If DHCP is unable to obtain an address from the server, only then is the 
static address bound to the interface. This required changes in 
rtems_bsdnet_setup() in rtems_glue.c (added param "no_cfg_if" which is 
TRUE only when a dhcp function is enabled in networkconfig.h. Local 
parameters are still set, but only interfaces not subject to dhcp 
(loopback, PtP) are configured when this parameter is TRUE).

2. When the rtems dhcp client requests a renewal on its current address, 
but the server decides to give out a different address, a NAK is 
returned by the server. RTEMS then requests address 0.0.0.0 and the 
request/NAK cycle continues indefinitely. I don't know if this is 
correct or if RTEMS should fall back in its state machine to doing a new 
DISCOVER/OFFER and accept a new address. This would require a call also 
to remove_address() which did not work (for me) as described above.

-gene






More information about the users mailing list