From: <abe...@us...> - 2013-04-28 19:47:39
|
Revision: 6060 http://sourceforge.net/p/astlinux/code/6060 Author: abelbeck Date: 2013-04-28 19:47:35 +0000 (Sun, 28 Apr 2013) Log Message: ----------- ifplugd, new daemon enabled via Busybox, when udhcpc is enabled ifplugd monitors the ethernet link status and calls the udhcpc.action script to immediately restart udhcpc when the link is back up. Note: The link must be down for at least 4-5 seconds before the script is called. Shorter durations are ignored. Modified Paths: -------------- branches/1.0/project/astlinux/busybox.config branches/1.0/project/astlinux/target_skeleton/etc/init.d/network Added Paths: ----------- branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/ branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/udhcpc.action Modified: branches/1.0/project/astlinux/busybox.config =================================================================== --- branches/1.0/project/astlinux/busybox.config 2013-04-27 18:42:09 UTC (rev 6059) +++ branches/1.0/project/astlinux/busybox.config 2013-04-28 19:47:35 UTC (rev 6060) @@ -748,7 +748,7 @@ CONFIG_FEATURE_IFCONFIG_HW=y CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y # CONFIG_IFENSLAVE is not set -# CONFIG_IFPLUGD is not set +CONFIG_IFPLUGD=y # CONFIG_IFUPDOWN is not set CONFIG_IFUPDOWN_IFSTATE_PATH="" # CONFIG_FEATURE_IFUPDOWN_IP is not set Added: branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/udhcpc.action =================================================================== --- branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/udhcpc.action (rev 0) +++ branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/udhcpc.action 2013-04-28 19:47:35 UTC (rev 6060) @@ -0,0 +1,30 @@ +#!/bin/sh + +interface="$1" + +action="$2" + +kill_udhcpc() +{ + if [ -f "/var/run/udhcpc-${interface}.pid" ]; then + kill $(cat "/var/run/udhcpc-${interface}.pid") 2>/dev/null + sleep 1 + fi +} + +case $action in + + up) + kill_udhcpc + udhcpc -b -s /etc/udhcpc.script -H $(uname -n) -p /var/run/udhcpc-${interface}.pid -i ${interface} + logger -t udhcpc.action -p kern.info "udhcp up: ${interface}" + ;; + + down) + kill_udhcpc + logger -t udhcpc.action -p kern.info "udhcp down: ${interface}" + ;; + +esac + +exit 0 Property changes on: branches/1.0/project/astlinux/target_skeleton/etc/ifplugd/udhcpc.action ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Modified: branches/1.0/project/astlinux/target_skeleton/etc/init.d/network =================================================================== --- branches/1.0/project/astlinux/target_skeleton/etc/init.d/network 2013-04-27 18:42:09 UTC (rev 6059) +++ branches/1.0/project/astlinux/target_skeleton/etc/init.d/network 2013-04-28 19:47:35 UTC (rev 6060) @@ -500,6 +500,7 @@ #DHCP if [ -n "$EXTIF" -a -z "$EXTIP" ] && ! isextppp extif; then udhcpc -b -s /etc/udhcpc.script -H $HOSTNAME -p /var/run/udhcpc-$EXTIF.pid -i $EXTIF + ifplugd -apqs -t2 -u3 -d3 -i $EXTIF -r /etc/ifplugd/udhcpc.action fi #DHCP @@ -533,10 +534,21 @@ ipv6_tunnel stop fi - if [ -z "$EXTIP" ]; then - kill $(cat /var/run/udhcpc-$EXTIF.pid) 2>/dev/null + if [ -n "$EXTIF" -a -f /var/run/ifplugd.$EXTIF.pid ]; then + echo "Stopping ifplugd..." + kill $(cat /var/run/ifplugd.$EXTIF.pid) fi + if [ -n "$EXTIF" -a -z "$EXTIP" -a -f /var/run/udhcpc-$EXTIF.pid ]; then + echo "Stopping udhcpc..." + kill $(cat /var/run/udhcpc-$EXTIF.pid) + fi + + if [ -n "$EXT2IF" -a -z "$EXT2IP" -a -f /var/run/udhcpc-$EXT2IF.pid ]; then + echo "Stopping udhcpc..." + kill $(cat /var/run/udhcpc-$EXT2IF.pid) + fi + if [ -f /var/run/ppp0.pid ]; then kill $(cat /var/run/ppp0.pid) fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |