Sophie

Sophie

distrib > Mandriva > 9.1 > i586 > by-pkgid > 8c6202abd5c23d52fed280e28dc23b0a > files > 83

initscripts-7.06-12.3.91mdk.i586.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

CONFIG=$1
source_config

DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"`

if [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" ]; then
    if [ -f /etc/resolv.conf.save ]; then
	cat /etc/resolv.conf.save > /etc/resolv.conf
	rm -f /etc/resolv.conf.save
    fi
    if [ -f /etc/ppp/peers/$DEVICE ] ; then
	rm -f /etc/ppp/peers/$DEVICE
    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 dev ${DEVICE}
        else
            /sbin/ip route add default via ${GATEWAY}
        fi
    else
        add_default_route ${DEVICE}
    fi
fi

# Notify programs that have requested notification
do_netreport

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