dhcpcd not killed

DJ Lucas dj at linuxfromscratch.org
Mon Aug 20 21:43:01 PDT 2007


DJ Lucas wrote:
> DJ Lucas wrote:
>   
>> David Olsson wrote:
>>   
>>     
>>> This got lost, I think.  So here it is again.
>>>
>>> On my BLFS 6.2 system, the SysVinit script
>>>
>>>     /etc/rc.d/init.d/network stop
>>>
>>> does not kill dhcpcd.  Tracing it to the script
>>>
>>>     /etc/sysconfig/network-devices/services/dhcpcd
>>>
>>> it turns out that if the dhcp lease time is infinite, the script believes that dhcpcd exited after startup.  Such is not the case, and I don't see in the dhcpcd docs that it should be true.  Is anyone familiar with these scripts?  The question is, shall we eliminate the check for infinite lease time, and kill the running dhcpcd.
>>>
>>>   
>>>     
>>>       
>> No...have to account for multiple interfaces.  Also, this was the case,
>> it did exit at one time...I verified that it worked when the change was
>> made to the scripts...I almost always use RL1 to test service scripts.
>>   
>>
>>     
> Okay, my fuzzy memory sucks!  The original analysis by David was
> correct.  Please ignore what I wrote about multiple interfaces in my
> previous message.  I was confusing some of the former dhclient problems
> for dhcpcd.  dhcpcd does create multiple instances...so sending TERM is
> fine if DHCP_STOP is null, just set PIDFILE to
> /var/run/dhcpcd-$INTERFACE.pid.  And yes, the check for infinite lease
> should go away since version 3, I guess...no mention of it in the changelog.
>
> -- DJ Lucas
>
>   
David, would you mind trying the patch below?  It's exactly what you had
already mentioned (with the variable names fixed for 3.0.19), so you
probably already have the same or similar.  I don't use the stock
scripts anymore as I've been working on lsb-v3, though the same logic,
mine use different functions so I can't easily test.  Apply with -Np0
instead of -Np1 as you normally would (or manual) and then re-install
the script 'make install-service-dhcpcd'.  This to anybody else who uses
it as well.

Thanks.

-- DJ Lucas

Index: blfs/sysconfig/network-devices/services/dhcpcd
===================================================================
--- blfs/sysconfig/network-devices/services/dhcpcd      (revision 7090)
+++ blfs/sysconfig/network-devices/services/dhcpcd      (working copy)
@@ -46,12 +46,12 @@
                                boot_mesg_flush
                                boot_mesg "           Subnet Mask:    
$NETMASK"
                                boot_mesg_flush
-                               boot_mesg "           Default Gateway:
$GATEWAY"
+                               boot_mesg "           Default Gateway:
$GATEWAYS"
                                boot_mesg_flush
-                               boot_mesg "           DNS Server:      $DNS"
+                               boot_mesg "           DNS Server:     
$DNSSERVERS"
                                boot_mesg_flush
                        else
-                               boot_mesg " IP Addresss: ""$IPADDR"
+                               boot_mesg " IP Addresss: $IPADDR"
                                echo_ok
                        fi
                else
@@ -63,43 +63,23 @@
 
        down)
                boot_mesg -n "Stopping dhcpcd on the $1 interface..."
-               # Do nothing with the client daemon if we have an infinate
-               # lease time as the client exits when started in this case,
-               # just echo OK.
-               if [ -e $LEASEINFO ]
+               if [ -z "$DHCP_STOP" ]
                then
-                       . $LEASEINFO
-
-                       if [ "$LEASETIME" = "4294967295" ]
-                       then
-                               # do nothing, just echo ok
+                       echo ""
+                       killproc -p "$PIDFILE" /sbin/dhcpcd
+               else
+                       /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null
+                       RET="$?"
+                       if [ "$RET" -eq 0 ]; then
                                echo ""
                                echo_ok
+                       elif [ "$RET" -eq 1 ]; then
+                               boot_mesg "dhcpcd not running!" ${WARNING}
+                               echo_warning
                        else
-                       if [ -n "$DHCP_STOP" ]
-                       then
-                               /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null
-                               RET="$?"
-                               if [ "$RET" -eq 0 ]; then
-                                       echo ""
-                                       echo_ok
-                               elif [ "$RET" -eq 1 ]; then
-                                       boot_mesg "dhcpcd not running!"
${WARNING}
-                                       echo_warning
-                               else
-                                       echo ""
-                                       echo_failure
-                               fi
-                       else
                                echo ""
-                               killproc dhcpcd
+                               echo_failure
                        fi
-                   fi
-               else
-                       boot_mesg -n "LEASEINFO Test failed! - " ${WARNING}
-                       boot_mesg "dhcpcd is not running!" ${WARNING}
-                       echo_warning
-                       exit 1
                fi
        ;;
 
===================================================================






More information about the blfs-dev mailing list