summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2012-05-18 17:36:48 +0900
committerBenda Xu <heroxbd@gentoo.org>2012-05-18 17:36:48 +0900
commitfb26a5c2df5e1fde31491ebeff69112712008353 (patch)
tree2f8414516404877c9df8e29df0c2b2536ab2bd5c /net-misc/wondershaper
downloadandroid-fb26a5c2df5e1fde31491ebeff69112712008353.tar.gz
android-fb26a5c2df5e1fde31491ebeff69112712008353.tar.bz2
android-fb26a5c2df5e1fde31491ebeff69112712008353.zip
initial commit
Diffstat (limited to 'net-misc/wondershaper')
-rw-r--r--net-misc/wondershaper/Manifest7
-rw-r--r--net-misc/wondershaper/files/Makefile16
-rw-r--r--net-misc/wondershaper/files/append-return-1.awk16
-rw-r--r--net-misc/wondershaper/files/rc.skel26
-rw-r--r--net-misc/wondershaper/files/wondershaper-1.1a.patch73
-rw-r--r--net-misc/wondershaper/metadata.xml7
-rw-r--r--net-misc/wondershaper/wondershaper-1.1a.ebuild33
7 files changed, 178 insertions, 0 deletions
diff --git a/net-misc/wondershaper/Manifest b/net-misc/wondershaper/Manifest
new file mode 100644
index 0000000..1920ecc
--- /dev/null
+++ b/net-misc/wondershaper/Manifest
@@ -0,0 +1,7 @@
+AUX Makefile 403 RMD160 d620a996d31bb2724c19d3aa4d4b58a5e636797d SHA1 1f4a154854be3101a2f78cc2e487d30ffbf0f50c SHA256 432a6f9c1c0892f122f8ad7808e7fe21252c15b7db7a03e59fb84bffc1a9f427
+AUX append-return-1.awk 181 RMD160 600b15e3f786806f4f69c0e3d2490a9f9fa63abe SHA1 86496fdb51a9314c6b7eb69a5a1aad3c2387b20f SHA256 4e9592d425c37a04320407294790e8ed8bcf1ff66043077ce0f1930e6e44ef50
+AUX rc.skel 293 RMD160 01bbf93e02db199094c0b8eaf80e6cfa41b4ab8e SHA1 349823c747bad5104acb9f1c3637efef3f3448bf SHA256 82d89c39363a1b260abc678096c628d6e99ddfbea2c07d610a2b3fdd82f2b4c4
+AUX wondershaper-1.1a.patch 2202 RMD160 f96389ae43b5da1190d71d20ea6a93f00254de70 SHA1 fc64a67121620a63a97e69231f996ba873e1f9bc SHA256 a48965187d7a4e669740d7dc8f17138e153fb5d4a844335c1dff33ae589da94b
+DIST wondershaper-1.1a.tar.gz 12486 RMD160 31478a760c623468c98343a0d45ac64a4ca86937 SHA1 9d8e1ce7f0758c246ead34e8c9f1ec9d7e80b8ea SHA256 5695373d1bd24f10a1ba6cc2e0c5e12c59c32322b66ba9870e3005bbdfa6525b
+EBUILD wondershaper-1.1a.ebuild 722 RMD160 b4eb68657c1f878a188fdecd51e63455260c1a62 SHA1 4160cb8f702f92568bc01d9c9508c4688ca3d0ef SHA256 89636a4d786daf48d105f21acb6a31788ee95736436459fca7c05fb180790186
+MISC metadata.xml 221 RMD160 5c03415a123ca23f57aec3ff525fd718062440f3 SHA1 41cc18d6ee6f23cf13ea7c85322f65d148dd8ab6 SHA256 6aee2681df7d7e2a704fc34217720d6d67ecbf0c974dbd0b27eee13c34df29bd
diff --git a/net-misc/wondershaper/files/Makefile b/net-misc/wondershaper/files/Makefile
new file mode 100644
index 0000000..52a3bf2
--- /dev/null
+++ b/net-misc/wondershaper/files/Makefile
@@ -0,0 +1,16 @@
+.PHONY: all
+all: wondershaper.config wondershaper
+
+wondershaper.config:
+ tail -n+2 wshaper \
+ | awk '/^# Now remove/{firstPartOver=1}{if (! firstPartOver) print $0}' \
+ >> $@
+wondershaper: wshaper
+ cp rc.skel $@
+ awk '/^if \[/{firstPartOver=1}{if (firstPartOver) print $0}' $^ \
+ | awk -f append-return-1.awk \
+ | sed 's/exit/return 0/' >> $@
+ echo "}" >> $@
+
+clean:
+ rm wondershaper wondershaper.config \ No newline at end of file
diff --git a/net-misc/wondershaper/files/append-return-1.awk b/net-misc/wondershaper/files/append-return-1.awk
new file mode 100644
index 0000000..75fc244
--- /dev/null
+++ b/net-misc/wondershaper/files/append-return-1.awk
@@ -0,0 +1,16 @@
+{
+ addOR=nextAddOR;nextAddOR=0
+}
+/tc.*add/{
+ addOR=1
+}
+/\\$/{
+ nextAddOR=addOR;addOR=0
+}
+{
+ printf("%s",$0);
+ if (addOR)
+ print " || return 1"
+ else
+ printf "\n"
+} \ No newline at end of file
diff --git a/net-misc/wondershaper/files/rc.skel b/net-misc/wondershaper/files/rc.skel
new file mode 100644
index 0000000..e78ce3b
--- /dev/null
+++ b/net-misc/wondershaper/files/rc.skel
@@ -0,0 +1,26 @@
+#!/sbin/runscript
+
+# wraps wondershaper
+
+opts="${opts} showstatus"
+
+start() {
+ ebegin "Starting wondershaper"
+ real_shaper start
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping wondershaper"
+ real_shaper stop
+ eend $?
+}
+
+showstatus() {
+ ebegin "Status"
+ real_shaper status
+ eend $?
+}
+
+real_shaper() {
+
diff --git a/net-misc/wondershaper/files/wondershaper-1.1a.patch b/net-misc/wondershaper/files/wondershaper-1.1a.patch
new file mode 100644
index 0000000..22c849c
--- /dev/null
+++ b/net-misc/wondershaper/files/wondershaper-1.1a.patch
@@ -0,0 +1,73 @@
+diff -u -d --minimal --ignore-all-space -r wondershaper-1.1a/wshaper wondershaper-1.1a_patched/wshaper
+--- wondershaper-1.1a/wshaper 2002-04-16 16:26:35.000000000 +0200
++++ wondershaper-1.1a_patched/wshaper 2003-05-09 11:58:51.000000000 +0200
+@@ -102,14 +102,24 @@
+ # some traffic however suffers a worse fate
+ for a in $NOPRIOPORTDST
+ do
++ PORT=${a%/*}
++ MASK=${a#*/}
++ if [ "${PORT}" = "${a}" ]; then
++ MASK='0xffff'
++ fi
+ tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
+- match ip dport $a 0xffff flowid 1:30
++ match ip dport ${PORT} ${MASK} flowid 1:30
+ done
+
+ for a in $NOPRIOPORTSRC
+ do
++ PORT=${a%/*}
++ MASK=${a#*/}
++ if [ "${PORT}" = "${a}" ]; then
++ MASK='0xffff'
++ fi
+ tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \
+- match ip sport $a 0xffff flowid 1:30
++ match ip sport ${PORT} ${MASK} flowid 1:30
+ done
+
+ for a in $NOPRIOHOSTSRC
+diff -u -d --minimal --ignore-all-space -r wondershaper-1.1a/wshaper.htb wondershaper-1.1a_patched/wshaper.htb
+--- wondershaper-1.1a/wshaper.htb 2002-04-16 16:26:51.000000000 +0200
++++ wondershaper-1.1a_patched/wshaper.htb 2003-05-09 11:59:07.000000000 +0200
+@@ -66,10 +66,10 @@
+ # and a lower priority:
+
+ tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[9*$UPLINK/10]kbit \
+- burst 6k prio 2
++ ceil ${UPLINK}kbit burst 6k prio 2
+
+ tc class add dev $DEV parent 1:1 classid 1:30 htb rate $[8*$UPLINK/10]kbit \
+- burst 6k prio 2
++ ceil ${UPLINK}kbit burst 6k prio 2
+
+ # all get Stochastic Fairness:
+ tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
+@@ -101,14 +101,24 @@
+ # some traffic however suffers a worse fate
+ for a in $NOPRIOPORTDST
+ do
++ PORT=${a%/*}
++ MASK=${a#*/}
++ if [ "${PORT}" = "${a}" ]; then
++ MASK='0xffff'
++ fi
+ tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
+- match ip dport $a 0xffff flowid 1:30
++ match ip dport ${PORT} ${MASK} flowid 1:30
+ done
+
+ for a in $NOPRIOPORTSRC
+ do
++ PORT=${a%/*}
++ MASK=${a#*/}
++ if [ "${PORT}" = "${a}" ]; then
++ MASK='0xffff'
++ fi
+ tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \
+- match ip sport $a 0xffff flowid 1:30
++ match ip sport ${PORT} ${MASK} flowid 1:30
+ done
+
+ for a in $NOPRIOHOSTSRC
diff --git a/net-misc/wondershaper/metadata.xml b/net-misc/wondershaper/metadata.xml
new file mode 100644
index 0000000..2bce140
--- /dev/null
+++ b/net-misc/wondershaper/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<use>
+ <flag name="htb">Use Hierarchy Token Bucket as tc algorithm</flag>
+</use>
+</pkgmetadata>
diff --git a/net-misc/wondershaper/wondershaper-1.1a.ebuild b/net-misc/wondershaper/wondershaper-1.1a.ebuild
new file mode 100644
index 0000000..1e6b84a
--- /dev/null
+++ b/net-misc/wondershaper/wondershaper-1.1a.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="a QoS script"
+HOMEPAGE="http://lartc.org/wondershaper"
+SRC_URI="${HOMEPAGE}/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+DEPEND=""
+RDEPEND="sys-apps/iproute2"
+
+IUSE="+htb"
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}.patch"
+ for FILE in rc.skel Makefile append-return-1.awk
+ do
+ cp "${FILESDIR}"/${FILE} "${S}"/ || die "copy ${FILE} failed"
+ done
+ use htb && { cp -f wshaper.htb wshaper || die "copy wshaper.htb failed" ; }
+}
+
+src_install() {
+ doinitd ${PN}
+ newconfd ${PN}.config ${PN}
+ dodoc ChangeLog README TODO VERSION
+}