#!/bin/sh
#
#	$Id: ifdown-post,v 1.11 2000/11/16 15:58:55 baggins Exp $
#
# This should be called whenever an interface goes down, not just when
# it is brought down explicitly.

run_down() { :; }

CONFIG=$1
. /etc/sysconfig/network
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network-scripts/.functions

source_config

# full device name as specified by user
FULLDEVNAME="$DEVICE"
# detect network device type (ie. dummy, eth for dummy0, eth0 ..)
DEVICETYPE=$(echo $DEVICE | awk ' { gsub(/[0-9]*$/,NUL); print $0 } ')
# real name of device (ie. is eth0 for eth0,eth0:1,eth0:alias)
DEVICE=$(echo $DEVICE | awk ' { gsub(/:.*$/,NUL); print $0 } ')

if echo "$FULLDEVNAME" | grep -q ':' ; then
        ISALIAS=yes
else
        ISALIAS=no
fi

# execute run_up() function (if available in device configuration file)
[ "$ISALIAS" = "no" ] && run_down

# Notify programs that have requested notification
do_netreport

exit 0
