aboutsummaryrefslogtreecommitdiff
path: root/net/sqm-scripts
diff options
context:
space:
mode:
authorSebastian Moeller <moeller0@gmx.de>2015-03-20 22:47:45 +0100
committerToke Høiland-Jørgensen <toke@toke.dk>2015-03-25 10:35:58 +0100
commitd5a203f1eba6f93894b9185df763b945c3a72941 (patch)
treed72fd9acd6d65e871ec0bbf6aec42cbb49d3eb1e /net/sqm-scripts
parent1561003a7017cf9bffae25b82c71bc26d749f411 (diff)
sqm-scripts: clean up interface selection for hotplugging
The initial conversion to restart sqm on interfaces it is configured for in case of (transient) dis- and reappearance was half finished. These changes clean up the handling of exlicitly passed interfaces in run.sh: no second argument defaults to all configured interfaces the alternative is an individual interface name passed as 2nd argument to run.sh. The first argument either is start or stop. No argument at all will behave as if start was passed. Survives light testing... Signed-off-by: Sebastian Moeller <moeller0@gmx.de>
Diffstat (limited to 'net/sqm-scripts')
-rwxr-xr-xnet/sqm-scripts/files/etc/hotplug.d/iface/11-sqm2
-rwxr-xr-xnet/sqm-scripts/files/etc/init.d/sqm2
-rwxr-xr-xnet/sqm-scripts/files/usr/lib/sqm/run.sh36
3 files changed, 25 insertions, 15 deletions
diff --git a/net/sqm-scripts/files/etc/hotplug.d/iface/11-sqm b/net/sqm-scripts/files/etc/hotplug.d/iface/11-sqm
index 99796021d..439307e31 100755
--- a/net/sqm-scripts/files/etc/hotplug.d/iface/11-sqm
+++ b/net/sqm-scripts/files/etc/hotplug.d/iface/11-sqm
@@ -1,3 +1,3 @@
#!/bin/sh
-[ "$ACTION" = ifup ] && /usr/lib/sqm/run.sh interface ${DEVICE}
+[ "$ACTION" = ifup ] && /usr/lib/sqm/run.sh start ${DEVICE}
diff --git a/net/sqm-scripts/files/etc/init.d/sqm b/net/sqm-scripts/files/etc/init.d/sqm
index 70307a6e1..2a40afb5a 100755
--- a/net/sqm-scripts/files/etc/init.d/sqm
+++ b/net/sqm-scripts/files/etc/init.d/sqm
@@ -4,7 +4,7 @@ START=50
reload()
{
-/usr/lib/sqm/run.sh
+/usr/lib/sqm/run.sh start
}
restart()
diff --git a/net/sqm-scripts/files/usr/lib/sqm/run.sh b/net/sqm-scripts/files/usr/lib/sqm/run.sh
index 968292bcd..7aa20ddba 100755
--- a/net/sqm-scripts/files/usr/lib/sqm/run.sh
+++ b/net/sqm-scripts/files/usr/lib/sqm/run.sh
@@ -13,29 +13,39 @@ STOP=
ACTIVE_STATE_PREFIX="SQM_active_on_"
ACTIVE_STATE_FILE_DIR="/var/run/SQM"
mkdir -p ${ACTIVE_STATE_FILE_DIR}
-PROTO_STATE_FILE_LIST=$( ls ${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}* 2> /dev/null )
+
+
+START_ON_IF=$2 # only process this interface
+# TODO if $2 is empty select all interfaces with running sqm instance
+if [ -z ${START_ON_IF} ] ;
+then
+ # find all interfaces with active sqm instance
+ logger -t SQM -s "Trying to start/stop SQM on all interfaces."
+ PROTO_STATE_FILE_LIST=$( ls ${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}* 2> /dev/null )
+else
+ # only try to restart the just hotplugged interface, so reduce the list of interfaces to stop to the specified one
+ logger -t SQM -s "Trying to start/stop SQM on interface ${START_ON_IF}"
+ PROTO_STATE_FILE_LIST=${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}${START_ON_IF}
+fi
+
+
case ${1} in
+ start)
+ # just run through, same as passing no argument
+ ;;
stop)
logger -t SQM -s "run.sh stop"
STOP=$1
;;
- interface)
- START_ON_IF=$2 # only process this interface
- logger -t SQM -s "Trying to re-start SQM on interface ${START_ON_IF}"
- # TODO if $2 is empty just bail...
- if [ -z ${START_ON_IF} ] ;
- then
- logger -t SQM -s "Interface name missing, nothing to do, bailing out"
- return 0
- fi
- # only try to restart the just hotplugged interface, so reduce the list of interfaces to stop to the specified one
- PROTO_STATE_FILE_LIST=${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}${START_ON_IF}
- ;;
esac
+
+
+
+
# the current uci config file does not necessarily contain sections for all interfaces with active
# SQM instances, so use the ACTIVE_STATE_FILES to detect the interfaces on which to stop SQM.
# Currently the .qos scripts start with stopping any existing traffic shaping so this should not