#!/bin/sh #---------------------------------------------------------------------------- # /etc/ppp/ip-down - called whenever a (i)ppp connection has been come down # # Creation: 29.03.2000 fm # Last Update: $Id$ #---------------------------------------------------------------------------- run_ip_down () { case $interface in ppp0) # it's DSL, map interface case $tty in "" | eth*| br* | /dev/ttyp0 | /dev/ttyS[0-4] | /dev/ttyUSB[0-4] | /dev/capi/0 | /dev/ttyACM0 | /dev/ttyHS[0-3] | /dev/gsmmodem ) # empty: PPPoE, eth[0-9] in_kernel, else PPTP interface=pppoe rm -f /var/run/pppoe.up ;; esac ;; esac if [ -f /var/run/imond.pid ] then /usr/local/bin/imond-stat "$real_interface down" fi rm -f /var/run/$interface.ip # default route existing or last default route interface going down? if [ -f /etc/default-route-interface ] then read default_route_interface def_gateway < /etc/default-route-interface elif [ -f /etc/last-default-route-interface ] then read default_route_interface def_gateway < /etc/last-default-route-interface rm -f /etc/last-default-route-interface else default_route_interface=`ip route show | grep '^default' | sed 's/^default.*dev //g'` case $default_route_interface in ppp0) default_route_interface=pppoe ;; esac fi if [ "$default_route_interface" = "$interface" ] then logger -t "ip-down[$$]" "default interface '$interface' goes down" rm -f /var/run/online is_default_route='yes' else is_default_route='no' fi # Call all custom ip-downs for j in /etc/ppp/ip-down[0-9][0-9][0-9].* do if [ -f $j ] then logger -t "ip-down[$$]" "executing $j" . $j fi done } script_op=down . /etc/ppp/ip-up-down