#!/usr/bin/sh #---------------------------------------------------------------------------- # /etc/ppp/ip-up - called whenever a (i)ppp connection has been come up # # Creation: 2002-11-24 fm # Last Update: $Id$ # # Copyright (c) 2002-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- real_interface=${1} interface=${1} tty=${2} speed=${3} local=${4} remote=${5} echo ${local} >/run/${interface}.ip # store my own ip address if [ -f /etc/default-route-interface ] # default route existing? then default_route_interface=$(usr/bin/cat /etc/default-route-interface) if [ "${default_route_interface}" = "${interface}" ] then # restore default route /usr/sbin/ip route del default 2>/dev/null /usr/sbin/ip route add default dev ${real_interface} # Call all custom ip-ups for j in /etc/ppp/ip-up.* do if [ -f ${j} ] then . ${j} fi done fi fi if [ -f /run/${interface}.route-fix -a -f /run/${interface}.conf ] then # get configuration from file, format: # local remote netmask {network real_netmask}* conf=$(/usr/bin/cat /run/${interface}.conf) set ${conf} shift 3 # remove first three entries # setup routes again while [ -n "${1}" ] do ip=${1} subnet=${2} network=$(/usr/bin/netcalc network ${ip}:${subnet}) netmaskbits="$(/usr/bin/netcalc netmaskbits ${network}:${subnet})" /usr/sbin/ip route add ${ip}${netmaskbits} dev ${interface} shift 2 done fi exit 0