#!/bin/sh
#
#	$Id: ifup-post,v 1.24 2001/12/03 17:50:33 jajcus Exp $
#

run_up() { :; }

. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
. /etc/sysconfig/network-scripts/.functions

need_hostname
CONFIG=$1
source_config

# set all major variables
setup_ip_param

# set REALDEVICE
get_ppp_device_and_pid

if [ -n "$QDISC" ]; then
# Set the queuing discipline
#    eg: sfq for better link sharing or teql0 for link equalizer
	tc qdisc add dev "$REALDEVICE" root $QDISC
fi

/etc/sysconfig/network-scripts/ifup-aliases ${CONFIG}
/etc/sysconfig/network-scripts/ifup-routes ${CONFIG}
/etc/sysconfig/network-scripts/ifup-neigh ${CONFIG}

# don't set hostname on ppp/slip connections
if [ -n "$NEEDHOSTNAME" -a "${DEVICETYPE}" != "ppp" -a "${DEVICETYPE}" != "slip" ]; then
	IPADDR=$(ip -f inet addr show dev ${DEVICE} | 
		awk '/inet/ { print $2 }' |awk -F"/" '{ print $1 }')
	eval $(/bin/ipcalc --silent --hostname ${IPADDR}) && set_hostname $HOSTNAME
fi

# run tleds software
if [ "$TLEDS_DEV" = "$DEVICE" -a -x /usr/bin/tleds ]; then
	/usr/bin/tleds -qc "$DEVICE"
fi

# execute run_up() function (if available in device configuration file)
run_up

# Notify programs that have requested notification
do_netreport

exit 0

# This must be last line !
# vi:syntax=sh:tw=78:ts=8:sw=4
