--- trunk/ppp/ip-up 2007/08/18 18:50:53 303 +++ trunk/ppp/ip-up 2009/05/11 09:39:21 796 @@ -1,55 +1,17 @@ #!/bin/sh -# $Header: /root/magellan-cvs/src/ppp/ip-up,v 1.1 2007-08-18 18:50:53 niro Exp $ -# -# This script is run by pppd when there's a successful ppp connection. -# -# the following parameters are available: -# $1 = interface-name -# $2 = tty-device +# This script is run by pppd after the link is established. +# It executes all the scripts available in /etc/ppp/ip-up.d directory, +# with the following parameters: +# $1 = interface name (e.g. ppp0) +# $2 = tty device # $3 = speed -# $4 = local-IP-address -# $5 = remote-IP-address -# $6 = ipparam - -if [[ ${USEPEERDNS} ]] -then - - if [ -x /sbin/resolvconf ] - then - conf="# Generated by ppp for $1\n" - [[ -n ${DNS1} ]] && conf="${conf}nameserver ${DNS1}\n" - [[ -n ${DNS2} ]] && conf="${conf}nameserver ${DNS2}\n" - echo -e "$conf" | resolvconf -a "$1" - else - # add the server supplied DNS entries to /etc/resolv.conf - # (taken from debian's 0000usepeerdns) - - # follow any symlink to find the real file - REALRESOLVCONF=$(readlink --canonicalize /etc/resolv.conf) - - if [[ ${REALRESOLVCONF} != /etc/ppp/resolv.conf ]] - then - # merge the new nameservers with the other options from the old configuration - { - grep --invert-match '^nameserver[[:space:]]' ${REALRESOLVCONF} - cat /etc/ppp/resolv.conf - } > ${REALRESOLVCONF}.tmp - - # backup the old configuration and install the new one - cp -dpP ${REALRESOLVCONF} ${REALRESOLVCONF}.pppd-backup - mv ${REALRESOLVCONF}.tmp ${REALRESOLVCONF} - - # correct permissions - chmod 0644 /etc/resolv.conf - chown root:root /etc/resolv.conf - fi - fi -fi - -if [ -f /etc/conf.d/net.$1 ] -then - /etc/rc.d/init.d/network start $1 > /dev/null -fi - -[ -f /etc/ppp/ip-up.local ] && . /etc/ppp/ip-up.local "$@" +# $4 = local IP address +# $5 = remote IP address +# $6 = ipparam (user specified parameter, see man pppd) + +cd /etc/ppp/ip-up.d || exit + +for SCRIPT in *.sh ; do + . ./"${SCRIPT}" "$@" +done