blob: 2ab0b6b02399b561b458b549acd2afd76ce6d342 (
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
35
36
|
#!/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
if echo "$3" | grep -q '/'; then
LOCAL_IP="${3}"
else
LOCAL_IP="${3}/32"
fi
echo "Removing states from ${LOCAL_IP}" | logger -t ppp-linkdown
/sbin/pfctl -k 0.0.0.0/0 -k ${LOCAL_IP}
/sbin/pfctl -k ${LOCAL_IP}
pfctl -K ${LOCAL_IP}
fi
/sbin/pfctl -i $1 -k 0.0.0.0/0
if [ -f "/tmp/${1}_defaultgw" ]; then
route delete default ${OLD_ROUTER}
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'
|