SQM not working on restart

I have read quite a few posts on this, but still looking for some help/see if anyone has solved this issue.

This post seems the most relevant, I have a mobile router with open-wrt, which means its going to be powered on/off a lot. Based on what I have read here, and on others, its appears that SQM starts correctly, but at the time of start the interface maybe hasn't been initialized therefore there is no effect.

This post seems to document a fix for this, which appears to be in the version I am using (OpenWrt 18.06.1 r7258-5eb055306f and luci-app-sqm1.2.3-1), however I am still seeing the issue.

Based on thoughts in the following, I attempted to assign the sqm to a guest interface (br-guest) instead of directly to the wlan, hoping that br-guest would be initialized when sqm started. This isn't working either.

Any advice, I am considering a bash script that checks every few minutes to see if SQM is correct based on the output of tc -j qdisc, but hoping there is a better fix.

Thanks
Travis

At this point, 18.06.1 is three years old, one major version removed, and even within its own major version it's half a dozen minor versions out of date. Honestly, before you go on with debugging it, you should at least consider moving to a more recent release.

2 Likes

It's your mobile router using Travelmate? If the problem occurs when an interface is restarted then you could include a bash script inside of Travelmate somehow to restart SQM when the objective interface is started.

If the problem occurs when you power off and then back on the device you could try /etc/init.d/sqm enable to make sure SQM is enabled on startup.

However, I agree with @takimata, if possible you should consider moving to 19.07.7.

Please also note that current upstream sqm-scripts contain a commit that intends to improve hotplugging of interfaces that are members of a bridge. The sqm-scripts front page has a description of how to install the most current version by hand (over an existing sqm scripts installation, you still might need to manually copy the hotplug script to /etc/hotplug.d/iface/11-sqm).

That said, OpenWrt 18.X really is not secure anymore, so consider switching to something more recent/secure (also note that OpenWrt 21 seems like it is going to happen, so if you switch to OpenWrt 19 (last stable version) keep an eye on the OpenWrt site so know when to update to 21).

@takimata, yes I totally agree, however, this is a Gl-iNet device, and I am currently still running its stock firmware, which is using that version. :frowning: I haven't made the jump to installing custom firmware on the device. Not sure I am going to as there are some fuctions of the device that require the custom firmware.

@moeller0 I will take a look at your suggestion, sounds like the later version is still compatible with 18.x?

@marcelodiaz I am not sure if it uses Travelmate, I will do some research. Thanks for the suggestion.

I usually don't have time to tinker with this till the weekend, so it may be a few days before I provide any updates, but I appreciate all of the responses.

Update

I have not upgraded openwrt, not quite ready to cross that bridge yet.

I did update the scripts, per @moeller0's suggestion. This doesn't seem to have resolved anything.

If I add a script to start sqm and register it as a cron job to run once a minute, on reboot SQM is successfully enabled.

However if I make any changes to the enabled SSID's I lose SQM till I restart. I am wondering if /etc/hotplug.d/iface/11-sqm isn't running, at least on SSID changes

Should it detect and run on SSID changes? It appears when I make an SSID change, the wireless interface does go down and back up, so I would expect it to...

Here are the contents of my file:

[ -n "$DEVICE" ] || exit 0

ALL_DEVICES=$(echo $DEVICE $(uci -q get network.$INTERFACE.ifname) | tr ' ' '\n'

restart_sqm() {
    for dev in $ALL_DEVICES; do
        /usr/lib/sqm/run.sh stop $dev
        /usr/lib/sqm/run.sh start $dev
    done
}

[ "$ACTION" = ifup ] && /etc/init.d/sqm enabled && restart_sqm

if [ "$ACTION" = ifdown ]; then
    for dev in $ALL_DEVICES; do
        /usr/lib/sqm/run.sh stop $dev
    done
fi

Thanks
Travis

That should be easy to test, just add
logger -t SQM "Running SQM hotplug script due to $ACTION of $INTERFACE ($DEVICE)"
as the first line of the hotplug script, then make SSID changes and you will see wether that triggers a hotplug, and if yes with what parameters set.

Not sure, we certainly did not test that, so there could well be bugs there. How often do you change the SSID?

@moeller0 Thanks for your help/support/ideas, I added the logging, and that code is ran when the SSID changes.

Where the code iterates over interfaces, it never calls start on the wireless SSID "wlans".

As a temporary fix, I added the following

/usr/lib/sqm/run.sh stop wlan2
/usr/lib/sqm/run.sh start wlan2

in the restart_sqm() function

to force it to stop/start it on wlan2, which is the one I care about. This has resolved all of my issues. It would be nice if this were more dynamic. Is there a way to get the list of wlans here?

To answer your last question, I am turning on/off the guest SSID to grant/revoke internet to my kids while on long road trips on their tablets. I don't want them using a massive amount of data, so I want to limit their connection, but we also don't let them have internet all of the time.

Does the hotplug script itself trigger on SSID up or downs, and what does it print in the log file?

Sorry for the delay, been out of town

This is what is logged when I turn an SSID up/down

Tue Apr 13 08:26:37 2021 [1618323997.957] user.notice SQM: Running SQM hotplug script due to connected of wwan (wlan-sta)

Mmmh what is the output of:
tc -s qdisc
cat /etc/config/sqm

in case you posted that already, a link to that post is enough, unless things changed.