summaryrefslogtreecommitdiffstats
path: root/usr/local/sbin/ppp-linkup
blob: bf7f70bdbc052bb09cf5f37ef0a0eea2b0ce8c76 (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
#!/bin/sh

# let the configuration system know that the ip has changed.
/bin/echo $4 > /tmp/$1_router
/bin/echo $3 > /tmp/$1_ip
/usr/bin/touch /tmp/$1up

ALLOWOVERRIDE=`/usr/bin/grep -c dnsallowoverride /conf/config.xml`
if [ $ALLOWOVERRIDE -gt 0 ]; then
	# write nameservers to file
	if [ "`echo $6|grep -c dns1`" -gt 0 ]; then
		DNS1=`echo $6 |awk '{print $2}'`
		echo "$DNS1"> /var/etc/nameserver_$1
		/sbin/route delete ${DNS1}
		/sbin/route add ${DNS1} $4
	fi
	if [ "`echo $7|grep -c dns2`" -gt 0 ]; then
		DNS2=`echo $7 |awk '{print $2}'`
		echo "$DNS2" >> /var/etc/nameserver_$1
		/sbin/route delete ${DNS2}
		/sbin/route add ${DNS2} $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