From: Sebastian Moeller <moeller0@gmx.de>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>
Cc: Alan Jenkins <alan.christopher.jenkins@gmail.com>,
openwrt-devel@lists.openwrt.org, luis@bitamins.net,
cerowrt-devel@lists.bufferbloat.net
Subject: Re: [Cerowrt-devel] [sqm-scripts] not started at boot?
Date: Sun, 15 Feb 2015 17:12:41 +0100 [thread overview]
Message-ID: <9EB28655-6E25-470B-A13B-036EE00D84D7@gmx.de> (raw)
In-Reply-To: <87r3tri2x3.fsf@toke.dk>
[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]
Hi Toke,
On Feb 15, 2015, at 16:56 , Toke Høiland-Jørgensen <toke@toke.dk> wrote:
> Sebastian Moeller <moeller0@gmx.de> writes:
>
>> I am not sure that this works as intended. The first thing
>> run.sh does is take down all running SQM instances:
>
> Ah yes, seems I was a bit too trigger-happy there ;)
>
> Here's a version of run.sh that should also short-circuit the 'down'
> part if called from hotplug.
>
> The alternative is, of course, to have logic in the hotplug script to
> only call run.sh for interfaces that are enabled, but that would require
> parsing /etc/config/sqm from there. My initial thought was that
> short-circuiting the logic in run.sh was 'cleaner'; but I'm not entirely
> sure about that... Thoughts?
Not that I have shown great taste in the past, but I think it would be somewhat cleaner to put the logic into the hot plug script and keep run.sh “simple” (in the past I had introduced a large number of leakage, especially of IFBs by not properly removing/stopping old instances and was quite happy to have the take all active interfaces down loop as a last defense against accidental leaks).
But I am now also running pppoe directly from cerowrt and see the same issue, sqm is confused when the pppoe interface temporarily goes away, so at least I can now test this issue ;)
Best Regards
Sebastian
>
> -Toke
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: run.sh --]
[-- Type: text/x-sh; name="run.sh", Size: 4362 bytes --]
#!/bin/sh
# 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-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
. /lib/functions.sh
STOP=$1
ACTIVE_STATE_PREFIX="SQM_active_on_"
ACTIVE_STATE_FILE_DIR="/var/run/SQM"
mkdir -p ${ACTIVE_STATE_FILE_DIR}
# 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
# effectively change anything...
PROTO_STATE_FILE_LIST=$( ls ${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}* 2> /dev/null )
for STATE_FILE in ${PROTO_STATE_FILE_LIST} ; do
if [ -f ${STATE_FILE} ] ;
then
STATE_FILE_BASE_NAME=$( basename ${STATE_FILE} )
CURRENT_INTERFACE=${STATE_FILE_BASE_NAME:${#ACTIVE_STATE_PREFIX}:$(( ${#STATE_FILE_BASE_NAME} - ${#ACTIVE_STATE_PREFIX} ))}
# If called from hotplug, $DEVICE will be the interface that got hotplugged, so ignore anything else
if [ -z "$DEVICE" -o "$DEVICE" == "$CURRENT_INTERFACE" ]; then
logger -t SQM -s "${0} Stopping SQM on interface: ${CURRENT_INTERFACE}"
/usr/lib/sqm/stop.sh ${CURRENT_INTERFACE}
rm ${STATE_FILE} # well, we stop it so it is not running anymore and hence no active state file needed...
fi
fi
done
config_load sqm
run_simple_qos() {
local section="$1"
export IFACE=$(config_get "$section" interface)
# If called from hotplug, $DEVICE will be the interface that got hotplugged, so ignore anything else
[ -n "$DEVICE" -a "$DEVICE" != "$IFACE" ] && return
ACTIVE_STATE_FILE_FQN="${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}${IFACE}" # this marks interfaces as active with SQM
[ -f "${ACTIVE_STATE_FILE_FQN}" ] && logger -t SQM -s "Uh, oh, ${ACTIVE_STATE_FILE_FQN} should already be stopped." # Not supposed to happen
if [ $(config_get "$section" enabled) -ne 1 ];
then
if [ -f "${ACTIVE_STATE_FILE_FQN}" ];
then
# this should not be possible, delete after testing
local SECTION_STOP="stop" # it seems the user just de-selected enable, so stop the active SQM
else
logger -t SQM -s "${0} SQM for interface ${IFACE} is not enabled, skipping over..."
return 0 # since SQM is not active on the current interface nothing to do here
fi
fi
export UPLINK=$(config_get "$section" upload)
export DOWNLINK=$(config_get "$section" download)
export LLAM=$(config_get "$section" linklayer_adaptation_mechanism)
export LINKLAYER=$(config_get "$section" linklayer)
export OVERHEAD=$(config_get "$section" overhead)
export STAB_MTU=$(config_get "$section" tcMTU)
export STAB_TSIZE=$(config_get "$section" tcTSIZE)
export STAB_MPU=$(config_get "$section" tcMPU)
export ILIMIT=$(config_get "$section" ilimit)
export ELIMIT=$(config_get "$section" elimit)
export ITARGET=$(config_get "$section" itarget)
export ETARGET=$(config_get "$section" etarget)
export IECN=$(config_get "$section" ingress_ecn)
export EECN=$(config_get "$section" egress_ecn)
export IQDISC_OPTS=$(config_get "$section" iqdisc_opts)
export EQDISC_OPTS=$(config_get "$section" eqdisc_opts)
export TARGET=$(config_get "$section" target)
export SQUASH_DSCP=$(config_get "$section" squash_dscp)
export SQUASH_INGRESS=$(config_get "$section" squash_ingress)
export QDISC=$(config_get "$section" qdisc)
export SCRIPT=/usr/lib/sqm/$(config_get "$section" script)
# # there should be nothing left to stop, so just avoid calling the script
if [ "$STOP" == "stop" -o "$SECTION_STOP" == "stop" ];
then
# /usr/lib/sqm/stop.sh
# [ -f ${ACTIVE_STATE_FILE_FQN} ] && rm ${ACTIVE_STATE_FILE_FQN} # conditional to avoid errors ACTIVE_STATE_FILE_FQN does not exist anymore
# $(config_set "$section" enabled 0) # this does not save to the config file only to the loaded memory representation
logger -t SQM -s "${0} SQM qdiscs on ${IFACE} removed"
return 0
fi
logger -t SQM -s "${0} Queue Setup Script: ${SCRIPT}"
[ -x "$SCRIPT" ] && { $SCRIPT ; touch ${ACTIVE_STATE_FILE_FQN}; }
}
config_foreach run_simple_qos
[-- Attachment #3: Type: text/plain, Size: 4 bytes --]
>
next prev parent reply other threads:[~2015-02-15 16:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-15 14:39 Alan Jenkins
2015-02-15 15:00 ` Toke Høiland-Jørgensen
2015-02-15 15:48 ` Sebastian Moeller
2015-02-15 15:56 ` Toke Høiland-Jørgensen
2015-02-15 16:12 ` Sebastian Moeller [this message]
2015-02-15 16:18 ` Toke Høiland-Jørgensen
2015-02-16 23:23 ` Sebastian Moeller
2015-02-15 16:33 ` Alan Jenkins
2015-02-16 9:05 ` Sebastian Moeller
2015-03-03 17:06 ` Sebastian Moeller
2015-03-03 21:23 ` Alan Jenkins
2015-03-03 21:27 ` Toke Høiland-Jørgensen
2015-03-03 21:35 ` Sebastian Moeller
2015-03-03 22:39 ` Alan Jenkins
2015-03-03 22:46 ` Sebastian Moeller
2015-02-15 16:16 ` Sebastian Moeller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.bufferbloat.net/postorius/lists/cerowrt-devel.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9EB28655-6E25-470B-A13B-036EE00D84D7@gmx.de \
--to=moeller0@gmx.de \
--cc=alan.christopher.jenkins@gmail.com \
--cc=cerowrt-devel@lists.bufferbloat.net \
--cc=luis@bitamins.net \
--cc=openwrt-devel@lists.openwrt.org \
--cc=toke@toke.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox