From e1fcd76f67fa7c6a5f4d61083c923c3b2f39e4f8 Mon Sep 17 00:00:00 2001 From: RISCi_ATOM Date: Thu, 23 Jan 2020 02:15:15 -0500 Subject: [PATCH] Add sqm-scripts* back to base --- .../network/config/sqm-scripts-extra/Makefile | 47 ++++++++ .../test_LAN_dual-isolate__piece_of_cake.qos | 102 ++++++++++++++++++ ...t_LAN_dual-isolate__piece_of_cake.qos.help | 12 +++ ...test_LAN_triple-isolate__piece_of_cake.qos | 102 ++++++++++++++++++ ...LAN_triple-isolate__piece_of_cake.qos.help | 12 +++ .../test_WAN_dual-isolate__piece_of_cake.qos | 89 +++++++++++++++ ...t_WAN_dual-isolate__piece_of_cake.qos.help | 10 ++ ...test_WAN_triple-isolate__piece_of_cake.qos | 89 +++++++++++++++ ...WAN_triple-isolate__piece_of_cake.qos.help | 10 ++ .../src/test_triple_isolated_llt_cake.qos | 82 ++++++++++++++ .../test_triple_isolated_llt_cake.qos.help | 3 + package/network/config/sqm-scripts/Makefile | 88 +++++++++++++++ 12 files changed, 646 insertions(+) create mode 100644 package/network/config/sqm-scripts-extra/Makefile create mode 100644 package/network/config/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos create mode 100644 package/network/config/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos.help create mode 100644 package/network/config/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos create mode 100644 package/network/config/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos.help create mode 100644 package/network/config/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos create mode 100644 package/network/config/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos.help create mode 100644 package/network/config/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos create mode 100644 package/network/config/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos.help create mode 100644 package/network/config/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos create mode 100644 package/network/config/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos.help create mode 100644 package/network/config/sqm-scripts/Makefile diff --git a/package/network/config/sqm-scripts-extra/Makefile b/package/network/config/sqm-scripts-extra/Makefile new file mode 100644 index 0000000000..28e6ccb587 --- /dev/null +++ b/package/network/config/sqm-scripts-extra/Makefile @@ -0,0 +1,47 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=sqm-scripts-extra +PKG_VERSION:=2016-06-08 +PKG_RELEASE:=1 +PKG_LICENSE:=GPLv2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.xz +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) + +include $(INCLUDE_DIR)/package.mk + +define Package/sqm-scripts-extra + SECTION:=net + CATEGORY:=Base system + DEPENDS:=+sqm-scripts + TITLE:=SQM Scripts - additional experimental scripts for testing + PKGARCH:=all + MAINTAINER:=Kevin Darbyshire-Bryant , \ + Sebastian Moeller +endef + +define Package/sqm-scripts-extra/description + A set of experimental scripts for sqm-scripts QoS package. The contents of this package may + change as new qdiscs like 'cake' are developed and tested. +endef + +define Package/sqm-scripts-extra/download +endef + +define Build/Prepare +endef + +define Build/Compile +endef + +define Package/sqm-scripts-extra/install + $(INSTALL_DIR) $(1)/usr/lib/sqm + $(INSTALL_DATA) ./src/* $(1)/usr/lib/sqm/ +endef + +$(eval $(call BuildPackage,sqm-scripts-extra)) + diff --git a/package/network/config/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos b/package/network/config/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos new file mode 100644 index 0000000000..4f1380d636 --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos @@ -0,0 +1,102 @@ +#!/bin/sh +################################################################################ +# test_LAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) +# +# Abstract: +# This is a one band cake and ipv6 enabled shaping script for Ethernet +# gateways. This exists for the purpose of testing cake's different isolation +# options, specifically the non-directional triple-isolate feature that promises +# to finally tackle the bit-torrent hole in simple.qos. +# This specific version is supposed to be used on LAN interfaces: +# the script's ingress direction equals the internet/WAN upload direction +# the script's egress direction equals the internet/WAN download direction +# +# NOTE: Shaping on a LAN interface only affects machines connected via that +# LAN interface, so typically WIFI/WLAN traffic will not be shaped! +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="besteffort dual-srchost" +EGRESS_CAKE_OPTS="besteffort dual-dsthost" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + + #sm: flip upload and download bandwith so that the GUI values reflect directionality in regard to the ISP + #sm: NOTE this is ugly and should be performed in defaults.sh or functions.sh if at all + #sm: but for quick and dirty testing this should do + local ORIG_UPLINK=${UPLINK} + local ORIG_DOWNLINK=${DOWNLINK} + UPLINK=${ORIG_DOWNLINK} + DOWNLINK=${ORIG_UPLINK} + + + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/package/network/config/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos.help b/package/network/config/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos.help new file mode 100644 index 0000000000..616b5e4f1c --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_LAN_dual-isolate__piece_of_cake.qos.help @@ -0,0 +1,12 @@ +test_LAN_dual-isolate__piece_of_cake.qos (Cero3 Shaper) + +Abstract: +This is a one band cake and ipv6 enabled shaping script for Ethernet gateways. +This exists for the purpose of testing cake's different isolation options, +specifically the non-directional dual-[src|dst]host feature that promises to finally +tackle the bit-torrent hole in simple.qos. +This specific version is supposed to be used on LAN interfaces: + the script's ingress direction equals the internet/WAN upload direction + the script's egress direction equals the internet/WAN download direction +NOTE: Shaping on a LAN interface only affects machines connected via that +LAN interface, so typically WIFI/WLAN traffic will not be shaped! diff --git a/package/network/config/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos b/package/network/config/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos new file mode 100644 index 0000000000..761b27de01 --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos @@ -0,0 +1,102 @@ +#!/bin/sh +################################################################################ +# test_LAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) +# +# Abstract: +# This is a one band cake and ipv6 enabled shaping script for Ethernet +# gateways. This exists for the purpose of testing cake's different isolation +# options, specifically the non-directional triple-isolate feature that promises +# to finally tackle the bit-torrent hole in simple.qos. +# This specific version is supposed to be used on LAN interfaces: +# the script's ingress direction equals the internet/WAN upload direction +# the script's egress direction equals the internet/WAN download direction +# +# NOTE: Shaping on a LAN interface only affects machines connected via that +# LAN interface, so typically WIFI/WLAN traffic will not be shaped! +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="besteffort triple-isolate" +EGRESS_CAKE_OPTS="besteffort triple-isolate" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + + #sm: flip upload and download bandwith so that the GUI values reflect directionality in regard to the ISP + #sm: NOTE this is ugly and should be performed in defaults.sh or functions.sh if at all + #sm: but for quick and dirty testing this should do + local ORIG_UPLINK=${UPLINK} + local ORIG_DOWNLINK=${DOWNLINK} + UPLINK=${ORIG_DOWNLINK} + DOWNLINK=${ORIG_UPLINK} + + + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/package/network/config/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos.help b/package/network/config/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos.help new file mode 100644 index 0000000000..a3501dc1ff --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_LAN_triple-isolate__piece_of_cake.qos.help @@ -0,0 +1,12 @@ +test_LAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) + +Abstract: +This is a one band cake and ipv6 enabled shaping script for Ethernet gateways. +This exists for the purpose of testing cake's different isolation options, +specifically the non-directional triple-isolate feature that promises to finally +tackle the bit-torrent hole in simple.qos. +This specific version is supposed to be used on LAN interfaces: + the script's ingress direction equals the internet/WAN upload direction + the script's egress direction equals the internet/WAN download direction +NOTE: Shaping on a LAN interface only affects machines connected via that +LAN interface, so typically WIFI/WLAN traffic will not be shaped! diff --git a/package/network/config/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos b/package/network/config/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos new file mode 100644 index 0000000000..87eaebfff2 --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos @@ -0,0 +1,89 @@ +#!/bin/sh +################################################################################ +# test_WAN_dual-isolate__piece_of_cake.qos (Cero3 Shaper) +# +# Abstract: +# This is a one band cake and ipv6 enabled shaping script for Ethernet +# gateways. This exists for the purpose of testing cake's different isolation +# options, specifically the directional dual-[src|dst]host feature that promises +# to finally tackle the bit-torrent hole in simple.qos. +# This specific version is supposed to be used on WAN interfaces: +# the script's ingress direction equals the internet/WAN download direction +# the script's egress direction equals the internet/WAN upload direction +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="besteffort dual-dsthost" +EGRESS_CAKE_OPTS="besteffort dual-srchost" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/package/network/config/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos.help b/package/network/config/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos.help new file mode 100644 index 0000000000..c239917c02 --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_WAN_dual-isolate__piece_of_cake.qos.help @@ -0,0 +1,10 @@ +test_WAN_dual-isolate__piece_of_cake.qos (Cero3 Shaper) + +Abstract: +This is a one band cake and ipv6 enabled shaping script for Ethernet gateways. +This exists for the purpose of testing cake's different isolation options, +specifically the directional dual-[src|dst]host feature that promises to finally +tackle the bit-torrent hole in simple.qos. +This specific version is supposed to be used on WAN interfaces: + the script's ingress direction equals the internet/WAN download direction + the script's egress direction equals the internet/WAN upload direction diff --git a/package/network/config/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos b/package/network/config/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos new file mode 100644 index 0000000000..5f0d7d7eb2 --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos @@ -0,0 +1,89 @@ +#!/bin/sh +################################################################################ +# test_WAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) +# +# Abstract: +# This is a one band cake and ipv6 enabled shaping script for Ethernet +# gateways. This exists for the purpose of testing cake's different isolation +# options, specifically the non-directional triple-isolate feature that promises +# to finally tackle the bit-torrent hole in simple.qos. +# This specific version is supposed to be used on WAN interfaces: +# the script's ingress direction equals the internet/WAN download direction +# the script's egress direction equals the internet/WAN upload direction +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="besteffort triple-isolate" +EGRESS_CAKE_OPTS="besteffort triple-isolate" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/package/network/config/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos.help b/package/network/config/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos.help new file mode 100644 index 0000000000..72df5099e9 --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_WAN_triple-isolate__piece_of_cake.qos.help @@ -0,0 +1,10 @@ +test_WAN_triple-isolate__piece_of_cake.qos (Cero3 Shaper) + +Abstract: +This is a one band cake and ipv6 enabled shaping script for Ethernet gateways. +This exists for the purpose of testing cake's different isolation options, +specifically the non-directional triple-isolate feature that promises to finally +tackle the bit-torrent hole in simple.qos. +This specific version is supposed to be used on WAN interfaces: + the script's ingress direction equals the internet/WAN download direction + the script's egress direction equals the internet/WAN upload direction diff --git a/package/network/config/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos b/package/network/config/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos new file mode 100644 index 0000000000..df17b393f5 --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos @@ -0,0 +1,82 @@ +#!/bin/sh +################################################################################ +# test_triple_isolated_llt_cake.qos +# One bin cake shaper for ethernet gateways +# using cake qdisc with triple-isolate and diffserv-llt (Latency-Loss-Tradeoff) +# +################################################################################ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Copyright (C) 2012-2016 +# Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller +# +################################################################################ + +. ${SQM_LIB_DIR}/defaults.sh + +################################################################################ + + +# this will only work with cake as qdisc... +QDISC=cake + + +# to keep this as simple as possible we ignore the *_CAKE_OPTS from defaults.sh +INGRESS_CAKE_OPTS="diffserv-llt triple-isolate" +EGRESS_CAKE_OPTS="diffserv-llt triple-isolate" + + +egress() { + sqm_debug "egress" + $TC qdisc del dev $IFACE root 2>/dev/null + $TC qdisc add dev $IFACE root $( get_stab_string ) cake bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS} +} + + +ingress() { + sqm_debug "ingress" + $TC qdisc del dev $IFACE handle ffff: ingress 2>/dev/null + $TC qdisc add dev $IFACE handle ffff: ingress + $TC qdisc del dev $DEV root 2>/dev/null + $TC qdisc add dev $DEV root $( get_stab_string ) cake bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS} + + $IP link set dev $DEV up + + # redirect all IP packets arriving in $IFACE to ifb0 + + $TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ + match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV +} + +sqm_start() { + [ -n "$IFACE" ] || return 1 + do_modules + verify_qdisc $QDISC "cake" || return 1 + sqm_debug "Starting ${SCRIPT}" + + [ -z "$DEV" ] && DEV=$( get_ifb_for_if ${IFACE} ) + + + if [ "${UPLINK}" -ne 0 ]; + then + egress + sqm_debug "egress shaping activated" + else + sqm_debug "egress shaping deactivated" + $TC qdisc del dev ${IFACE} root 2> /dev/null + fi + if [ "${DOWNLINK}" -ne 0 ]; + then + verify_qdisc ingress "ingress" || return 1 + ingress + sqm_debug "ingress shaping activated" + else + sqm_debug "ingress shaping deactivated" + $TC qdisc del dev ${DEV} root 2> /dev/null + $TC qdisc del dev ${IFACE} ingress 2> /dev/null + fi + return 0 +} diff --git a/package/network/config/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos.help b/package/network/config/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos.help new file mode 100644 index 0000000000..06ffdad79b --- /dev/null +++ b/package/network/config/sqm-scripts-extra/src/test_triple_isolated_llt_cake.qos.help @@ -0,0 +1,3 @@ +Cake qdisc with triple-isolate and diffserv-llt (Latency-Loss-Tradeoff) +options as the shaper and fq_codel as leaf qdisc. This script requires +that cake is selected as qdisc. diff --git a/package/network/config/sqm-scripts/Makefile b/package/network/config/sqm-scripts/Makefile new file mode 100644 index 0000000000..335d6a01ee --- /dev/null +++ b/package/network/config/sqm-scripts/Makefile @@ -0,0 +1,88 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=sqm-scripts +PKG_SOURCE_VERSION:=ab763cba8b1516b3afa99760e0ca884f8b8d93b8 +PKG_VERSION:=1.4.0 +PKG_RELEASE:=3 +PKG_LICENSE:=GPLv2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.xz +PKG_MIRROR_HASH:=6e8ce29ba398c14fe679ea95fe03c785d7b5357d515b988360b4cc8be68b7e59 +PKG_SOURCE_URL:=https://github.com/tohojo/sqm-scripts.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) + +include $(INCLUDE_DIR)/package.mk + +define Package/sqm-scripts + SECTION:=net + CATEGORY:=Base system + DEPENDS:=+tc +kmod-sched-core +kmod-sched-cake +kmod-ifb +iptables \ + +iptables-mod-ipopt +iptables-mod-conntrack-extra + TITLE:=SQM Scripts (QoS) + PKGARCH:=all + MAINTAINER:=Toke Høiland-Jørgensen +endef + +define Package/sqm-scripts/description + A set of scripts that does simple SQM configuration. +endef + +define Package/sqm-scripts/conffiles +/etc/config/sqm +/etc/sqm/sqm.conf +endef + +define Package/sqm-scripts/install + make -C $(PKG_BUILD_DIR) DESTDIR=$(1) PLATFORM=openwrt install +endef + +define Package/luci-app-sqm + SECTION:=luci + CATEGORY:=LuCI + TITLE:=SQM Scripts - LuCI interface + MAINTAINER:=Toke Høiland-Jørgensen + PKGARCH:=all + DEPENDS:=+luci-compat +sqm-scripts + SUBMENU:=3. Applications +endef + +define Package/luci-app-sqm/description + Luci interface for the SQM scripts queue management configuration package. +endef + +define Package/luci-app-sqm/install + make -C $(PKG_BUILD_DIR) DESTDIR=$(1) PLATFORM=openwrt install-luci +endef + +define Package/luci-app-sqm/postinst +#!/bin/sh +which uci > /dev/null || exit 0 +uci -q get ucitrack.@sqm[0] > /dev/null || { + uci add ucitrack sqm > /dev/null + uci set ucitrack.@sqm[0].init=sqm + uci add_list ucitrack.@firewall[0].affects=sqm + uci commit +} +endef + +define Package/luci-app-sqm/postrm +#!/bin/sh +which uci > /dev/null || exit 0 +uci -q get ucitrack.@sqm[0] > /dev/null && { + uci delete ucitrack.@sqm[0] + uci del_list ucitrack.@firewall[0].affects=sqm + uci commit +} || exit 0 +endef + +$(eval $(call BuildPackage,sqm-scripts)) +$(eval $(call BuildPackage,luci-app-sqm)) -- 2.25.1