1 |
e1c8cdf5
|
Scott Ullrich
|
#!/bin/sh
|
2 |
|
|
|
3 |
e32cb5d0
|
smos
|
if [ "$2" == "inet" ]; then
|
4 |
766cd450
|
jim-p
|
|
5 |
|
|
OLD_ROUTER=`/bin/cat /tmp/${1}_router`
|
6 |
|
|
if [ "${OLD_ROUTER}" != "" ]; then
|
7 |
|
|
echo "Removing states to old router ${OLD_ROUTER}" | logger -t ppp-linkup
|
8 |
9eb49a51
|
Ermal
|
/sbin/pfctl -i $1 -k 0.0.0.0/0 -k ${OLD_ROUTER}/32
|
9 |
8f563bb4
|
Ermal
|
/sbin/pfctl -i $1 -k ${OLD_ROUTER}/32 -k 0.0.0.0/0
|
10 |
766cd450
|
jim-p
|
fi
|
11 |
|
|
|
12 |
e32cb5d0
|
smos
|
# let the configuration system know that the ipv4 has changed.
|
13 |
|
|
/bin/echo $4 > /tmp/$1_router
|
14 |
|
|
/bin/echo $3 > /tmp/$1_ip
|
15 |
|
|
/usr/bin/touch /tmp/$1up
|
16 |
1cba5c58
|
smos
|
|
17 |
|
|
ALLOWOVERRIDE=`/usr/bin/grep -c dnsallowoverride /conf/config.xml`
|
18 |
|
|
if [ $ALLOWOVERRIDE -gt 0 ]; then
|
19 |
|
|
# write nameservers to file
|
20 |
6be02801
|
smos
|
if [ "`echo $6|grep -c dns1`" -gt 0 ]; then
|
21 |
|
|
DNS1=`echo $6 |awk '{print $2}'`
|
22 |
703173f2
|
smos
|
echo "$DNS1"> /var/etc/nameserver_$1
|
23 |
|
|
/sbin/route change "$DNS1" $4
|
24 |
1cba5c58
|
smos
|
fi
|
25 |
6be02801
|
smos
|
if [ "`echo $7|grep -c dns2`" -gt 0 ]; then
|
26 |
|
|
DNS2=`echo $7 |awk '{print $2}'`
|
27 |
703173f2
|
smos
|
echo "$DNS2" >> /var/etc/nameserver_$1
|
28 |
|
|
/sbin/route change "$DNS2" $4
|
29 |
1cba5c58
|
smos
|
fi
|
30 |
|
|
/usr/local/sbin/pfSctl -c 'service reload dns'
|
31 |
|
|
/bin/sleep 1
|
32 |
|
|
fi
|
33 |
e32cb5d0
|
smos
|
fi
|
34 |
|
|
|
35 |
|
|
if [ "$2" == "inet6" ]; then
|
36 |
|
|
# let the configuration system know that the ipv6 has changed.
|
37 |
|
|
/bin/echo $4 |cut -d% -f1 > /tmp/$1_routerv6
|
38 |
|
|
/bin/echo $3 |cut -d% -f1 > /tmp/$1_ipv6
|
39 |
|
|
/usr/bin/touch /tmp/$1upv6
|
40 |
5b06d9cc
|
Ermal
|
|
41 |
1cba5c58
|
smos
|
ALLOWOVERRIDE=`/usr/bin/grep -c dnsallowoverride /conf/config.xml`
|
42 |
|
|
if [ $ALLOWOVERRIDE -gt 0 ]; then
|
43 |
|
|
# write nameservers to file
|
44 |
6be02801
|
smos
|
if [ "`echo $6|grep -c dns1`" -gt 0 ]; then
|
45 |
|
|
DNS1=`echo $6 |awk '{print $2}'`
|
46 |
703173f2
|
smos
|
echo "$DNS1"> /var/etc/nameserver_v6$1
|
47 |
|
|
/sbin/route change -inet6 "$DNS1" $4
|
48 |
1cba5c58
|
smos
|
fi
|
49 |
6be02801
|
smos
|
if [ "`echo $7|grep -c dns2`" -gt 0 ]; then
|
50 |
|
|
DNS2=`echo $7 |awk '{print $2}'`
|
51 |
703173f2
|
smos
|
echo "$DNS2" >> /var/etc/nameserver_v6$1
|
52 |
|
|
/sbin/route change -inet6 "$DNS2" $4
|
53 |
1cba5c58
|
smos
|
fi
|
54 |
|
|
/usr/local/sbin/pfSctl -c 'service reload dns'
|
55 |
|
|
/bin/sleep 1
|
56 |
a73a9886
|
Ermal
|
fi
|
57 |
e1c8cdf5
|
Scott Ullrich
|
fi
|
58 |
|
|
|
59 |
04c528e7
|
Ermal
|
/usr/local/sbin/pfSctl -c "interface newip $1"
|
60 |
1f0ddd30
|
Ermal
|
exit 0
|