add full patch to /sbin/ip and check for dhclient $pid before kill
authorHarald Hoyer <harald@redhat.com>
Mon, 9 Mar 2009 11:49:17 +0000 (12:49 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 9 Mar 2009 12:08:12 +0000 (13:08 +0100)
modules.d/40network/dhclient-script
modules.d/40network/ifup
modules.d/40network/kill-dhclient.sh

index dc2d9e1..103e5f0 100755 (executable)
@@ -3,13 +3,13 @@
 # up, and it does not even try to do anything else.
 
 case $reason in
-    PREINIT) ip link set "$interface" up ;;
+    PREINIT) /sbin/ip link set "$interface" up ;;
     BOUND) ipopts="$new_ip_address"
        [ "$new_interface_mtu" ] && ip link set $interface mtu $new_interface_mtu
        [ "$new_subnet_mask" ] && ipopts="$ipopts/$new_subnet_mask"
        [ "$new_broadcast_address" ] && ipopts="$ipopts broadcast $new_broadcast_address"
-       ip addr add $ipopts dev $interface
-       [ "$new_routers" ] && ip route add default via ${new_routers%%,*} dev $interface
+       /sbin/ip addr add $ipopts dev $interface
+       [ "$new_routers" ] && /sbin/ip route add default via ${new_routers%%,*} dev $interface
        [ "$new_domain_name" ] && echo "domain $new_domain_name" > /etc/resolv.conf
        if [ "$new_domain_search" ]; then
            echo "search $new_domain_search" |sed 's/,//g' >> /etc/resolv.conf
index 3878c41..067bdf5 100755 (executable)
@@ -5,8 +5,8 @@
 
 # loopback is always handled the same way
 [ "$1" = "lo" ] && {
-    ip link set lo up
-    ip addr add 127.0.0.1/8 dev lo
+    /sbin/ip link set lo up
+    /sbin/ip addr add 127.0.0.1/8 dev lo
     exit 0
 }
 
@@ -24,13 +24,13 @@ for p in $(cat /proc/cmdline); do
                    case $autoconf in
                        dhcp|on|any) >/net.$1.dhcp ;;
                        none|off|'') # do some basic configuration
-                           ip link set $1 up
-                           ip addr add $client/$netmask dev $1
-                           [ "$gw" ] && ip route add default via $gw dev $1
+                           /sbin/ip link set $1 up
+                           /sbin/ip addr add $client/$netmask dev $1
+                           [ "$gw" ] && /sbin/ip route add default via $gw dev $1
                            >/net.$1.up ;;
                    esac
                fi
                ) ;;
        *) continue;;
     esac
-done
\ No newline at end of file
+done
index 3dd3b43..d519013 100755 (executable)
@@ -1,2 +1,4 @@
 #!/bin/sh
-kill $(pidof dhclient)
\ No newline at end of file
+
+pid=$(pidof dhclient)
+[[ $pid ]] && kill $pid