]> git.pld-linux.org Git - packages/rc-scripts.git/blob - rc-scripts-tc.patch
- obsolete
[packages/rc-scripts.git] / rc-scripts-tc.patch
1 diff -uNr rc-scripts-0.3.1.orig/sysconfig/network-scripts/ifdown-post rc-scripts-0.3.1/sysconfig/network-scripts/ifdown-post
2 --- rc-scripts-0.3.1.orig/sysconfig/network-scripts/ifdown-post Tue May 15 18:06:00 2001
3 +++ rc-scripts-0.3.1/sysconfig/network-scripts/ifdown-post      Wed Feb 11 13:40:29 2004
4 @@ -1,6 +1,6 @@
5  #!/bin/sh
6  #
7 -#      $Id$
8 +#      $Id$
9  #
10  # This should be called whenever an interface goes down, not just when
11  # it is brought down explicitly.
12 @@ -20,9 +20,23 @@
13  # set REALDEVICE
14  get_ppp_device_and_pid
15  
16 -# Delete root queueing discipline
17 -if [ -n "$QDISC" ]; then
18 -       tc qdisc del dev "$REALDEVICE" root $QDISC
19 +# (QoS) Delete root queueing discipline
20 +if [ -n "${BANDWIDTH_OUT}" ]; then
21 +    if [ "${QDISC_CLASS}" = "htb" -o "${QDISC_CLASS}" = "cbq" ]; then
22 +       tc qdisc del dev ${REALDEVICE} root
23 +    elif [ -z "${QDISC}" -o "${QDISC}" = "tbf" ]; then
24 +       tc qdisc del dev ${REALDEVICE} root
25 +    elif [ -n "${QDISC}" ]; then
26 +       tc qdisc del dev ${REALDEVICE} root
27 +    fi
28 +else
29 +    if [ -n "${QDISC}" ]; then
30 +       tc qdisc add dev ${REALDEVICE} root
31 +    fi
32 +fi
33 +
34 +if [ -n "${BANDWIDTH_IN}" ]; then
35 +    tc qdisc del dev ${REALDEVICE} ingress
36  fi
37  
38  # execute run_down() function (if available in device configuration file)
39 diff -uNr rc-scripts-0.3.1.orig/sysconfig/network-scripts/ifup-post rc-scripts-0.3.1/sysconfig/network-scripts/ifup-post
40 --- rc-scripts-0.3.1.orig/sysconfig/network-scripts/ifup-post   Wed Feb 11 13:38:21 2004
41 +++ rc-scripts-0.3.1/sysconfig/network-scripts/ifup-post        Wed Feb 11 13:40:29 2004
42 @@ -1,6 +1,6 @@
43  #!/bin/sh
44  #
45 -#      $Id$
46 +#      $Id$
47  #
48  
49  run_up() { :; }
50 @@ -19,10 +19,37 @@
51  # set REALDEVICE
52  get_ppp_device_and_pid
53  
54 -if [ -n "$QDISC" ]; then
55 -# Set the queuing discipline
56 -#    eg: sfq for better link sharing or teql0 for link equalizer
57 -       tc qdisc add dev "$REALDEVICE" root $QDISC
58 +# Simple QoS support (bandwidth limit)
59 +if [ -n "${BANDWIDTH_OUT}" ]; then
60 +    if [ "${QDISC_CLASS}" = "htb" -o "${QDISC_CLASS}" = "cbq" ]; then
61 +        case "${QDISC_CLASS}" in
62 +            htb)
63 +                tc qdisc add dev ${REALDEVICE} root handle 1: htb default 10
64 +                tc class add dev ${REALDEVICE} parent 1: classid 1:10 htb rate ${BANDWIDTH_OUT}kbit ceil ${BANDWIDTH_OUT}kbit
65 +                [ -n "${QDISC}" ] && tc qdisc add dev ${REALDEVICE} parent 1:10 ${QDISC}
66 +                ;;
67 +            cbq)
68 +               # FIXME: hardcoded ethernet speed (bandwidth)
69 +                tc qdisc add dev ${REALDEVICE} root handle 1: cbq bandwidth 100000kbit cell 8 avpkt 1000 mpu 64
70 +                tc class add dev ${REALDEVICE} parent 1: classid 1:10 cbq bandwidth 100000kbit rate ${BANDWIDTH_OUT}kbit maxburst 5 avpkt 1000 allot 1514 bounded
71 +                [ -n "${QDISC}" ] && tc qdisc add dev ${REALDEVICE} parent 1:10 ${QDISC}
72 +               tc filter add dev ${REALDEVICE} protocol ip parent 1: u32 match ip src 0.0.0.0/0 flowid 1:10
73 +                ;;
74 +        esac
75 +    elif [ -z "${QDISC}" -o "${QDISC}" = "tbf" ]; then
76 +       tc qdisc add dev ${REALDEVICE} root tbf rate ${BANDWIDTH_OUT}kbit latency 50ms burst 51200
77 +    elif [ -n "${QDISC}" ]; then
78 +       tc qdisc add dev ${REALDEVICE} root ${QDISC}
79 +    fi
80 +else
81 +    if [ -n "${QDISC}" ]; then
82 +       tc qdisc add dev ${REALDEVICE} root ${QDISC}
83 +    fi
84 +fi
85 +
86 +if [ -n "${BANDWIDTH_IN}" ]; then
87 +    tc qdisc add dev ${REALDEVICE} handle ffff: ingress
88 +    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
89  fi
90  
91  /etc/sysconfig/network-scripts/ifup-aliases ${CONFIG}
This page took 0.119352 seconds and 3 git commands to generate.