1
|
#!/bin/sh
|
2
|
|
3
|
IF="${1}"
|
4
|
PROTOCOL="${2}"
|
5
|
LOCAL_IP="${3}"
|
6
|
|
7
|
if [ -f /tmp/${IF}up ] && [ -f /conf/${IF}.log ]; then
|
8
|
seconds=$((`date -j +%s` - `/usr/bin/stat -f %m /tmp/${IF}up`))
|
9
|
/usr/local/sbin/ppp-log-uptime.sh $seconds ${IF} &
|
10
|
fi
|
11
|
|
12
|
/etc/rc.kill_states ${IF} ${LOCAL_IP}
|
13
|
|
14
|
if [ "${PROTOCOL}" == "inet" && -s "/tmp/${IF}_defaultgw" ]; then
|
15
|
GW=`head -n 1 /tmp/${IF}_defaultgw`
|
16
|
[ -n "${GW}" ] \
|
17
|
&& /sbin/route -q delete default ${GW}
|
18
|
fi
|
19
|
if [ "${PROTOCOL}" == "inet6" ]; then
|
20
|
/usr/local/sbin/ppp-ipv6 ${IF} down
|
21
|
fi
|
22
|
# delete the node just in case mpd cannot do that
|
23
|
/usr/sbin/ngctl shutdown ${IF}:
|
24
|
if [ -f "/var/etc/nameserver_${IF}" ]; then
|
25
|
# Remove old entries
|
26
|
for nameserver in `cat /var/etc/nameserver_${IF}`; do
|
27
|
/sbin/route -q delete ${nameserver} >/dev/null 2>&1
|
28
|
done
|
29
|
/bin/rm -f /var/etc/nameserver_${IF}
|
30
|
fi
|
31
|
# Do not remove gateway used during filter reload.
|
32
|
/bin/rm -f /tmp/${IF}_router
|
33
|
/bin/rm -f /tmp/${IF}up
|
34
|
/bin/rm -f /tmp/${IF}_ip
|
35
|
/usr/local/sbin/pfSctl -c 'service reload dns'
|