pfsense/usr/local/sbin/ppp-linkup
smos 703173f253 Update the link script to parse the arguments 6 and 7 differently.
Previously mpd supplied the dns1 string as $6 and the IP as $7. It is now a single argument $6.
Apparently this changed somewhere so parse the IP out of there into the correct nameserver file.
Also fix the IPv6 string simultaneously
Redmine ticket #2458 Might need MFC to RELENG_2_0
2012-05-28 14:55:55 +02:00

53 lines
1.4 KiB
Bash
Executable File

#!/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
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 |cut -f2`
echo "$DNS1"> /var/etc/nameserver_$1
/sbin/route change "$DNS1" $4
fi
if [ `echo $7|grep -c dns2` -gt 0 ]; then
DNS2=`echo $7 |cut -f2`
echo "$DNS2" >> /var/etc/nameserver_$1
/sbin/route change "$DNS2" $4
fi
/usr/local/sbin/pfSctl -c 'service reload dns'
/bin/sleep 1
fi
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
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 |cut -f2`
echo "$DNS1"> /var/etc/nameserver_v6$1
/sbin/route change -inet6 "$DNS1" $4
fi
if [ `echo $7|grep -c dns2` -gt 0 ]; then
DNS2=`echo $7 |cut -f2`
echo "$DNS2" >> /var/etc/nameserver_v6$1
/sbin/route change -inet6 "$DNS2" $4
fi
/usr/local/sbin/pfSctl -c 'service reload dns'
/bin/sleep 1
fi
fi
/usr/local/sbin/pfSctl -c "interface newip $1"
exit 0