Project

General

Profile

Download (1.16 KB) Statistics
| Branch: | Tag: | Revision:
1 cbe4111f Ermal Luçi
#!/bin/sh
2 2c27096c Renato Botelho
3
IF="${1}"
4 6c452777 David Wood
PROTOCOL="${2}"
5 2c27096c Renato Botelho
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 63292199 gnhb
fi
11 766cd450 jim-p
12 46e27ea7 Renato Botelho
/etc/rc.kill_states ${IF} ${LOCAL_IP}
13
14 6df89ece David Wood
if [ "${PROTOCOL}" == "inet" && -s "/tmp/${IF}_defaultgw" ]; then
15 def432e6 Renato Botelho
	GW=`head -n 1 /tmp/${IF}_defaultgw`
16 2efb39d0 jim-p
	DGW=`/sbin/route -n get -inet default | /usr/bin/awk '/gateway:/ {print $2}'`
17
	# Only remove the default gateway if it matches the gateway for this interface. See redmine #1837
18
	if [ "${GW}" = "${DGW}" ]; then
19
		/sbin/route -q delete default ${GW}
20
	fi
21 04c528e7 Ermal
fi
22 2efb39d0 jim-p
23 6c452777 David Wood
if [ "${PROTOCOL}" == "inet6" ]; then
24
	/usr/local/sbin/ppp-ipv6 ${IF} down
25
fi
26 cbe4111f Ermal Luçi
# delete the node just in case mpd cannot do that
27 2c27096c Renato Botelho
/usr/sbin/ngctl shutdown ${IF}:
28
if [ -f "/var/etc/nameserver_${IF}" ]; then
29 f7ea0505 Ermal
	# Remove old entries
30 2c27096c Renato Botelho
	for nameserver in `cat /var/etc/nameserver_${IF}`; do
31 f7dfd39f David Wood
		/sbin/route -q delete ${nameserver} >/dev/null 2>&1
32 f7ea0505 Ermal
	done
33 2c27096c Renato Botelho
	/bin/rm -f /var/etc/nameserver_${IF}
34 f7ea0505 Ermal
fi
35 b439dc01 Ermal
# Do not remove gateway used during filter reload.
36 2c27096c Renato Botelho
/bin/rm -f /tmp/${IF}_router
37
/bin/rm -f /tmp/${IF}up
38
/bin/rm -f /tmp/${IF}_ip
39 0ae6daf8 Ermal
/usr/local/sbin/pfSctl -c 'service reload dns'