contrib: DHCP network monitor and fallback from DHCP to static address
chrisj at rtems.org
Wed Apr 30 06:47:53 CDT 2008
Arnout Vandecappelle wrote:
> My colleague Maarten and I have developed an extension to the DHCP
> client which allows monitoring the network interface and restarting DHCP
> when the network changes.
> First, some changes to rtems_dhcp.c and bootpc_subr.c are required.
> These are contained in the attached patch, as well as a Changelog entry
> for them. Changes include
> - all panic() calls in bootpc_subr.c and rtems_dhcp.c are replaced by
> printf()'s and return -1;
> - bootpc_call() times out;
> - rtems_bsdnet_do_dhcp() has an infinite loop over dhcp_init(), to
> conserve the old behaviour;
> - added rtems_bsdnet_do_dhcp_timeout() (to allow time-out of DHCP) and
> rtems_bsdnet_dhcp_down() (to allow stopping the lease renewal task);
> - removed a debugging printf in bootpc_init();
> - corrected the cast in rtems_bsdnet_ifconfig() for SIOCDIFADDR.
> If any of these changes are not acceptable, I can reproduce a patch
> without that particular change.
Why was the nfs_diskless_valid code removed ?
The rtems_bsdnet_do_dhcp change is wrong. You need to obtain the network
semaphore after the timeout not release it.
Why the changes in bootp_subr.c with the order of the calls to ifioctl ?
> These changes have been tested on an in-house board using an ARM
> processor and RTEMS 4.6.99. The patch is against the CVS, but has not
> been tested with the CVS version. However, I don't expect problems as
> not much has changed in libnetworking (except for K&R -> C90 declarations).
> Second, we developed a network monitoring task with the following
> * start DHCP, and use static configuration if it fails;
> * restart DHCP when the network cable is removed and reconnected;
> * bring an interface down when the cable is removed.
> It is designed as a replacement for rtems_bsdnet_do_dhcp. The code is
> in rtems_dhcp_failsafe.c, the declaration in rtems_dhcp_failsafe.h. The
> source file contains documentation.
> It is implemented as a user-space task, i.e. it doesn't require access
> to the kernel functions and variables. However, in our own RTEMS
> version we put it in the cpukit/libnetworking/rtems/ directory and added
> the declaration to dhcp.h.
> If this code is not included in the RTEMS distribution, I can find a
> place on the Wiki to post it.
> rtems-users mailing list
> rtems-users at rtems.com
More information about the rtems-users