aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/htb-init
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/htb-init
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
downloadopenembedded-709c4d66e0b107ca606941b988bad717c0b45d9b.tar.gz
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/htb-init')
-rw-r--r--recipes/htb-init/htb-init-0.8.5/htb-basic-verbose.diff25
-rw-r--r--recipes/htb-init/htb-init-0.8.5/htb.init+ingress+predef+verbose.diff238
-rw-r--r--recipes/htb-init/htb-init_0.8.5.bb18
3 files changed, 281 insertions, 0 deletions
diff --git a/recipes/htb-init/htb-init-0.8.5/htb-basic-verbose.diff b/recipes/htb-init/htb-init-0.8.5/htb-basic-verbose.diff
new file mode 100644
index 0000000000..6d8bae03ab
--- /dev/null
+++ b/recipes/htb-init/htb-init-0.8.5/htb-basic-verbose.diff
@@ -0,0 +1,25 @@
+--- htb.init-v0.8.5.o 2004-10-25 18:47:57.216822072 +0200
++++ htb.init-v0.8.5 2004-10-25 18:48:18.748548752 +0200
+@@ -441,11 +441,11 @@
+ PRIO_REALM_DEFAULT=${PRIO_REALM:-300}
+
+ ### Default HTB_PATH & HTB_CACHE settings
+-HTB_PATH=${HTB_PATH:-/etc/sysconfig/htb}
++HTB_PATH=${HTB_PATH:-/etc/htb}
+ HTB_CACHE=${HTB_CACHE:-/var/cache/htb.init}
+
+ ### Uncomment for sed/find with less features (useful for busybox)
+-#HTB_BASIC="yes"
++HTB_BASIC="yes"
+
+ ### Uncomment to enable logfile for debugging
+ #HTB_DEBUG="/var/run/htb-$1"
+@@ -462,7 +462,7 @@
+ HTB_CLASS="$HTB_CLASS\|LIMIT\|QUANTUM\|PERTURB"
+
+ ### uncomment to print some info while setting up
+-#VERBOSE="yes"
++VERBOSE="yes"
+
+ #############################################################################
+ ############################# SUPPORT FUNCTIONS #############################
diff --git a/recipes/htb-init/htb-init-0.8.5/htb.init+ingress+predef+verbose.diff b/recipes/htb-init/htb-init-0.8.5/htb.init+ingress+predef+verbose.diff
new file mode 100644
index 0000000000..809fed70ae
--- /dev/null
+++ b/recipes/htb-init/htb-init-0.8.5/htb.init+ingress+predef+verbose.diff
@@ -0,0 +1,238 @@
+--- htb.init-v0.8.5 2004-10-25 11:01:42.000000000 +0200
++++ htb 2004-10-25 18:26:29.720551256 +0200
+@@ -27,6 +27,12 @@
+ #
+ # VERSION HISTORY
+ # ---------------
++# - Bruno Randolf <bruno.randolf at 4g-systems.biz>
++# - added ingress limiting
++# - added predefined PREDEF filter rules
++# - added PROTOCOL filter rule
++# - added TOS filter rule
++# - added VERBOSE option
+ # v0.8.5- Nathan Shafer <nicodemus at users.sourceforge.net>
+ # - allow symlins to class files
+ # - Seth J. Blank <antifreeze at users.sourceforge.net>
+@@ -175,6 +181,14 @@
+ # fairness but allows HTB to be used on very fast network devices.
+ # This is turned off by default.
+ #
++# INGRESS=<speed> optional
++# INGRESS=900Kbit
++#
++# This parameters activates the limiting of incoming traffic.
++# Everything exceeding this rate will be dropped. This can be
++# useful to keep the queues of DSL modems empty to allow
++# low latency interactive traffic.
++#
+ ### HTB class parameters
+ #
+ # The following are parameters for HTB classes and are expected
+@@ -334,6 +348,17 @@
+ # use multiple MARK fields per config.
+ #
+ #
++#
++# PREDEF=ack|icmp|ssh-interactive|ssh-scp
++#
++# This are some predefined u32 filters.
++# * ack: small acknowledgement packets
++# * icmp: icmp packets
++# * ssh-interactive: interactive SSH sessions (not scp)
++# * ssh-scp: ssh file transfer (scp)
++#
++#
++#
+ # Note: Rules for different filter types can be combined. Attention must be
+ # paid to the priority of filter rules, which can be set below through
+ # the PRIO_{RULE,MARK,REALM} variables.
+@@ -427,15 +452,17 @@
+
+ ### Modules to probe for. Uncomment the last HTB_PROBE
+ ### line if you have QoS support compiled into kernel
+-HTB_PROBE="sch_htb sch_sfq cls_fw cls_u32 cls_route"
++HTB_PROBE="sch_htb sch_sfq cls_fw cls_u32 cls_route sch_ingress"
+ #HTB_PROBE=""
+
+ ### Config keywords
+-HTB_QDISC="DEFAULT\|DCACHE\|R2Q"
++HTB_QDISC="DEFAULT\|DCACHE\|R2Q\|INGRESS"
+ HTB_CLASS="RATE\|CEIL\|BURST\|CBURST\|PRIO\|LEAF\|MTU"
+ HTB_CLASS="$HTB_CLASS\|PRIO_RULE\|PRIO_MARK\|PRIO_REALM"
+ HTB_CLASS="$HTB_CLASS\|LIMIT\|QUANTUM\|PERTURB"
+
++### uncomment to print some info while setting up
++#VERBOSE="yes"
+
+ #############################################################################
+ ############################# SUPPORT FUNCTIONS #############################
+@@ -565,6 +592,7 @@
+ ### Remove root class from device $1
+ htb_device_off () {
+ tc qdisc del dev $1 root 2> /dev/null
++ tc qdisc del dev $1 ingress 2> /dev/null
+ } # htb_device_off
+
+
+@@ -605,7 +633,7 @@
+
+ ### Display traffic control setup
+ htb_show () {
+- for dev in `all_device_list`; do
++ for dev in `htb_device_list`; do
+ [ `tc qdisc show dev $dev| wc -l` -eq 0 ] && continue
+ echo -e "### $dev: queueing disciplines\n"
+ tc $1 qdisc show dev $dev; echo
+@@ -701,6 +729,10 @@
+ echo "$TC $@"
+ } # tc
+
++ print () {
++ echo "[ -n \"\$VERBOSE\" ] && echo '$@'"
++ }
++
+ elif [ -n "$HTB_DEBUG" ]; then
+ echo -e "# `date`" > $HTB_DEBUG
+
+@@ -715,6 +747,11 @@
+ echo -e "\n# tc $@" >> $HTB_DEBUG
+ $TC "$@" 2>&1 | tee -a $HTB_DEBUG
+ } # tc
++
++ print () {
++ echo -e "\n# [ -n \"\$VERBOSE\" ] && echo '$@'" >> $HTB_DEBUG
++ [ -n "$VERBOSE" ] && echo "$@"
++ }
+ else
+ # default wrappers
+
+@@ -725,6 +762,11 @@
+ tc () {
+ $TC "$@"
+ } # tc
++
++ print () {
++ [ -n "$VERBOSE" ] && echo "$@"
++ }
++
+ fi # ip/tc wrappers
+
+
+@@ -768,6 +810,7 @@
+ [ -z "$DEVICES" ] && htb_failure "no configured devices found!"
+
+ for dev in $DEVICES; do
++ print "setting up $dev..."
+ ### Retrieve root qdisc options
+ DEFAULT=""; DCACHE=""; R2Q=""
+ eval `htb_filter_file $dev| grep "^\($HTB_QDISC\)="`
+@@ -781,6 +824,15 @@
+ default ${DEFAULT:-0} ${R2Q:+r2q $R2Q} $DCACHE ||
+ htb_fail_off "failed to set root qdisc on $dev!"
+
++ # attach ingress filter
++ if [ "$INGRESS" != "" ]; then
++ print " shaping incoming traffic to $INGRESS"
++ tc qdisc add dev $dev handle ffff: ingress
++ # drop everything that's coming in too fast:
++ tc filter add dev $dev parent ffff: protocol ip prio 50 u32 match ip src \
++ 0.0.0.0/0 police rate ${INGRESS} burst 10k drop flowid :1
++ fi
++
+ [ "$1" = "compile" ] && echo
+ done # dev
+
+@@ -789,6 +841,8 @@
+ for classfile in `htb_class_list`; do
+ htb_load_class $classfile
+
++ print " class $CLASS (rate: $RATE, ceil: $CEIL)"
++
+ ### Create the class
+ tc class add dev $DEVICE parent 1:$PARENT classid 1:$CLASS \
+ htb rate $RATE ${CEIL:+ceil $CEIL} ${BURST:+burst $BURST} \
+@@ -813,6 +867,7 @@
+
+ ### Create fw filter for MARK fields
+ for mark in `htb_cfile_rules MARK`; do
++ print " mark $mark"
+ ### Attach fw filter to root class
+ tc filter add dev $DEVICE parent 1:0 protocol ip \
+ prio $PRIO_MARK handle $mark fw classid 1:$CLASS
+@@ -827,6 +882,7 @@
+ ### Convert asterisks to empty strings
+ SREALM=${SREALM#\*}; DREALM=${DREALM#\*}
+
++ print " realm $SREALM $DREALM"
+ ### Attach route filter to the root class
+ tc filter add dev $DEVICE parent 1:0 protocol ip \
+ prio $PRIO_REALM route ${SREALM:+from $SREALM} \
+@@ -870,12 +926,68 @@
+
+ ### Uncomment the following if you want to see parsed rules
+ #echo "$rule: $u32_s $u32_d"
++ print " source: $SRC dest: $DST"
+
+ ### Attach u32 filter to the appropriate class
+ tc filter add dev $DEVICE parent 1:0 protocol ip \
+ prio $PRIO_RULE u32 $u32_s $u32_d classid 1:$CLASS
+ done ### rule
+
++ ### Create u32 filter for TOS fields
++ for tos in `htb_cfile_rules TOS`; do
++ ### Attach to root class
++ print " tos $tos"
++ tc filter add dev $DEVICE parent 1:0 protocol ip \
++ prio $PRIO_RULE u32 match ip tos $tos 0xff classid 1:$CLASS
++ done ### tos
++
++ ### Create u32 filter for PROTOCOL fields
++ for p in `htb_cfile_rules PROTOCOL`; do
++ ### Attach to root class
++ print " protocol $p"
++ tc filter add dev $DEVICE parent 1:0 protocol ip \
++ prio $PRIO_RULE u32 match ip protocol $p 0xff classid 1:$CLASS
++ done ### protocol
++
++ ### some predefined u32 filters for convenience
++ for a in `htb_cfile_rules PREDEF`; do
++ case "$a" in
++ "ack")
++ print " ACK"
++ # IP protocol 6,
++ # IP header length 0x5(32 bit words),
++ # IP Total length 0x34 (ACK + 12 bytes of TCP options)
++ # TCP ack set (bit 5, offset 33)
++ tc filter add dev $DEVICE parent 1:0 protocol ip \
++ prio $PRIO_RULE u32 \
++ match ip protocol 6 0xff \
++ match u8 0x05 0x0f at 0 \
++ match u16 0x0000 0xffc0 at 2 \
++ match u8 0x10 0xff at 33 \
++ classid 1:$CLASS
++ ;;
++ "icmp")
++ print " ICMP"
++ tc filter add dev $DEVICE parent 1:0 protocol ip \
++ prio $PRIO_RULE u32 match ip protocol 1 0xff classid 1:$CLASS
++ ;;
++ "ssh-interactive")
++ print " ssh-interactive"
++ tc filter add dev $DEVICE parent 1:0 protocol ip \
++ prio $PRIO_RULE u32 \
++ match ip dport 22 0xffff \
++ match ip tos 0x10 0xff classid 1:$CLASS
++ ;;
++ "ssh-scp")
++ print " scp"
++ tc filter add dev $DEVICE parent 1:0 protocol ip \
++ prio $PRIO_RULE u32 \
++ match ip dport 22 0xffff \
++ match ip tos 0x08 0xff classid 1:$CLASS
++ ;;
++ esac
++ done
++
+ [ "$1" = "compile" ] && echo
+ done ### classfile
+ ;;
diff --git a/recipes/htb-init/htb-init_0.8.5.bb b/recipes/htb-init/htb-init_0.8.5.bb
new file mode 100644
index 0000000000..a70da77746
--- /dev/null
+++ b/recipes/htb-init/htb-init_0.8.5.bb
@@ -0,0 +1,18 @@
+DESCRIPTION = "HTB.init is a shell script that allows for easy setup of HTB-based traffic control on Linux."
+HOMEPAGE = "http://sourceforge.net/projects/htbinit"
+LICENSE = "GPL"
+PR = "r1"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/htbinit/htb.init-v${PV} \
+ file://htb.init+ingress+predef+verbose.diff;patch=1;pnum=0 \
+ file://htb-basic-verbose.diff;patch=1;pnum=0"
+RRECOMMENDS = "kernel-module-sch-ingress kernel-module-cls-route kernel-module-cls-u32 kernel-module-cls-fw kernel-module-sch-sfq kernel-module-sch-htb"
+RDEPENDS = "iproute2 (>= 2.6.8-r1)"
+
+S="${WORKDIR}"
+
+do_install() {
+ install -d ${D}${sysconfdir}/init.d
+ install -d ${D}${sysconfdir}/htb
+ install -m 755 ${S}/htb.init-v${PV} ${D}${sysconfdir}/init.d/htb
+}