]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Stop dhcpcd before starting if it was running
authorArne Fitzenreiter <arne_f@ipfire.org>
Sun, 14 Jun 2009 11:57:11 +0000 (13:57 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sun, 14 Jun 2009 11:57:11 +0000 (13:57 +0200)
src/initscripts/init.d/networking/red

index 6ac87aae361255268d0b7d9dd446682d571ccdff..6a85eb48e65d3d6d1e0153816935501749126e70 100644 (file)
@@ -124,6 +124,35 @@ case "${1}" in
                        run_subdir ${rc_base}/init.d/networking/red.up/
                        
                elif [ "${TYPE}" == "DHCP" ]; then
+
+                       if [ -e $LEASEINFO ]; then
+                               boot_mesg -n "Stopping dhcpcd on the ${DEVICE} interface..."
+                               . $LEASEINFO
+                               if [ "$LEASETIME" = "4294967295" ]; then
+                                       # do nothing, just echo ok
+                                       echo ""
+                                       echo_ok
+                               else
+                                       if [ -n "$DHCP_STOP" ]; then
+                                               /sbin/dhcpcd ${DEVICE} $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
+                                       fi
+                               fi
+                       fi
+
                        boot_mesg -n "Starting dhcpcd on the ${DEVICE} interface..."            
                        echo -n "${DEVICE}" > /var/ipfire/red/iface