Hello all,
        
        I was getting annoyed at the reluctance of udhcpd to
        volontarily update its lease file when a new lease has
        been granted. The attached patch introduces a configuration
        entry for Busybox 1.6.0 to write a new copy of the lease
        file immediately when it has sent DHCPACK.
        
        It took me some time to figure it out, but starting with
        Busybox 1.6.0 there is a new entry FEATURE_PIDFILE, which when
        forgotten causes udhcpc to complain about missing pidfile as
        soon as one tries to release the device. To avoid that serious
        malfunction I strongly suggest an addition to
        networking/udhcp/Config.in:
        
           config APP_UDHCPC
             ...
                select FEATURE_PIDFILE
        
        
        The attached diff-file is bold enough to take care of
        both matters.
        
        Best regards,   Mats E A
        
diff -Nau busybox-1.6.0/networking/udhcp/Config.in.orig busybox-1.6.0/networking/udhcp/Config.in
--- busybox-1.6.0/networking/udhcp/Config.in.orig	2007-06-29 13:23:15.000000000 +0200
+++ busybox-1.6.0/networking/udhcp/Config.in	2007-06-29 14:02:02.000000000 +0200
@@ -32,9 +32,20 @@
 
 	  See http://udhcp.busybox.net for further details.
 
+config FEATURE_UDHCPD_WRITE_LEASES_EARLY
+	bool "Rewrite the lease file at every new acknowledge"
+	default n
+	depends on APP_UDHCPD
+	help
+	  If selected, udhcpd will write a new file with leases every
+	  time a new lease has been accepted, thus eleminating the need
+	  to send SIGUSR1 for the initial writing, or updating. Any timed
+	  rewriting remains undisturbed
+
 config APP_UDHCPC
 	bool "udhcp Client (udhcpc)"
 	default n
+	select FEATURE_PIDFILE
 	help
 	  uDHCPc is a DHCP client geared primarily toward embedded systems,
 	  while striving to be fully functional and RFC compliant.
diff -Nau busybox-1.6.0/networking/udhcp/serverpacket.c.orig busybox-1.6.0/networking/udhcp/serverpacket.c
--- busybox-1.6.0/networking/udhcp/serverpacket.c.orig	2007-06-29 13:16:04.000000000 +0200
+++ busybox-1.6.0/networking/udhcp/serverpacket.c	2007-06-29 13:34:13.000000000 +0200
@@ -237,6 +237,11 @@
 
 	add_lease(packet.chaddr, packet.yiaddr, lease_time_align);
 
+#ifdef	ENABLE_FEATURE_UDHCPD_WRITE_LEASES_EARLY
+	// Rewrite the file with leases at every new acceptance
+	write_leases();
+#endif
+
 	return 0;
 }
 
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to