]> git.pld-linux.org Git - projects/rc-scripts.git/blob - sysconfig/network-scripts/ifup-post
- preparation for upcoming 0.4.0.1 release
[projects/rc-scripts.git] / sysconfig / network-scripts / ifup-post
1 #!/bin/sh
2 #
3 #       $Id$
4 #
5
6 run_up() { :; }
7
8 . /etc/rc.d/init.d/functions
9 . /etc/sysconfig/network
10 . /etc/sysconfig/network-scripts/functions.network
11
12 need_hostname
13 CONFIG=$1
14 source_config
15
16 # set all major variables
17 setup_ip_param
18
19 # set REALDEVICE
20 get_ppp_device_and_pid
21
22 # Simple QoS support (bandwidth limit)
23 if [ -n "${BANDWIDTH_OUT}" ]; then
24     if [ "${QDISC_CLASS}" = "htb" -o "${QDISC_CLASS}" = "cbq" ]; then
25         case "${QDISC_CLASS}" in
26             htb)
27                 tc qdisc add dev ${REALDEVICE} root handle 1: htb default 10
28                 tc class add dev ${REALDEVICE} parent 1: classid 1:10 htb rate ${BANDWIDTH_OUT}kbit ceil ${BANDWIDTH_OUT}kbit
29                 [ -n "${QDISC}" ] && tc qdisc add dev ${REALDEVICE} parent 1:10 ${QDISC}
30                 ;;
31             cbq)
32                 # FIXME: hardcoded ethernet speed (bandwidth)
33                 tc qdisc add dev ${REALDEVICE} root handle 1: cbq bandwidth 100000kbit cell 8 avpkt 1000 mpu 64
34                 tc class add dev ${REALDEVICE} parent 1: classid 1:10 cbq bandwidth 100000kbit rate ${BANDWIDTH_OUT}kbit maxburst 5 avpkt 1000 allot 1514 bounded
35                 [ -n "${QDISC}" ] && tc qdisc add dev ${REALDEVICE} parent 1:10 ${QDISC}
36                 tc filter add dev ${REALDEVICE} protocol ip parent 1: u32 match ip src 0.0.0.0/0 flowid 1:10
37                 ;;
38         esac
39     elif [ -z "${QDISC}" -o "${QDISC}" = "tbf" ]; then
40         tc qdisc add dev ${REALDEVICE} root tbf rate ${BANDWIDTH_OUT}kbit latency 50ms burst 51200
41     elif [ -n "${QDISC}" ]; then
42         tc qdisc add dev ${REALDEVICE} root ${QDISC}
43     fi
44 else
45     if [ -n "${QDISC}" ]; then
46         tc qdisc add dev ${REALDEVICE} root ${QDISC}
47     fi
48 fi
49
50 if [ -n "${BANDWIDTH_IN}" ]; then
51     tc qdisc add dev ${REALDEVICE} handle ffff: ingress
52     tc filter add dev ${REALDEVICE} parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate ${BANDWIDTH_IN}kbit burst 10k drop flowid :3
53 fi
54
55 /etc/sysconfig/network-scripts/ifup-aliases ${CONFIG}
56 /etc/sysconfig/network-scripts/ifup-routes ${CONFIG}
57 /etc/sysconfig/network-scripts/ifup-neigh ${CONFIG}
58
59 # don't set hostname on ppp/slip connections
60 if [ -n "$NEEDHOSTNAME" -a "${DEVICETYPE}" != "ppp" -a "${DEVICETYPE}" != "slip" ]; then
61         IPADDR=$(ip -f inet addr show dev ${DEVICE} | 
62                 awk '/inet/ { print $2 }' |awk -F"/" '{ print $1 }')
63         eval $(/bin/ipcalc --silent --hostname ${IPADDR}) && set_hostname $HOSTNAME
64 fi
65
66 # run tleds software
67 if [ "$TLEDS_DEV" = "$DEVICE" -a -x /usr/bin/tleds ]; then
68         /usr/bin/tleds -qc "$DEVICE"
69 fi
70
71 # execute run_up() function (if available in device configuration file)
72 run_up
73
74 # Notify programs that have requested notification
75 do_netreport
76
77 exit 0
78
79 # This must be last line !
80 # vi:syntax=sh:tw=78:ts=8:sw=4
This page took 0.068669 seconds and 3 git commands to generate.