make sure only one dhcp client is active for one interface
authorFelix Fietkau <[email protected]>
Wed, 7 Sep 2005 16:54:13 +0000 (16:54 +0000)
committerFelix Fietkau <[email protected]>
Wed, 7 Sep 2005 16:54:13 +0000 (16:54 +0000)
SVN-Revision: 1872

openwrt/package/base-files/default/etc/functions.sh

index dfbdb873f7a9c3f95c2a1878e88e38f93f441417..2bf4a8d9989d55b922a48c829cda7f1ff838cd50 100755 (executable)
@@ -66,7 +66,12 @@ do_ifup() {
                DHCP_HOSTNAME=${DHCP_HOSTNAME%%.*}
                [ -z $DHCP_HOSTNAME ] || DHCP_ARGS="$DHCP_ARGS -H $DHCP_HOSTNAME"
                [ "$if_proto" = "pptp" ] && DHCP_ARGS="$DHCP_ARGS -n -q" || DHCP_ARGS="$DHCP_ARGS -R &"
+               oldpid=$(cat $pidfile)
                ${DEBUG:-eval} "udhcpc $DHCP_ARGS"
+               pidof udhcpc | grep "$oldpid" >&- 2>&- && {
+                       sleep 1
+                       kill -9 $oldpid
+               }
        ;;
        none|"")
        ;;