[BusyBox] udhcpc and APIPA ???

Steven Scholz steven.scholz at imc-berlin.de
Thu Aug 7 16:51:59 UTC 2003


I wrote:

> Hi there,
> 
> I am using udhcpc on my embedded system to get an IP while booting up.
> 
> Now when the device does not find an DHCP server it will have no valid 
> IP address.
> 
> I read about M$ APIPA (Automatic Private IP Addressing) which basicly 
> takes some address from the range of private IP addresses 169.254.0.1 .. 
> 169.254.255.254 when DHCP fails. This is very nice and handy when the 
> embedded system should work in an M$ Windows environment.
> 
> My questions:
> 
> # Is somebody else interessted in this feature?
> # Should it be done in the udhcpc script?
> # Should we implement it into udhcpc directly?
> # Is there another (better) solution to get a valid IP address if DHCP 
> fails?

How about adding

Index: networking/udhcp/dhcpc.c
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/dhcpc.c,v
retrieving revision 1.11
diff -p -u -r1.11 dhcpc.c
--- networking/udhcp/dhcpc.c    20 Jun 2003 09:20:28 -0000      1.11
+++ networking/udhcp/dhcpc.c    7 Aug 2003 17:01:18 -0000
@@ -297,6 +297,7 @@ int udhcpc_main(int argc, char *argv[])
                                         timeout = now + ((packet_num == 2) ? 4 : 2);
                                         packet_num++;
                                 } else {
+                                       run_script(NULL, "failed");
                                         if (client_config.background_if_no_lease) {
                                                 LOG(LOG_INFO, "No lease, forking to background.");
                                                 client_background();

some we could handle a failed DHCP request in the /share/udhcpc/default.script!?

Steven




More information about the busybox mailing list