1 |
#!/bin/sh |
#!/bin/sh |
|
# $Header: /root/magellan-cvs/src/ppp/ip-down,v 1.1 2007-08-18 18:50:53 niro Exp $ |
|
|
# |
|
|
# This script is run by pppd when there's a successful ppp connection. |
|
|
# |
|
2 |
|
|
3 |
# the following parameters are available: |
# This script is run by pppd after the link is brought down. |
4 |
# $1 = interface-name |
# It executes all the scripts available in /etc/ppp/ip-down.d directory, |
5 |
# $2 = tty-device |
# with the following parameters: |
6 |
|
# $1 = interface name (e.g. ppp0) |
7 |
|
# $2 = tty device |
8 |
# $3 = speed |
# $3 = speed |
9 |
# $4 = local-IP-address |
# $4 = local IP address |
10 |
# $5 = remote-IP-address |
# $5 = remote IP address |
11 |
# $6 = ipparam |
# $6 = ipparam (user specified parameter, see man pppd) |
12 |
|
|
13 |
if [[ ${USEPEERDNS} ]] |
cd /etc/ppp/ip-down.d || exit |
|
then |
|
|
if [ -x /sbin/resolvconf ] |
|
|
then |
|
|
resolvconf -d "$1" |
|
|
else |
|
|
# taken from debian's 0000usepeerdns |
|
|
# follow any symlink to find the real file |
|
|
REALRESOLVCONF=$(readlink --canonicalize /etc/resolv.conf) |
|
14 |
|
|
15 |
if [[ ${REALRESOLVCONF} != /etc/ppp/resolv.conf ]] |
for SCRIPT in *.sh ; do |
16 |
then |
. ./"${SCRIPT}" "$@" |
17 |
# if an old resolv.conf file exists, restore it |
done |
|
if [ -e ${REALRESOLVCONF}.pppd-backup ] |
|
|
then |
|
|
mv ${REALRESOLVCONF}.pppd-backup ${REALRESOLVCONF} |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
|
|
|
if [ -f /etc/conf.d/net.$1 ] |
|
|
then |
|
|
/etc/rc.d/init.d/network stop $1 > /dev/null |
|
|
fi |
|
|
|
|
|
[ -f /etc/ppp/ip-down.local ] && . /etc/ppp/ip-down.local "$@" |
|