source: projects/initscripts/tags/initscripts-8.91.0/sysconfig/network-scripts/ifdown-post @ 2576

Revision 2576, 1.5 KB checked in by daisuke, 13 years ago (diff)

tagging as initscripts-8.91.0

Line 
1#!/bin/sh
2# This should be called whenever an interface goes down, not just when
3# it is brought down explicitly.
4
5cd /etc/sysconfig/network-scripts
6. /etc/sysconfig/network-scripts/network-functions
7
8unset REALDEVICE
9if [ "$1" = --realdevice ] ; then
10    REALDEVICE=$2
11    shift 2
12fi
13
14CONFIG=$1
15source_config
16
17[ -z "$REALDEVICE" ] && REALDEVICE=$DEVICE
18
19/etc/sysconfig/network-scripts/ifdown-routes ${REALDEVICE} ${DEVNAME}
20
21if [ "$PEERDNS" != "no" -o -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then
22    if [ -f /etc/resolv.conf.save ]; then
23        change_resolv_conf /etc/resolv.conf.save
24        rm -f /etc/resolv.conf.save
25    fi
26    if [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" ]; then
27        if [ -f /etc/ppp/peers/$DEVICE ] ; then
28            rm -f /etc/ppp/peers/$DEVICE
29        fi
30    fi
31fi
32
33# Reset the default route if this interface had a special one
34if ! check_default_route ; then
35    # ISDN device needs special handling dial on demand
36    if [ "${DEVICETYPE}" = "ippp" -o "${DEVICETYPE}" = "isdn" ] && [ "$DIALMODE" = "auto" ] ; then
37        if [ -z "$GATEWAY" ] ; then
38            /sbin/ip route add default ${METRIC:+metric} \
39                ${WINDOW:+window $WINDOW} dev ${DEVICE}
40        else
41            /sbin/ip route add default ${METRIC:+metric} \
42                ${WINDOW:+window $WINDOW} via ${GATEWAY}
43        fi
44    else
45        add_default_route ${DEVICE}
46    fi
47fi
48
49# Notify programs that have requested notification
50do_netreport
51
52if [ -x /sbin/ifdown-local ]; then
53    /sbin/ifdown-local ${DEVICE}
54fi
55
56exit 0
Note: See TracBrowser for help on using the repository browser.