1 | #!/bin/sh |
---|
2 | # This should be called whenever an interface goes down, not just when |
---|
3 | # it is brought down explicitly. |
---|
4 | |
---|
5 | cd /etc/sysconfig/network-scripts |
---|
6 | . /etc/sysconfig/network-scripts/network-functions |
---|
7 | |
---|
8 | unset REALDEVICE |
---|
9 | if [ "$1" = --realdevice ] ; then |
---|
10 | REALDEVICE=$2 |
---|
11 | shift 2 |
---|
12 | fi |
---|
13 | |
---|
14 | CONFIG=$1 |
---|
15 | source_config |
---|
16 | |
---|
17 | [ -z "$REALDEVICE" ] && REALDEVICE=$DEVICE |
---|
18 | |
---|
19 | /etc/sysconfig/network-scripts/ifdown-routes ${REALDEVICE} ${DEVNAME} |
---|
20 | |
---|
21 | if [ "$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 |
---|
31 | fi |
---|
32 | |
---|
33 | # Reset the default route if this interface had a special one |
---|
34 | if ! 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 |
---|
47 | fi |
---|
48 | |
---|
49 | # Notify programs that have requested notification |
---|
50 | do_netreport |
---|
51 | |
---|
52 | if [ -x /sbin/ifdown-local ]; then |
---|
53 | /sbin/ifdown-local ${DEVICE} |
---|
54 | fi |
---|
55 | |
---|
56 | exit 0 |
---|