summaryrefslogtreecommitdiff
path: root/net-misc/htbinit
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-misc/htbinit
reinit the tree, so we can have metadata
Diffstat (limited to 'net-misc/htbinit')
-rw-r--r--net-misc/htbinit/Manifest12
-rw-r--r--net-misc/htbinit/files/htb.init-v0.8.5_tos.patch51
-rw-r--r--net-misc/htbinit/files/htb.init_find_fix.patch33
-rw-r--r--net-misc/htbinit/files/htb_0.8.5_esfq.diff53
-rw-r--r--net-misc/htbinit/files/htb_0.8.5_ipv6.diff128
-rw-r--r--net-misc/htbinit/files/htbinit.rc46
-rw-r--r--net-misc/htbinit/files/prio_rule.patch20
-rw-r--r--net-misc/htbinit/files/timecheck_fix.patch42
-rw-r--r--net-misc/htbinit/htbinit-0.8.5-r7.ebuild60
-rw-r--r--net-misc/htbinit/metadata.xml19
10 files changed, 464 insertions, 0 deletions
diff --git a/net-misc/htbinit/Manifest b/net-misc/htbinit/Manifest
new file mode 100644
index 000000000000..cf82095be419
--- /dev/null
+++ b/net-misc/htbinit/Manifest
@@ -0,0 +1,12 @@
+AUX htb.init-v0.8.5_tos.patch 1656 SHA256 0b2b595d4fbf9aeac17646bbfc999009431a97061ccd995bd08c2edd26e51afb SHA512 6b8c78cd75207d23b1786ddeff01ba96e45fdba575b51dcd9e96880518a3edc97604f2fb2ccf44243e697dbe86233d38a26be54db3981e93ca98e3bf95e9dd87 WHIRLPOOL 8f962344b16c34e9efe50de29dffae52933ee1f6d741c33108ca63c183efc8ddc10d14a9d0d8f89056b811f9bb3a95130e2347e692aa40f21b931ec6a2bcd5f5
+AUX htb.init_find_fix.patch 1165 SHA256 23b55a4d946d75d44fc697537a6fc9d381df15bf041644dd5b9518b43827c2c6 SHA512 dbca235aa92ac5b2486fe7a89a215c4e621965f72ce04336d2c04cc02f61f40ec5a92347c1515b6e1114d176ea29cf61d457d504bfcaccfbe149d20231145d07 WHIRLPOOL 6ddd8812bcd2dcbf18e6c14e42bc045c58e437b4e9295b10658f0c3ed245da6535ec32aea907ee37c83af237caac44d664898ab76ee1539c57823fd7798cd684
+AUX htb_0.8.5_esfq.diff 1844 SHA256 d4f5b79d64eb008e799e03b509fbfe3153b7722c0575423d2797dc95b87b7f90 SHA512 ffef80a68b7e84b7c3758322bc58120fa67cd813c4a688f4f4483fdb0d8c1efb180e373b2b510d72c8f13945a0c6137fea005a70ffbb7ace12f4865b69db1bdd WHIRLPOOL fec0697265724ce73fa9ceb3ea5b677bf7ccae454bf7df79eba2bcfb81cfd09ecd47dd209f66844bfa8c75dcde09aa73910672e48164a71acc66990baf5efd77
+AUX htb_0.8.5_ipv6.diff 4663 SHA256 34e59cfa5fa06694ceb3c2368e49376bd61ec968bd3ee9cbd8ab753353e4c339 SHA512 3e1265d912e055fb2188945a46bd23a0798d04b8d3faf62344b11bd5e434cb7119098f095dc9b954dfae9b1e315e841df4dc0f47620500a884f7cbdf4d8c79c6 WHIRLPOOL a6ebb26133b650c298c761691e4e0461306b2e3e9c2ed7d1906c937e889e8158332671b2126c226c2c6151f0a80e5a02511181a237bb67dbd2187cee8005de24
+AUX htbinit.rc 706 SHA256 4478b8a6456bbaa7b42d7b587dd3b97ea4794a9046f9ba161bf849fd84945461 SHA512 17ddfb3dcc2c0b069c3af3548b385cbb894364f7a0c1a37f612c45368d1241dda03fadd544663fe09e2b2c7f2a4c2286f10848fb0230eb520e204b63fb7a3b52 WHIRLPOOL 787ae7fe92822a1f8a6c7960666bd57bc63c7e6c9be720560177a370d71a2e47eaac8e1ca62eb94cc81534c067a0e8b5c311cbc94e8081e3d85d37be699629e0
+AUX prio_rule.patch 636 SHA256 9c922957a37ecba93555ab1cac8684b3ef340b9da8e039394738e627ef24171a SHA512 f56f054a3ae3770ad9f8de5d43a2f73c211f92db98bce067195b950c182443efee653205e1f86b18e17ba6096d1e574ea7c0a7cc0326a141f84a0cc6f80c8edf WHIRLPOOL a61ab49e05ba1ca156f1fbff99d91188e582889603b4b6a927594a3e11918d5486ff27230fe9c63f402e30b7bfc64b4b120f34beb21f6c88d2fe6370b917aebd
+AUX timecheck_fix.patch 1221 SHA256 af5579df10eb67a37f6a9d9b042d2347e483cff4b89b47c76cc9c17b2f68d68a SHA512 ece43ece3ef84865311f14e783434048604b6c9c55b174a95cdaa89dbbccd091044ab387aef887d5c67c14b448260ba6fbd849ea6e454c245ba2c7918cec650e WHIRLPOOL af147d807eb2ec9b0cd3eae6aaec220d29e89c017448d160dae72d954d687797744d4b13e56ca7a3a1d377a9353c6ae7340bdf990dab21a87aebab37aebf9e9c
+DIST htb.init-v0.8.5 32038 SHA256 acfda369dff72b9073a8b70f2b05b1397a61a1cdb23970e5ed216d632ff33586 SHA512 5f54f662e8b30c4efa6c8cac50eeddfec8650aa6f651065c0962c32067ca7ba17266d20860c296bac44d1f78caa50f6c948f3c55d468a76f9ce2069a43d3c6dd WHIRLPOOL e83c96c152f5e781e963585794df339d5b44fbbfdc3f9bf23defb3c37aa301e08b7324877c784411138ffa600c6ce3c3b45e3ae92ba3e274a09eeb05d2d12d05
+EBUILD htbinit-0.8.5-r7.ebuild 1565 SHA256 b139dca0e7c1a6d624d008507c570519b2a496b599d46e79adecc5ff5260e442 SHA512 60a087eed90e4280ef127027c537215acabe6c16352bf2067819ee633b04bad41d96bb8c32e5a364b533d568a5880a54361254071f862459ac23e4f08a6c9b2e WHIRLPOOL c2842e54542af26b746679cb8f6177fcb59a8b40ba71bd441021c0a2d6e5732d0b20fc6e9ad3ed74796b62cda75d3d9e8376e4ada108819e5f570b5071e2eab6
+MISC ChangeLog 3135 SHA256 14721491349249a0ceb909e25eb636eceda3b4104625bee8523a5a112c788eea SHA512 20c0e13fab94a34612c07df40af0c8417248ea5b2167d6a64511eada1fcee6a912274ad59b6c4578e09250d44d6938dc0f29aa1e162f812fe1e844f244b2d69c WHIRLPOOL b6a50f2dde5a96178c3a06751dd853f23e91aa77899fdab0ce1a661a1bcbbb587d91012eea3a36011a0fec5fb2ef0a3bae8e46b2f43d5bd05344670b16aa7f7d
+MISC ChangeLog-2015 4348 SHA256 a4e84527ecce4add39a6e338a66b97156a2419c21d57441b6d233d43cfac3744 SHA512 ae1cb320b647b1286f99d928ccebd425f7defc643ef136545bd44b0d76bd4c8bd758999783fc048081db356b37eb009fffe066af53882471fff2b84986d8399a WHIRLPOOL 2ebb5c645a43ffcb27db757f950b9a6141fd654f28fa09dedb9751be47ceae53b957fbfc39122cc4864bea7a1c44d842b3a1b796f9d7285723e4ac90e564274f
+MISC metadata.xml 1010 SHA256 bf480efc21c8746dc01974ba29d29c07c28cd8f388203e1802117f65e6ab11a5 SHA512 9de719a9c9a15cbac8cfcd43effee95eac182647a0f695c4ff6d791caa4aa19f76d32dea34fbcdaea089ffdd454e2da2d7bd497c070a4b79308d68328a2d0d41 WHIRLPOOL 10d01ca3960957fa845c9ddd13a5cc7bdf20baedbbf3c648b4cf80fcee631668b75ddd63eac15dacfa5871a19b2e2a306c726e341144de1f869b0ee8c402157b
diff --git a/net-misc/htbinit/files/htb.init-v0.8.5_tos.patch b/net-misc/htbinit/files/htb.init-v0.8.5_tos.patch
new file mode 100644
index 000000000000..a798508631d3
--- /dev/null
+++ b/net-misc/htbinit/files/htb.init-v0.8.5_tos.patch
@@ -0,0 +1,51 @@
+--- htb.init.old 2005-03-15 14:56:08.328305288 +0200
++++ htb.init 2005-03-15 15:05:16.612953352 +0200
+@@ -240,6 +240,10 @@
+ # Maximum packet size HTB creates rate maps for. The default should
+ # be sufficient for most cases, it certainly is for Ethernet.
+ #
++# TOS=<number> optional, default "none"
++#
++# TOS field
++#
+ ### SFQ qdisc parameters
+ #
+ # The SFQ queueing discipline is a cheap way to fairly share class bandwidth
+@@ -435,6 +435,7 @@
+ 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"
++HTB_CLASS="$HTB_CLASS\|TOS"
+
+
+ #############################################################################
+@@ -646,7 +647,7 @@
+ ### Set defaults & load class
+ MTU=""; LEAF=none; PERTURB=10
+ RATE=""; BURST=""; CEIL=""; CBURST=""
+- PRIO=""; LIMIT=""; QUANTUM=""
++ PRIO=""; LIMIT=""; QUANTUM=""; TOS=""
+
+ PRIO_RULE=$PRIO_RULE_DEFAULT
+ PRIO_MARK=$PRIO_MARK_DEFAULT
+@@ -868,12 +869,19 @@
+ u32_d="${DPORT:+match ip dport $DPORT $DMASK}"
+ u32_d="${DADDR:+match ip dst $DADDR} $u32_d"
+
++
++ u32_tos=""
++ if [ -n "$TOS" ]; then
++ u32_tos="match ip tos $TOS 0xff"
++ fi
++
++
+ ### Uncomment the following if you want to see parsed rules
+ #echo "$rule: $u32_s $u32_d"
+
+ ### 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
++ prio $PRIO_RULE u32 $u32_s $u32_d $u32_tos classid 1:$CLASS
+ done ### rule
+
+ [ "$1" = "compile" ] && echo
diff --git a/net-misc/htbinit/files/htb.init_find_fix.patch b/net-misc/htbinit/files/htb.init_find_fix.patch
new file mode 100644
index 000000000000..12222b3e32a5
--- /dev/null
+++ b/net-misc/htbinit/files/htb.init_find_fix.patch
@@ -0,0 +1,33 @@
+--- htb.init.old 2004-01-29 22:41:23.000000000 +0100
++++ htb.init 2006-09-08 00:22:11.000000000 +0200
+@@ -468,8 +468,8 @@
+ ### List of classes in $HTB_PATH
+ htb_class_list () {
+ for dev in `htb_device_list`; do
+- find $HTB_PATH \( -type f -or -type l \) \
+- -name "$dev-*" -not -name '*~' -maxdepth 1 \
++ find $HTB_PATH -maxdepth 1 \( -type f -or -type l \) \
++ -name "$dev-*" -not -name '*~' \
+ -printf "%f\n"| sort
+ done
+ } # htb_class_list
+@@ -483,8 +483,8 @@
+ ### Validate cache against config files
+ htb_valid_cache () {
+ for dev in `htb_device_list`; do
+- [ `find $HTB_PATH \( -type f -or -type l \) \
+- -name "$dev*" -maxdepth 1 -newer $HTB_CACHE| \
++ [ `find $HTB_PATH -maxdepth 1 \( -type f -or -type l \) \
++ -name "$dev*" -newer $HTB_CACHE| \
+ wc -l` -gt 0 ] && VALID=0
+ [ $VALID -ne 1 ] && break
+ done
+@@ -493,7 +493,7 @@
+
+ ### Find class config for device $1, which is newer than cache
+ htb_cache_older () {
+- [ `find $HTB_PATH -type f -name "$1*" -maxdepth 1 \
++ [ `find $HTB_PATH -maxdepth 1 -type f -name "$1*" \
+ -newer $HTB_CACHE| wc -l` -gt 0 ] && return 0
+ return 1
+ } # htb_cache_older
diff --git a/net-misc/htbinit/files/htb_0.8.5_esfq.diff b/net-misc/htbinit/files/htb_0.8.5_esfq.diff
new file mode 100644
index 000000000000..3130f6868a4f
--- /dev/null
+++ b/net-misc/htbinit/files/htb_0.8.5_esfq.diff
@@ -0,0 +1,53 @@
+--- htb.init.old 2004-01-29 22:41:23.000000000 +0100
++++ htb.init 2006-09-07 23:32:58.000000000 +0200
+@@ -226,7 +226,7 @@
+ # priority. Also, classes with higher priority are offered excess
+ # bandwidth first.
+ #
+-# LEAF=none|sfq|pfifo|bfifo optional, default "none"
++# LEAF=none|sfq|esfq|pfifo|bfifo optional, default "none"
+ #
+ # Tells the script to attach specified leaf queueing discipline to HTB
+ # class. By default, no leaf qdisc is used.
+@@ -261,6 +261,15 @@
+ # will never take place which is what you probably don't want. The
+ # default value of 10 seconds is probably a good value.
+ #
++### ESFQ qdisc parameters
++#
++# Same as SFQ and ...
++#
++# HASH=classic|src|dst
++#
++# src mean is fair per source IP
++# dsr mean is fair per destination IP
++#
+ ### PFIFO/BFIFO qdisc parameters
+ #
+ # Those are simple FIFO queueing disciplines. They only have one parameter
+@@ -427,14 +445,14 @@
+
+ ### 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 sch_esfq cls_fw cls_u32 cls_route"
+ #HTB_PROBE=""
+
+ ### Config keywords
+ HTB_QDISC="DEFAULT\|DCACHE\|R2Q"
+ 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"
++HTB_CLASS="$HTB_CLASS\|LIMIT\|QUANTUM\|PERTURB\|HASH"
+ HTB_CLASS="$HTB_CLASS\|TOS"
+
+
+@@ -801,6 +819,8 @@
+ LEAFPARM="${PERTURB:+perturb $PERTURB} ${QUANTUM:+quantum $QUANTUM}"
+ elif [ "$LEAF" = "pfifo" -o "$LEAF" = "bfifo" ]; then
+ LEAFPARM="${LIMIT:+limit $LIMIT}"
++ elif [ "$LEAF" = "esfq" ]; then
++ LEAFPARM="${PERTURB:+perturb $PERTURB} ${QUANTUM:+quantum $QUANTUM} ${HASH:+hash $HASH}"
+ else
+ htb_fail_off "unknown leaf qdisc ($LEAF) in $classfile!"
+ fi
diff --git a/net-misc/htbinit/files/htb_0.8.5_ipv6.diff b/net-misc/htbinit/files/htb_0.8.5_ipv6.diff
new file mode 100644
index 000000000000..815f99545a61
--- /dev/null
+++ b/net-misc/htbinit/files/htb_0.8.5_ipv6.diff
@@ -0,0 +1,128 @@
+--- htb.init.old 2004-01-29 22:41:23.000000000 +0100
++++ htb.init 2006-09-07 23:32:58.000000000 +0200
+@@ -275,6 +284,7 @@
+ ### Filtering parameters
+ #
+ # RULE=[[saddr[/prefix]][:port[/mask]],][daddr[/prefix]][:port[/mask]]
++# RULEIPv6=[[saddr[/prefix]][_port[/mask]],][daddr[/prefix]][_port[/mask]]
+ #
+ # These parameters make up "u32" filter rules that select traffic for
+ # each of the classes. You can use multiple RULE fields per config.
+@@ -300,9 +310,13 @@
+ # RULE=10.5.5.5:80,
+ # selects traffic going from port 80 of single host 10.5.5.5
+ #
++# RULEIPv6=3ffe:80fe:c28:1:45d1:3a1:5e2b:e6c8
++# selects traffic going to IPv6 host 3ffe:80fe:c28:1:45d1:3a1:5e2b:e6c8
++#
+ #
+ #
+ # REALM=[srealm,][drealm]
++# REALMIPv6=[srealm,][drealm]
+ #
+ # These parameters make up "route" filter rules that classify traffic
+ # according to packet source/destination realms. For information about
+@@ -327,6 +341,7 @@
+ #
+ #
+ # MARK=<mark>
++# MARKIPv6=<mark>
+ #
+ # These parameters make up "fw" filter rules that select traffic for
+ # each of the classes accoring to firewall "mark". Mark is a decimal
+@@ -414,6 +429,9 @@
+ PRIO_RULE_DEFAULT=${PRIO_RULE:-100}
+ PRIO_MARK_DEFAULT=${PRIO_MARK:-200}
+ PRIO_REALM_DEFAULT=${PRIO_REALM:-300}
++PRIO_RULEIPv6=${PRIO_RULEIPv6:-150}
++PRIO_MARKIPv6=${PRIO_MARKIPv6:-250}
++PRIO_REALMIPv6=${PRIO_REALMIPv6:-350}
+
+ ### Default HTB_PATH & HTB_CACHE settings
+ HTB_PATH=${HTB_PATH:-/etc/sysconfig/htb}
+@@ -818,6 +838,13 @@
+ prio $PRIO_MARK handle $mark fw classid 1:$CLASS
+ done ### mark
+
++ ### Create fw filter for MARKIPv6 fields
++ for mark in `htb_cfile_rules MARKIPv6`; do
++ ### Attach fw filter to root class
++ tc filter add dev $DEVICE parent 1:0 protocol ipv6 \
++ prio $PRIO_MARKIPv6 handle $mark fw classid 1:$CLASS
++ done ### markipv6
++
+ ### Create route filter for REALM fields
+ for realm in `htb_cfile_rules REALM`; do
+ ### Split realm into source & destination realms
+@@ -833,6 +860,21 @@
+ ${DREALM:+to $DREALM} classid 1:$CLASS
+ done ### realm
+
++ ### Create route filter for REALMIPv6 fields
++ for realm in `htb_cfile_rules REALMIPv6`; do
++ ### Split realm into source & destination realms
++ SREALM=${realm%%,*}; DREALM=${realm##*,}
++ [ "$SREALM" = "$DREALM" ] && SREALM=""
++
++ ### Convert asterisks to empty strings
++ SREALM=${SREALM#\*}; DREALM=${DREALM#\*}
++
++ ### Attach route filter to the root class
++ tc filter add dev $DEVICE parent 1:0 protocol ipv6 \
++ prio $PRIO_REALM route ${SREALM:+from $SREALM} \
++ ${DREALM:+to $DREALM} classid 1:$CLASS
++ done ### realmipv6
++
+ ### Create u32 filter for RULE fields
+ for rule in `htb_cfile_rules RULE`; do
+ ### Split rule into source & destination
+@@ -876,6 +918,49 @@
+ prio $PRIO_RULE u32 $u32_s $u32_d classid 1:$CLASS
+ done ### rule
+
++ ### Create u32 filter for RULEIPv6 fields
++ for rule in `htb_cfile_rules RULEIPv6`; do
++ ### Split rule into source & destination
++ SRC=${rule%%,*}; DST=${rule##*,}
++ [ "$SRC" = "$rule" ] && SRC=""
++
++
++ ### Split destination into address, port & mask fields
++ DADDR=${DST%%_*}; DTEMP=${DST##*_}
++ [ "$DADDR" = "$DST" ] && DTEMP=""
++
++ DPORT=${DTEMP%%/*}; DMASK=${DTEMP##*/}
++ [ "$DPORT" = "$DTEMP" ] && DMASK="0xffff"
++
++
++ ### Split up source (if specified)
++ SADDR=""; SPORT=""
++ if [ -n "$SRC" ]; then
++ SADDR=${SRC%%_*}; STEMP=${SRC##*_}
++ [ "$SADDR" = "$SRC" ] && STEMP=""
++
++ SPORT=${STEMP%%/*}; SMASK=${STEMP##*/}
++ [ "$SPORT" = "$STEMP" ] && SMASK="0xffff"
++ fi
++
++
++ ### Convert asterisks to empty strings
++ SADDR=${SADDR#\*}; DADDR=${DADDR#\*}
++
++ ### Compose u32 filter rules
++ u32_s="${SPORT:+match ip6 sport $SPORT $SMASK}"
++ u32_s="${SADDR:+match ip6 src $SADDR} $u32_s"
++ u32_d="${DPORT:+match ip6 dport $DPORT $DMASK}"
++ u32_d="${DADDR:+match ip6 dst $DADDR} $u32_d"
++
++ ### Uncomment the following if you want to see parsed rules
++ #echo "$rule: $u32_s $u32_d"
++
++ ### Attach u32 filter to the appropriate class
++ tc filter add dev $DEVICE parent 1:0 protocol ipv6 \
++ prio $PRIO_RULEIPv6 u32 $u32_s $u32_d classid 1:$CLASS
++ done ### ruleipv6
++
+ [ "$1" = "compile" ] && echo
+ done ### classfile
+ ;;
diff --git a/net-misc/htbinit/files/htbinit.rc b/net-misc/htbinit/files/htbinit.rc
new file mode 100644
index 000000000000..219ad04a37e7
--- /dev/null
+++ b/net-misc/htbinit/files/htbinit.rc
@@ -0,0 +1,46 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="stats list timecheck"
+extra_started_commands="reload"
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting htbinit"
+ /usr/sbin/htb.init start
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping htbinit"
+ /usr/sbin/htb.init stop
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading htbinit"
+ /usr/sbin/htb.init start invalidate
+ eend $?
+}
+
+stats() {
+ ebegin "Showing htbinit stats"
+ /usr/sbin/htb.init stats
+ eend $?
+}
+
+list() {
+ ebegin "Showing htbinit list"
+ /usr/sbin/htb.init list
+ eend $?
+}
+
+timecheck() {
+ ebegin "Showing htbinit timecheck"
+ /usr/sbin/htb.init timecheck
+ eend $?
+}
diff --git a/net-misc/htbinit/files/prio_rule.patch b/net-misc/htbinit/files/prio_rule.patch
new file mode 100644
index 000000000000..28471aabb84e
--- /dev/null
+++ b/net-misc/htbinit/files/prio_rule.patch
@@ -0,0 +1,20 @@
+--- htb.init.old 2004-01-29 22:41:23.000000000 +0100
++++ htb.init 2006-09-08 00:03:32.000000000 +0200
+@@ -453,7 +457,7 @@
+ ### Load & filter file $HTB_PATH/$1
+ htb_filter_file () {
+ sed -n "s/#.*//; s/[^a-zA-Z0-9.,;:=/*-_]\+//g; \
+- /^[a-zA-Z0-9]\+=[a-zA-Z0-9.,:;/*-_]\+$/ p" $HTB_PATH/$1
++ /^[a-zA-Z0-9_]\+=[a-zA-Z0-9.,:;/*-_]\+$/ p" $HTB_PATH/$1
+ } # htb_filter_file
+
+
+@@ -517,7 +521,7 @@
+
+ htb_filter_file () {
+ sed 's/#.*//; s/[^a-zA-Z0-9.,;:=/*-_]\+//g' $HTB_PATH/$1 \
+- | grep '^[a-zA-Z0-9]\+=[a-zA-Z0-9.,;:/*-_]\+$'
++ | grep '^[a-zA-Z0-9_]\+=[a-zA-Z0-9.,;:/*-_]\+$'
+ } # htb_filter_file
+
+ htb_clsid_chain () {
diff --git a/net-misc/htbinit/files/timecheck_fix.patch b/net-misc/htbinit/files/timecheck_fix.patch
new file mode 100644
index 000000000000..de3791af997d
--- /dev/null
+++ b/net-misc/htbinit/files/timecheck_fix.patch
@@ -0,0 +1,42 @@
+--- htb.init.old 2004-01-29 22:41:23.000000000 +0100
++++ htb.init 2006-09-08 00:11:36.000000000 +0200
+@@ -891,7 +895,6 @@
+ TIME_TMP=`date +%w/%k:%M`
+ TIME_DOW=${TIME_TMP%%/*}
+ TIME_NOW=${TIME_TMP##*/}
+-TIME_ABS=`htb_time2abs $TIME_NOW`
+
+ ### Check all classes (if configured)
+ for classfile in `htb_class_list`; do
+@@ -914,6 +917,7 @@
+ ### Compute interval boundaries
+ BEG_ABS=`htb_time2abs $BEG_TIME`
+ END_ABS=`htb_time2abs $END_TIME`
++ TIME_ABS=`htb_time2abs $TIME_NOW`
+
+ ### Midnight wrap fixup
+ if [ $BEG_ABS -gt $END_ABS ]; then
+@@ -926,6 +930,23 @@
+ ### If time period matches, remember params and set MATCH flag
+ if [ $TIME_ABS -ge $BEG_ABS -a $TIME_ABS -lt $END_ABS ]; then
+ RATESPEC=${PARAMS%%,*}; CEILSPEC=${PARAMS##*,}
++
++ RNAME=""; CNAME=""
++
++ [ "$RATESPEC" = "prate" ] && RNAME=RATE_$PARENT
++ [ "$RATESPEC" = "pceil" ] && RNAME=CEIL_$PARENT
++
++ if [ -n "$RNAME" ]; then
++ RATESPEC=${!RNAME}
++ fi
++
++ [ "$CEILSPEC" = "prate" ] && CNAME=RATE_$PARENT
++ [ "$CEILSPEC" = "pceil" ] && CNAME=CEIL_$PARENT
++
++ if [ -n "$CNAME" ]; then
++ CEILSPEC=${!CNAME}
++ fi
++
+ [ "$RATESPEC" = "$CEILSPEC" ] && CEILSPEC=""
+
+ NEW_RATE=${RATESPEC%%/*}; NEW_BURST=${RATESPEC##*/}
diff --git a/net-misc/htbinit/htbinit-0.8.5-r7.ebuild b/net-misc/htbinit/htbinit-0.8.5-r7.ebuild
new file mode 100644
index 000000000000..551fa1f2136e
--- /dev/null
+++ b/net-misc/htbinit/htbinit-0.8.5-r7.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit eutils linux-info
+
+DESCRIPTION="Sets up Hierachical Token Bucket based traffic control (QoS) with iproute2"
+HOMEPAGE="http://www.sourceforge.net/projects/htbinit"
+SRC_URI="mirror://sourceforge/htbinit/htb.init-v${PV}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="ipv6 esfq"
+
+DEPEND="sys-apps/iproute2"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}
+
+pkg_setup() {
+ for i in NET_SCH_HTB NET_SCH_SFQ NET_CLS_FW NET_CLS_U32 NET_CLS_ROUTE4 ; do
+ CONFIG_CHECK="${CONFIG_CHECK} ~${i}"
+ done
+ use esfq && CONFIG_CHECK="${CONFIG_CHECK} ~NET_SCH_ESFQ"
+ linux-info_pkg_setup
+}
+
+src_unpack() {
+ cp "${DISTDIR}"/htb.init-v${PV} "${S}"/htb.init || die
+}
+
+src_prepare() {
+ sed -i 's|/etc/sysconfig/htb|/etc/htb|g' "${S}"/htb.init
+ epatch "${FILESDIR}"/htb.init-v0.8.5_tos.patch
+ use ipv6 && epatch "${FILESDIR}"/htb_0.8.5_ipv6.diff
+ use esfq && epatch "${FILESDIR}"/htb_0.8.5_esfq.diff
+ epatch "${FILESDIR}"/prio_rule.patch
+ epatch "${FILESDIR}"/timecheck_fix.patch
+ epatch "${FILESDIR}"/htb.init_find_fix.patch
+ sed -i -e 's:/sbin/ip:/bin/ip:g' "${S}"/htb.init # bug #474700
+}
+
+src_compile() {
+ :
+}
+
+src_install() {
+ dosbin htb.init
+ newinitd "${FILESDIR}"/htbinit.rc htbinit
+ keepdir /etc/htb
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then
+ elog 'Run "rc-update add htbinit default" to run htb.init at startup.'
+ elog 'Please, read carefully the htb.init documentation.'
+ elog 'New directory to store configuration is /etc/htb.'
+ fi
+}
diff --git a/net-misc/htbinit/metadata.xml b/net-misc/htbinit/metadata.xml
new file mode 100644
index 000000000000..0ebc62447849
--- /dev/null
+++ b/net-misc/htbinit/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <!-- maintainer-needed -->
+ <longdescription>
+HTB.init is a shell script derived from CBQ.init that allows for easy setup of HTB-based traffic control on Linux. HTB (Hierachical Token Bucket) is a new queueing discipline which attempts to address the weaknesses of current CBQ implementation.
+</longdescription>
+ <longdescription lang="ja">
+HTB.init は、Linux 上で HTB を基盤にしたトラフィック・コントロールのセットアップを簡単にする
+CBQ.init に由来したシェル・スクリプトです。HTB (Hierachical Token Bucket) は現在の CBQ の実装の弱点に処置を講じる
+キューの新しい規律です。
+</longdescription>
+ <use>
+ <flag name="esfq">Add support for Enhanced Stochastic Fairness queueing discipline.</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">htbinit</remote-id>
+ </upstream>
+</pkgmetadata>