From 197c30ae98aafb2a565c3937eded6a9b583b7baa Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 24 Aug 2011 12:58:19 -0400 Subject: Make sure this does not operate on empty parameters, and also log when removing states. --- usr/local/sbin/ppp-linkdown | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'usr/local/sbin') diff --git a/usr/local/sbin/ppp-linkdown b/usr/local/sbin/ppp-linkdown index 4c1ad15..bd4f606 100755 --- a/usr/local/sbin/ppp-linkdown +++ b/usr/local/sbin/ppp-linkdown @@ -3,13 +3,21 @@ if [ -f /tmp/$1up ] && [ -f /conf/$1.log ]; then seconds=$((`date -j +%s` - `/usr/bin/stat -f %m /tmp/$1up`)) /usr/local/sbin/ppp-log-uptime.sh $seconds $1 & fi -if [ -f "/tmp/${interface}_defaultgw" ]; then - route delete default $4 +if [ "$3" != "" ]; then + echo "Removing states from $3" | logger -t ppp-linkdown + /sbin/pfctl -k 0.0.0.0/0 -k $3/32 + /sbin/pfctl -k $3/32 + pfctl -K $3/32 +fi +if [ "$4" != "" ]; then + echo "Removing states to $4" | logger -t ppp-linkdown + /sbin/pfctl -b 0.0.0.0/32 -b $4/32 + + if [ -f "/tmp/${interface}_defaultgw" ]; then + route delete default $4 + fi + fi -/sbin/pfctl -k 0.0.0.0/0 -k $3/32 -/sbin/pfctl -k $3/32 -pfctl -K $3/32 -/sbin/pfctl -b 0.0.0.0/32 -b $4/32 # delete the node just in case mpd cannot do that /usr/sbin/ngctl shutdown $1: if [ -f "/var/etc/nameserver_$1" ]; then -- cgit v1.1