Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > main-updates > by-pkgid > b37503e09ea539176fa3a2506fa8882d > files > 93

initscripts-8.99-16.1mdv2010.2.x86_64.rpm

#!/bin/sh
# This should be called whenever an interface goes down, not just when
# it is brought down explicitly.

cd /etc/sysconfig/network-scripts
. ./network-functions

unset REALDEVICE
if [ "$1" = --realdevice ] ; then
    REALDEVICE=$2
    shift 2
fi

CONFIG=$1
source_config

[ -z "$REALDEVICE" ] && REALDEVICE=$DEVICE

/etc/sysconfig/network-scripts/ifdown-routes ${REALDEVICE} ${DEVNAME}

if [ "$PEERDNS" != "no" -o -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then
    clear_resolv_conf
    if [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" ]; then
        if [ -f /etc/ppp/peers/$DEVICE -a "$TYPE" != "ADSL" ] ; then
	    rm -f /etc/ppp/peers/$DEVICE
        fi
    fi
fi

# Reset the default route if this interface had a special one
if ! check_default_route ; then
    # ISDN device needs special handling dial on demand
    if [ "${DEVICETYPE}" = "ippp" -o "${DEVICETYPE}" = "isdn" ] && [ "$DIALMODE" = "auto" ] ; then
        if [ -z "$GATEWAY" ] ; then
            /sbin/ip route add default ${METRIC:+metric} \
		${WINDOW:+window $WINDOW} dev ${DEVICE}
        else
            /sbin/ip route add default ${METRIC:+metric} \
		${WINDOW:+window $WINDOW} via ${GATEWAY}
        fi
    else
        add_default_route ${DEVICE}
    fi
fi

# Notify programs that have requested notification
do_netreport

mdv-network-event interface_down ${DEVICE}

if [ -d /etc/sysconfig/network-scripts/ifdown.d -a -x /usr/bin/run-parts ]; then
    /usr/bin/run-parts --arg ${DEVICE} /etc/sysconfig/network-scripts/ifdown.d
fi

if [ -x /sbin/ifdown-local ]; then
    /sbin/ifdown-local ${DEVICE}
fi

exit 0