[Voyage-linux] DHCP Client IP allocation renewal bug

Dave Williams (spam-protected)
Fri Oct 14 03:03:50 HKT 2005


I've found a bug in the handling of DHCP address allocations.
When the system boots it gets allocated an address. After the first
lease time has expired it gets allocated new address rather than
renewing the existing one. After that it is OK.

The reason for this turns out to be due to the handling of dhclient.eth0.leases
(and dhclient.eth0.pid). These are stored in /var/run and are used to tell 
dhclient to do a DHCPREQUEST rather than a DHCPDISCOVER and hence get a
renewal. These files are created at boot time in S40networking but get deleted
later during the bootup sequence by an over-enthusiastic cleanrun() function
in bootclean.sh that is called by S45mountnfs.sh.

The fix is straight forward by adding  ! -name dhclient* to line 93 of
/etc/init.d/bootclean.sh as shown in the complete function listing
below.

cleanrun() {
        #
        #       Clean up /var/run.
        #

        [ -f /var/run/.clean ] && return

        [ "$VERBOSE" != no ] && echo -n " /var/run"
        ( cd /var/run && \
                find . ! -type d ! -name utmp ! -name innd.pid ! -name dhclient* \
                -exec rm -f -- {} \; )
        rm -f /var/run/.clean
        set -o noclobber
        :> /var/run/.clean
        set +o noclobber
}

It doesnt seem very robust to use negative logic here which could upset
files placed by other parts of the boot process so maybe there is a
better overall solution - However this works.

Anyway as I dont know who has editorial control over this file or what is history
I dont know whether its best to email it to the file's author (miquels at cistron.nl) or
whether someone on the list here can consider it for inclusion in
forthcoming releases.

Dave






More information about the Voyage-linux mailing list