summaryrefslogtreecommitdiffstats
path: root/usr/local/sbin/ppp-linkdown
blob: bd4f606fa8f89a3acbb34485d91a9f4463aa6383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
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 [ "$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
# delete the node just in case mpd cannot do that
/usr/sbin/ngctl shutdown $1:
if [ -f "/var/etc/nameserver_$1" ]; then
	# Remove old entries
	for nameserver in `cat /var/etc/nameserver_$1`; do
		/sbin/route delete $nameserver >/dev/null 2>&1
	done
	/bin/rm -f /var/etc/nameserver_$1
fi
# Do not remove gateway used during filter reload.
/bin/rm -f /tmp/$1_router
/bin/rm -f /tmp/$1up
/bin/rm -f /tmp/$1_ip
/usr/local/sbin/pfSctl -c 'service reload dns'
OpenPOWER on IntegriCloud