simple-tc: Fix simple-tc not being active if set

Fixes: #55

This reintroduces the broken simple-tc.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2017-09-17 22:05:12 +02:00 committed by Tim Niemeyer
parent 6ce8cc5489
commit fd41c72013
5 changed files with 86 additions and 4 deletions

View File

@ -0,0 +1,79 @@
From 4ba8dbb8e8815ae3988d5844a29f4503e5ccacdb Mon Sep 17 00:00:00 2001
From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Date: Sun, 17 Sep 2017 21:03:09 +0200
Subject: [PATCH] simple-tc: Use hotplug.d/iface instead of hotplug.d/net
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
.../files/etc/hotplug.d/iface/50-fff-simple-tc | 25 +++++++++++++++++++++
net/simple-tc/files/etc/hotplug.d/net/50-simple-tc | 26 ----------------------
2 files changed, 25 insertions(+), 26 deletions(-)
create mode 100644 net/simple-tc/files/etc/hotplug.d/iface/50-fff-simple-tc
delete mode 100644 net/simple-tc/files/etc/hotplug.d/net/50-simple-tc
diff --git a/net/simple-tc/files/etc/hotplug.d/iface/50-fff-simple-tc b/net/simple-tc/files/etc/hotplug.d/iface/50-fff-simple-tc
new file mode 100644
index 0000000..ef8bd17
--- /dev/null
+++ b/net/simple-tc/files/etc/hotplug.d/iface/50-fff-simple-tc
@@ -0,0 +1,25 @@
+[ "$ACTION" = 'ifup' ] || exit 0
+
+config_load simple-tc
+
+tc_interface() {
+ local iface="$1"
+
+ config_get ifname "$iface" ifname
+
+ [ "$INTERFACE" = "$ifname" ] || return
+
+ config_get_bool enabled "$iface" enabled 0
+
+ [ "$enabled" -eq 1 ] || return
+
+ config_get limit_ingress "$iface" limit_ingress
+ config_get limit_egress "$iface" limit_egress
+
+ [ "$limit_ingress" ] || limit_ingress=-
+ [ "$limit_egress" ] || limit_egress=-
+
+ simple-tc "$DEVICE" "$limit_ingress" "$limit_egress"
+}
+
+config_foreach tc_interface 'interface'
diff --git a/net/simple-tc/files/etc/hotplug.d/net/50-simple-tc b/net/simple-tc/files/etc/hotplug.d/net/50-simple-tc
deleted file mode 100644
index f089f54..0000000
--- a/net/simple-tc/files/etc/hotplug.d/net/50-simple-tc
+++ /dev/null
@@ -1,26 +0,0 @@
-[ "$ACTION" = 'add' ] || exit 0
-
-config_load simple-tc
-
-
-tc_interface() {
- local iface="$1"
-
- config_get ifname "$iface" ifname
-
- [ "$INTERFACE" = "$ifname" ] || return
-
- config_get_bool enabled "$iface" enabled 0
-
- [ "$enabled" -eq 1 ] || return
-
- config_get limit_ingress "$iface" limit_ingress
- config_get limit_egress "$iface" limit_egress
-
- [ "$limit_ingress" ] || limit_ingress=-
- [ "$limit_egress" ] || limit_egress=-
-
- simple-tc "$INTERFACE" "$limit_ingress" "$limit_egress"
-}
-
-config_foreach tc_interface 'interface'
--
2.7.4

View File

@ -30,7 +30,8 @@ OPENWRT_PKGS="gpioctl-sysfs libugpio fastd haserl"
## See http://www.open-mesh.org/projects/batman-adv/wiki/Compatversion
GLUON=(gluon
https://github.com/freifunk-gluon/packages.git
8b65619f59c3bdce743c2f2fb2588fdd7079355a)
8b65619f59c3bdce743c2f2fb2588fdd7079355a
"0001-simple-tc-Use-hotplug.d-iface-instead-of-hotplug.d-n.patch")
GLUON_PKGS="kmod-batman-adv-legacy micrond simple-tc uradvd"
#official openwrt routing packages

View File

@ -13,7 +13,7 @@ define Package/fff-web
CATEGORY:=Freifunk
TITLE:= Freifunk-Franken Webinterface
URL:=http://www.freifunk-franken.de
DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname
DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname +fff-network
endef
define Package/fff-web/description

View File

@ -23,7 +23,7 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
# Bitratenbegrenzung
if [ "$POST_traffic_limit" == "on" ] ; then
uci -q set "simple-tc.example.ifname=$(uci -q get network.wan.ifname)"
uci -q set "simple-tc.example.ifname=wan"
uci -q set "simple-tc.example.enabled=1"
else
uci -q set "simple-tc.example.enabled=0"
@ -32,6 +32,7 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
uci -q set "simple-tc.example.limit_egress=${POST_limit_egress}"
uci commit
MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
fi
fi

View File

@ -28,7 +28,8 @@ define Package/fff-base
+fff-sysupgrade \
+fff-wireless \
+fff-timeserver \
+fff-vpn-select
+fff-vpn-select \
+simple-tc
endef
define Package/fff-base/description