summaryrefslogtreecommitdiffstats
path: root/usr/local/sbin/ppp-linkup
blob: e0fb0c258bfb3cfdd1c43974aace00468217956e (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 [ "$2" == "inet" ]; then
	# let the configuration system know that the ipv4 has changed.
	/bin/echo $4 > /tmp/$1_router
	/bin/echo $3 > /tmp/$1_ip
	/usr/bin/touch /tmp/$1up
fi

if [ "$2" == "inet6" ]; then
	# let the configuration system know that the ipv6 has changed.
	/bin/echo $4 |cut -d% -f1 > /tmp/$1_routerv6
	/bin/echo $3 |cut -d% -f1 > /tmp/$1_ipv6
	/usr/bin/touch /tmp/$1upv6
fi

ALLOWOVERRIDE=`/usr/bin/grep dnsallowoverride /conf/config.xml | /usr/bin/wc -l`
if [ $ALLOWOVERRIDE -gt 0 ]; then
	# write nameservers to file
	if [ $6 = "dns1" ]; then
		echo $7 > /var/etc/nameserver_$1
		/sbin/route delete $7
		/sbin/route add $7 $4
	fi

	if [ $8 = "dns2" ]; then
		echo $9 >> /var/etc/nameserver_$1
		/sbin/route delete $9
		/sbin/route add $9 $4
	fi
	/usr/local/sbin/pfSctl -c 'service reload dns'
	/bin/sleep 1
fi

/usr/local/sbin/pfSctl -c "interface newip $1"
exit 0
OpenPOWER on IntegriCloud