Project

General

Profile

Download (1.16 KB) Statistics
| Branch: | Tag: | Revision:
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
	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
fi
22

    
23
if [ "${PROTOCOL}" == "inet6" ]; then
24
	/usr/local/sbin/ppp-ipv6 ${IF} down
25
fi
26
# delete the node just in case mpd cannot do that
27
/usr/sbin/ngctl shutdown ${IF}:
28
if [ -f "/var/etc/nameserver_${IF}" ]; then
29
	# Remove old entries
30
	for nameserver in `cat /var/etc/nameserver_${IF}`; do
31
		/sbin/route -q delete ${nameserver} >/dev/null 2>&1
32
	done
33
	/bin/rm -f /var/etc/nameserver_${IF}
34
fi
35
# Do not remove gateway used during filter reload.
36
/bin/rm -f /tmp/${IF}_router
37
/bin/rm -f /tmp/${IF}up
38
/bin/rm -f /tmp/${IF}_ip
39
/usr/local/sbin/pfSctl -c 'service reload dns'
(14-14/24)