From: <abe...@us...> - 2014-11-08 22:34:40
|
Revision: 6809 http://sourceforge.net/p/astlinux/code/6809 Author: abelbeck Date: 2014-11-08 22:34:37 +0000 (Sat, 08 Nov 2014) Log Message: ----------- wan-failover, more tweaks Modified Paths: -------------- branches/1.0/project/astlinux/target_skeleton/etc/udhcpc.script branches/1.0/project/astlinux/target_skeleton/usr/sbin/wan-failover Modified: branches/1.0/project/astlinux/target_skeleton/etc/udhcpc.script =================================================================== --- branches/1.0/project/astlinux/target_skeleton/etc/udhcpc.script 2014-11-08 14:37:01 UTC (rev 6808) +++ branches/1.0/project/astlinux/target_skeleton/etc/udhcpc.script 2014-11-08 22:34:37 UTC (rev 6809) @@ -70,8 +70,8 @@ fi done - # Restart Failover script if running and if the gateway changed - if [ -f /var/run/wan-failover.pid ]; then + # Restart Failover script if running or enabled and if the gateway changed + if [ -f /var/run/wan-failover.pid -o "$WAN_FAILOVER_ENABLE" = "yes" ]; then if [ "$OLDGW" != "$NEWGW" ]; then /etc/init.d/failover restart >/dev/null 2>&1 & fi Modified: branches/1.0/project/astlinux/target_skeleton/usr/sbin/wan-failover =================================================================== --- branches/1.0/project/astlinux/target_skeleton/usr/sbin/wan-failover 2014-11-08 14:37:01 UTC (rev 6808) +++ branches/1.0/project/astlinux/target_skeleton/usr/sbin/wan-failover 2014-11-08 22:34:37 UTC (rev 6809) @@ -110,7 +110,7 @@ for x in $TARGETS; do NO_OF_TARGETS=$((NO_OF_TARGETS+1)) log DEBUG "Adding static route for host $x" - ip route add $x via $PRIMARY_GW dev $EXTIF + ip route add $x ${PRIMARY_GW:+via $PRIMARY_GW} dev $EXTIF done } @@ -119,7 +119,7 @@ unset IFS for x in $TARGETS; do - ip route delete $x via $PRIMARY_GW dev $EXTIF + ip route delete $x ${PRIMARY_GW:+via $PRIMARY_GW} dev $EXTIF done } @@ -357,18 +357,13 @@ exit 1 fi +## PPPoE results in an empty PRIMARY_GW PRIMARY_GW="$(ip route list dev $EXTIF 2>/dev/null | sed -n -r -e 's/^default .*via +([^ ]+).*$/\1/p')" -if [ -z "$PRIMARY_GW" ]; then - log_all ERROR "Primary interface gateway not found, exiting." - exit 1 -fi if [ -n "$EXT2GW" ]; then SECONDARY_GW="$EXT2GW" elif [ -f "/tmp/udhcpc-${EXT2IF}.conf" ]; then SECONDARY_GW="$(sed -n -r -e 's/^GW=([0-9.]+).*$/\1/p' "/tmp/udhcpc-${EXT2IF}.conf" | head -n1)" -else - SECONDARY_GW="$PRIMARY_GW" fi if [ -z "$SECONDARY_GW" ]; then log_all ERROR "Secondary interface gateway not found, exiting." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |