4 |
- |
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 |
. ./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 |
|
34 |
- |
21 |
if [ "$PEERDNS" != "no" -o -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ] && \
|
|
|
22 |
[ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" -o -n "${DNS1}" -o "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ] ; then
|
4 |
- |
23 |
if [ -f /etc/resolv.conf.save ]; then
|
|
|
24 |
change_resolv_conf /etc/resolv.conf.save
|
|
|
25 |
rm -f /etc/resolv.conf.save
|
|
|
26 |
fi
|
|
|
27 |
if [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" ]; then
|
|
|
28 |
if [ -f /etc/ppp/peers/$DEVICE ] ; then
|
|
|
29 |
rm -f /etc/ppp/peers/$DEVICE
|
|
|
30 |
fi
|
|
|
31 |
fi
|
|
|
32 |
fi
|
|
|
33 |
|
|
|
34 |
# Reset the default route if this interface had a special one
|
|
|
35 |
if ! check_default_route ; then
|
|
|
36 |
# ISDN device needs special handling dial on demand
|
|
|
37 |
if [ "${DEVICETYPE}" = "ippp" -o "${DEVICETYPE}" = "isdn" ] && [ "$DIALMODE" = "auto" ] ; then
|
|
|
38 |
if [ -z "$GATEWAY" ] ; then
|
|
|
39 |
/sbin/ip route add default ${METRIC:+metric} \
|
|
|
40 |
${WINDOW:+window $WINDOW} dev ${DEVICE}
|
|
|
41 |
else
|
|
|
42 |
/sbin/ip route add default ${METRIC:+metric} \
|
|
|
43 |
${WINDOW:+window $WINDOW} via ${GATEWAY}
|
|
|
44 |
fi
|
|
|
45 |
else
|
|
|
46 |
add_default_route ${DEVICE}
|
|
|
47 |
fi
|
|
|
48 |
fi
|
|
|
49 |
|
|
|
50 |
# Notify programs that have requested notification
|
|
|
51 |
do_netreport
|
|
|
52 |
|
|
|
53 |
if [ -x /sbin/ifdown-local ]; then
|
|
|
54 |
/sbin/ifdown-local ${DEVICE}
|
|
|
55 |
fi
|
|
|
56 |
|
|
|
57 |
exit 0
|