From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2.tohojo.dk (mail2.tohojo.dk [77.235.48.147]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by huchra.bufferbloat.net (Postfix) with ESMTPS id 42CD421F36C for ; Sun, 15 Feb 2015 07:01:07 -0800 (PST) X-Virus-Scanned: amavisd-new at mail2.tohojo.dk Sender: toke@toke.dk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toke.dk; s=201310; t=1424012457; bh=BT/3yaBwVUC4wdKgMFHvDv3Ya1ehFihrMZl+8KUwFlo=; h=From:To:Cc:Subject:References:Date:In-Reply-To; b=UNLkOEMkrlJ9gsUWV8pfdLycMobxxBd0Ej/VB7UoYxNeqMCFYUdN2zyjnLSDPIOtj WryGLuVUwWYEsPlJ1I5Ww6Xp2mc9f3Uik41m2cJIPqTFkXyU3iyyPwnFfvIRfXMkiC vDalOfUptvx/VwAi52uaVlq3wXs0+qR4CfyBEMhI= Received: by alrua-kau.kau.toke.dk (Postfix, from userid 1000) id 344753D48E0; Sun, 15 Feb 2015 16:00:56 +0100 (CET) From: =?utf-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: Alan Jenkins References: <54E0AFB2.5040806@gmail.com> Date: Sun, 15 Feb 2015 16:00:56 +0100 In-Reply-To: <54E0AFB2.5040806@gmail.com> (Alan Jenkins's message of "Sun, 15 Feb 2015 14:39:46 +0000") Message-ID: <87vbj3i5hz.fsf@toke.dk> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: openwrt-devel@lists.openwrt.org, luis@bitamins.net, cerowrt-devel@lists.bufferbloat.net Subject: Re: [Cerowrt-devel] [sqm-scripts] not started at boot? X-BeenThere: cerowrt-devel@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development issues regarding the cerowrt test router project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Feb 2015 15:01:37 -0000 --=-=-= Content-Type: text/plain Alan Jenkins writes: > It's very effective, but I notice SQM isn't applied at boot time. The > system log complains about pppoe-wan interface not existing, when the > sqm init script is started. Ah, that makes sense I suppose: PPPOE is probably brought up too late for the SQM init script to pick it up. > qos-scripts has a hotplug script, so I copied it for sqm and the > problem is "fixed". Though my stupid script re-runs the sqm as every > single network interface comes up, so it spams the log and probably > slows things down a bit. (Maybe sqm script also wants to not be so > noisy in the log) I'm attaching an updated version of the run.sh script which should detect when it is run from hotplug and only apply the SQM config to the hotplugged interface. Could you verify that this works for you? If so, I'll push an update with the revision and include a hotplug script. :) -Toke --=-=-= Content-Type: text/x-sh; charset=utf-8 Content-Disposition: attachment; filename=run.sh Content-Transfer-Encoding: quoted-printable #!/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=C3=B8iland-J=C3=B8rgen= sen, Sebastian Moeller . /lib/functions.sh STOP=3D$1 ACTIVE_STATE_PREFIX=3D"SQM_active_on_" ACTIVE_STATE_FILE_DIR=3D"/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 shapi= ng so this should not # effectively change anything... PROTO_STATE_FILE_LIST=3D$( ls ${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFI= X}* 2> /dev/null ) for STATE_FILE in ${PROTO_STATE_FILE_LIST} ; do if [ -f ${STATE_FILE} ] ; then STATE_FILE_BASE_NAME=3D$( basename ${STATE_FILE} ) CURRENT_INTERFACE=3D${STATE_FILE_BASE_NAME:${#ACTIVE_STATE_PREFIX}:$(( ${#= STATE_FILE_BASE_NAME} - ${#ACTIVE_STATE_PREFIX} ))}=20=20=20=20=20=20=20=20 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 done config_load sqm run_simple_qos() { local section=3D"$1" export IFACE=3D$(config_get "$section" interface) # If called from hotplug, $DEVICE will be the interface that got hotplugge= d, so ignore anything else [ -n "$DEVICE" -a "$DEVICE" !=3D "$IFACE" ] && return ACTIVE_STATE_FILE_FQN=3D"${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_ST= ATE_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=3D"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, skippin= g over..." return 0 # since SQM is not active on the current interface nothing to do= here fi fi export UPLINK=3D$(config_get "$section" upload) export DOWNLINK=3D$(config_get "$section" download) export LLAM=3D$(config_get "$section" linklayer_adaptation_mechanism) export LINKLAYER=3D$(config_get "$section" linklayer) export OVERHEAD=3D$(config_get "$section" overhead) export STAB_MTU=3D$(config_get "$section" tcMTU) export STAB_TSIZE=3D$(config_get "$section" tcTSIZE) export STAB_MPU=3D$(config_get "$section" tcMPU) export ILIMIT=3D$(config_get "$section" ilimit) export ELIMIT=3D$(config_get "$section" elimit) export ITARGET=3D$(config_get "$section" itarget) export ETARGET=3D$(config_get "$section" etarget) export IECN=3D$(config_get "$section" ingress_ecn) export EECN=3D$(config_get "$section" egress_ecn) export IQDISC_OPTS=3D$(config_get "$section" iqdisc_opts) export EQDISC_OPTS=3D$(config_get "$section" eqdisc_opts) export TARGET=3D$(config_get "$section" target) export SQUASH_DSCP=3D$(config_get "$section" squash_dscp) export SQUASH_INGRESS=3D$(config_get "$section" squash_ingress) export QDISC=3D$(config_get "$section" qdisc) export SCRIPT=3D/usr/lib/sqm/$(config_get "$section" script) # # there should be nothing left to stop, so just avoid calling the script if [ "$STOP" =3D=3D "stop" -o "$SECTION_STOP" =3D=3D "stop" ]; then=20 # /usr/lib/sqm/stop.sh # [ -f ${ACTIVE_STATE_FILE_FQN} ] && rm ${ACTIVE_STATE_FILE_FQN} # con= ditional to avoid errors ACTIVE_STATE_FILE_FQN does not exist anymore # $(config_set "$section" enabled 0) # this does not save to the confi= g 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 --=-=-=--