Resolves https://dev.openwrt.org/ticket/11192

You can now configure devices to be used as a TEQL slave as follows:
# uci set network.ppp0.teql=teql0
# uci set network.ppp1.teql=teql0
# uci commit

I have teql0 configured as a normal device, and this script
automatically adds the PPP devices when they come up — giving me load
balancing across both ADSL lines.

Signed-off-by: David Woodhouse <[email protected]>
---
 package/iproute2/Makefile      |    2 ++
 package/iproute2/files/30-teql |   23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 package/iproute2/files/30-teql

diff --git a/package/iproute2/Makefile b/package/iproute2/Makefile
index 38e493a..97614be 100644
--- a/package/iproute2/Makefile
+++ b/package/iproute2/Makefile
@@ -92,6 +92,8 @@ endef
 define Package/tc/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/30-teql $(1)/etc/hotplug.d/iface/
 endef
 
 define Package/genl/install
diff --git a/package/iproute2/files/30-teql b/package/iproute2/files/30-teql
new file mode 100644
index 0000000..231c09f
--- /dev/null
+++ b/package/iproute2/files/30-teql
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+. /etc/functions.sh
+
+if [ "$ACTION" != "ifup" ]; then
+       exit
+fi
+
+config_load network
+
+config_get teql $INTERFACE teql
+
+if [ "$teql" != "" ]; then
+    logger Adding device $DEVICE to TEQL master $teql
+    insmod sch_teql
+    tc qdisc add dev $DEVICE root $teql
+
+    # The kernel doesn't let us bring it up until it has at least one
+    # slave. So bring it up now, if it isn't already.
+    if ! cat /sys/class/net/$teql/carrier &>/dev/null; then
+        ifup $teql &
+    fi
+fi
-- 
1.7.7.6


-- 
dwmw2

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to