QoSmate: (Yet Another) Quality of Service Tool for OpenWrt

Just for your information: After an update you don't need to reinstall QoSmate... it should work right away.

Please show me the output of:

service qosmate status

You don't need to manually enable QoSmate... this might actually be causing your problem.

When you run service qosmate start, it automatically enables the service for autostart as well. So QoSmate will be running and will also restart automatically after a reboot. Just use start, not enable.

Why do you want to do that? Nevertheless, you can select cake and simply set the download bandwidth to 0, which should mean unlimited. However, this only works with cake, not with hfsc or hybrid.

I'm using sqm right now, I'm curious about the performance of qosmate. I did that, but if I wrote 0, it would limit my speed, now I looked and saw that I had to make adjustments in the sshdan qosmate file.

Then you probably did something wrong. Make sure to disable SQM when performing your tests...

Not sure what this is or what you mean by that?

Dediğinizi denedikten sonra yaßadığım sorunu yazıcam. Çeviri yanlıß çeviriyor

Well, Internet access does not work without a forward ands a return path. Hence setting either the downstream or upstream traffic shaper to 0 Bps essentially disables the internet access, but in a rather complicated way. So I argue that setting a shaper to 0 has not real utility, but being able to completely forgo shaping in one direction turned out to be a common desire, so for sqm-scripts we opted to interpret a shaper speed of 0 to mean do not even instantiate a shaper in that direction.

Oh, I didn’t know that. In my tests, setting CAKE to 0 bandwidth resulted in an “unlimited” bandwidth setting, so I assumed it was okay. Setting HFSC to 0 would break the internet, so there’s a safeguard in place.

Well, cake aimed for sensible defaults, and unlimited (which works great with an interface that creates back pressure like BQL on ethernet NICs) is a rather better behavior than disabling that interface effectively? I do not I must admit, remember whether I ever actually tested whether HTB will allow to completely choke a link when set to zero, but I maintain even if possible that is typically not a desirable outcome.

Good point, interpreting 0 as “don’t instantiate a shaper in that direction” would indeed be a useful addition. I’ll look into that when I have time.
As for HTB’s behavior at 0
 I honestly don’t know off the top of my head either.

2 Likes

Hello, and sorry for the interruption, would someone be so kind to help me out regarding properly setting up Qosmate? The only game i play is Apex legends on steam, pc. So far i played with the settings and noticed that Game Queue Discipline Red gives the best results with the stock DSCP Class cs5, also i noticed that whenever i change the mpu to 84, i get some weird micro stutters, so i left it on default. Not sure but how do i properly set up the rules though, sorry im not a network expert.

For testing i did upgrade to today's snapshot and see if qosmate stays intact and my reinstalling qosmate is cause of service disabled, following are results after upgrade, i did rebooted after upgrade , packages are missing

root@OpenWrt:~# service qosmate status
==== qosmate Status ====
qosmate autostart is enabled.
qosmate global:enabled is true.
No traffic shaping is active on the egress interface (pppoe-wan).
No traffic shaping is active on the ingress interface (ifb-pppoe-wan).
==== Current Settings ====
Upload rate: 145000 kbps
Download rate: 140000 kbps
Game traffic upload: 22150 kbps
Game traffic download: 21400 kbps
Queue discipline: CAKE (Root qdisc)
==== Version Information ====
Backend versions:
  Update channel: snapshot
  Current version: 77c391e5a033f75d175252e6155d1313685bce81
  Latest version: 77c391e5a033f75d175252e6155d1313685bce81
Frontend versions:
awk: cmd. line:2: fatal: cannot open file `/www/luci-static/resources/view/qosmate/settings.js' for reading: No such file or directory
Error: get_frontend_spec: Failed to get frontend version from file '/www/luci-static/resources/view/qosmate/settings.js'.
Error: Failed to get local FRONTEND version.
To force re-installation of FRONTEND, use the command 'service qosmate update -f -c
FRONTEND'.
==== System Information ====
{
        "kernel": "6.12.59",
        "hostname": "OpenWrt",
        "system": "ARMv8 Processor rev 4",
        "model": "GL.iNet GL-MT6000",
        "board_name": "glinet,gl-mt6000",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "firmware_url": "https://downloads.openwrt.org/",
                "revision": "r32109-67af946dd7",
                "target": "mediatek/filogic",
                "description": "OpenWrt SNAPSHOT r32109-67af946dd7",
                "builddate": "1764201097"
        }
}
==== Health Check ====
Error: Missing file: '/www/luci-static/resources/view/qosmate/settings.js'.
Error: Missing file: '/www/luci-static/resources/view/qosmate/rules.js'.
Error: Missing file: '/www/luci-static/resources/view/qosmate/ratelimits.js'.
Error: Missing file: '/www/luci-static/resources/view/qosmate/statistics.js'.
status=service:enabled;nft:failed;tc:failed;config:ok;packages:missing:kmod-sched ip-full kmod-veth tc-full kmod-netem kmod-sched-ctinfo kmod-ifb kmod-sched-cake kmod-sched-red luci-lib-jsonc lua jq ;BACKEND_integrity:ok;FRONTEND_integrity:failed;;errors=4
==== Flow Offloading Check ====
Flow offloading is disabled (compatible with qosmate).
==== WAN Interface Information ====
        "l3_device": "pppoe-wan",
        "device": "eth1",
==== QoSmate Configuration ====
config global 'global'
        option enabled '1'
config settings 'settings'
        option WAN 'pppoe-wan'
        option DOWNRATE '140000'
        option UPRATE '145000'
        option ROOT_QDISC 'cake'
config advanced 'advanced'
        option PRESERVE_CONFIG_FILES '1'
        option WASHDSCPUP '1'
        option WASHDSCPDOWN '1'
        option BWMAXRATIO '20'
        option UDP_RATE_LIMIT_ENABLED '0'
        option TCP_UPGRADE_ENABLED '1'
        option TCP_DOWNPRIO_INITIAL_ENABLED '1'
        option TCP_DOWNPRIO_SUSTAINED_ENABLED '1'
        option NFT_HOOK 'forward'
        option NFT_PRIORITY '0'
        option MAX_CONNECTIONS '0'
        option COMMON_LINK_PRESETS 'ethernet'
        option OVERHEAD '44'
        option MPU '84'
        option MSS '536'
config hfsc 'hfsc'
        option gameqdisc 'pfifo'
        option nongameqdisc 'fq_codel'
        option nongameqdiscoptions 'besteffort ack-filter'
        option MAXDEL '24'
        option PFIFOMIN '5'
        option PACKETSIZE '450'
        option netemdelayms '30'
        option netemjitterms '7'
        option netemdist 'normal'
        option pktlossp 'none'
        option netem_direction 'both'
config cake 'cake'
        option PRIORITY_QUEUE_INGRESS 'diffserv4'
        option PRIORITY_QUEUE_EGRESS 'diffserv4'
        option HOST_ISOLATION '1'
        option NAT_INGRESS '1'
        option NAT_EGRESS '1'
        option ACK_FILTER_EGRESS 'auto'
        option AUTORATE_INGRESS '0'
        option EXTRA_PARAMETERS_INGRESS 'memlimit 32mb'
        option EXTRA_PARAMETERS_EGRESS 'memlimit 16mb'
        option RTT '20'
config custom_rules 'custom_rules'
config rule
        option name 'Game_Console_Outbound'
        option proto 'udp'
        list dest_port '!=80'
        list dest_port '!=443'
        option class 'ef'
        option counter '0'
        option trace '0'
        option enabled '1'
        list src_ip '192.168.1.123'
        list src_ip '2407:aa80:15:d6c3::138/128'
config rule
        option name 'Chrony'
        option proto 'udp'
        list dest_port '123'
        option class 'ef'
        option counter '0'
        option trace '0'
        option enabled '1'
==== Package Status ====
Error: Missing packages: kmod-sched ip-full kmod-veth tc-full kmod-netem kmod-sched-ctinfo kmod-ifb kmod-sched-cake kmod-sched-red luci-lib-jsonc lua jq
Some required packages are missing. QoSmate may not function correctly.
==== Detailed Technical Information ====
Traffic Control (tc) Queues:
/etc/rc.common: line 2092: tc: not found
==== Nftables Ruleset (dscptag) ====
==== Custom Rules Table Status ====
Custom rules table (qosmate_custom) is not active or doesn't exist.
==== Inline Rules Status ====
No inline rules configured.
root@OpenWrt:~# service qosmate start
Error: Missing file: '/www/luci-static/resources/view/qosmate/settings.js'.
Error: Missing file: '/www/luci-static/resources/view/qosmate/rules.js'.
Error: Missing file: '/www/luci-static/resources/view/qosmate/ratelimits.js'.
Error: Missing file: '/www/luci-static/resources/view/qosmate/statistics.js'.
Updating QoSmate components 'FRONTEND'...
Downloading FRONTEND, version '1.7.0' (update channel: 'release').
Installing new FRONTEND files...
File '/usr/share/rpcd/acl.d/luci-app-qosmate.json' did not change - not updating.
File '/usr/libexec/rpcd/luci.qosmate' did not change - not updating.
File '/usr/libexec/rpcd/luci.qosmate_stats' did not change - not updating.
File '/www/luci-static/resources/view/qosmate/hfsc.js' did not change - not updating.
File '/www/luci-static/resources/view/qosmate/cake.js' did not change - not updating.
File '/www/luci-static/resources/view/qosmate/rules.js' did not change - not updating.
File '/www/luci-static/resources/view/qosmate/connections.js' did not change - not updating.
File '/www/luci-static/resources/view/qosmate/custom_rules.js' did not change - not
updating.
File '/www/luci-static/resources/view/qosmate/ipsets.js' did not change - not updating.
File '/www/luci-static/resources/view/qosmate/statistics.js' did not change - not updating.
Warning: File '/usr/share/luci/menu.d/luci-app-qosmate.json' was manually modified - overwriting.
Saved a backup copy of manually modified file to /tmp/qosmate_old_modified_files/luci-app-qosmate.json
Warning: File '/www/luci-static/resources/view/qosmate/advanced.js' was manually modified - overwriting.
Saved a backup copy of manually modified file to /tmp/qosmate_old_modified_files/advanced.js
Copying file '/usr/share/luci/menu.d/luci-app-qosmate.json'.
Copying file '/www/luci-static/resources/view/qosmate/advanced.js'.
Copying file '/www/luci-static/resources/view/qosmate/ratelimits.js'.
cp: can't stat '/var/run/qosmate-update/FRONTEND/www/luci-static/resources/view/qosmate/ratelimits.js': No such file or directory
Error: Failed to copy file '/var/run/qosmate-update/FRONTEND/www/luci-static/resources/view/qosmate/ratelimits.js' to '/www/luci-static/resources/view/qosmate/ratelimits.js'.
Error: Failed to install new FRONTEND files.
Error: Failed to update QoSmate.
Warning: Failed to fix qosmate installation automatically.
Either connect to the Internet and run '/etc/init.d/qosmate start' to have missing files automatically fetched,
or manually download and save them in designated paths.
root@OpenWrt:~# service qosmate status
==== qosmate Status ====
qosmate autostart is enabled.
qosmate global:enabled is true.
No traffic shaping is active on the egress interface (pppoe-wan).
No traffic shaping is active on the ingress interface (ifb-pppoe-wan).
==== Current Settings ====
Upload rate: 145000 kbps
Download rate: 140000 kbps
Game traffic upload: 22150 kbps
Game traffic download: 21400 kbps
Queue discipline: CAKE (Root qdisc)
==== Version Information ====
Backend versions:
  Update channel: snapshot
  Current version: 77c391e5a033f75d175252e6155d1313685bce81
  Latest version: 77c391e5a033f75d175252e6155d1313685bce81
Frontend versions:
awk: cmd. line:2: fatal: cannot open file `/www/luci-static/resources/view/qosmate/settings.js' for reading: No such file or directory
Error: get_frontend_spec: Failed to get frontend version from file '/www/luci-static/resources/view/qosmate/settings.js'.
Error: Failed to get local FRONTEND version.
To force re-installation of FRONTEND, use the command 'service qosmate update -f -c
FRONTEND'.
==== System Information ====
{
        "kernel": "6.12.59",
        "hostname": "OpenWrt",
        "system": "ARMv8 Processor rev 4",
        "model": "GL.iNet GL-MT6000",
        "board_name": "glinet,gl-mt6000",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "firmware_url": "https://downloads.openwrt.org/",
                "revision": "r32109-67af946dd7",
                "target": "mediatek/filogic",
                "description": "OpenWrt SNAPSHOT r32109-67af946dd7",
                "builddate": "1764201097"
        }
}
==== Health Check ====
Error: Missing file: '/www/luci-static/resources/view/qosmate/settings.js'.
Error: Missing file: '/www/luci-static/resources/view/qosmate/rules.js'.
Error: Missing file: '/www/luci-static/resources/view/qosmate/ratelimits.js'.
Error: Missing file: '/www/luci-static/resources/view/qosmate/statistics.js'.
status=service:enabled;nft:failed;tc:failed;config:ok;packages:missing:kmod-sched ip-full kmod-veth tc-full kmod-netem kmod-sched-ctinfo kmod-ifb kmod-sched-cake kmod-sched-red luci-lib-jsonc lua jq ;BACKEND_integrity:ok;FRONTEND_integrity:failed;;errors=4
==== Flow Offloading Check ====
Flow offloading is disabled (compatible with qosmate).
==== WAN Interface Information ====
        "l3_device": "pppoe-wan",
        "device": "eth1",
==== QoSmate Configuration ====
config global 'global'
        option enabled '1'
config settings 'settings'
        option WAN 'pppoe-wan'
        option DOWNRATE '140000'
        option UPRATE '145000'
        option ROOT_QDISC 'cake'
config advanced 'advanced'
        option PRESERVE_CONFIG_FILES '1'
        option WASHDSCPUP '1'
        option WASHDSCPDOWN '1'
        option BWMAXRATIO '20'
        option UDP_RATE_LIMIT_ENABLED '0'
        option TCP_UPGRADE_ENABLED '1'
        option TCP_DOWNPRIO_INITIAL_ENABLED '1'
        option TCP_DOWNPRIO_SUSTAINED_ENABLED '1'
        option NFT_HOOK 'forward'
        option NFT_PRIORITY '0'
        option MAX_CONNECTIONS '0'
        option COMMON_LINK_PRESETS 'ethernet'
        option OVERHEAD '44'
        option MPU '84'
        option MSS '536'
config hfsc 'hfsc'
        option gameqdisc 'pfifo'
        option nongameqdisc 'fq_codel'
        option nongameqdiscoptions 'besteffort ack-filter'
        option MAXDEL '24'
        option PFIFOMIN '5'
        option PACKETSIZE '450'
        option netemdelayms '30'
        option netemjitterms '7'
        option netemdist 'normal'
        option pktlossp 'none'
        option netem_direction 'both'
config cake 'cake'
        option PRIORITY_QUEUE_INGRESS 'diffserv4'
        option PRIORITY_QUEUE_EGRESS 'diffserv4'
        option HOST_ISOLATION '1'
        option NAT_INGRESS '1'
        option NAT_EGRESS '1'
        option ACK_FILTER_EGRESS 'auto'
        option AUTORATE_INGRESS '0'
        option EXTRA_PARAMETERS_INGRESS 'memlimit 32mb'
        option EXTRA_PARAMETERS_EGRESS 'memlimit 16mb'
        option RTT '20'
config custom_rules 'custom_rules'
config rule
        option name 'Game_Console_Outbound'
        option proto 'udp'
        list dest_port '!=80'
        list dest_port '!=443'
        option class 'ef'
        option counter '0'
        option trace '0'
        option enabled '1'
        list src_ip '192.168.1.123'
        list src_ip '2407:aa80:15:d6c3::138/128'
config rule
        option name 'Chrony'
        option proto 'udp'
        list dest_port '123'
        option class 'ef'
        option counter '0'
        option trace '0'
        option enabled '1'
==== Package Status ====
Error: Missing packages: kmod-sched ip-full kmod-veth tc-full kmod-netem kmod-sched-ctinfo kmod-ifb kmod-sched-cake kmod-sched-red luci-lib-jsonc lua jq
Some required packages are missing. QoSmate may not function correctly.
==== Detailed Technical Information ====
Traffic Control (tc) Queues:
/etc/rc.common: line 2092: tc: not found
==== Nftables Ruleset (dscptag) ====
==== Custom Rules Table Status ====
Custom rules table (qosmate_custom) is not active or doesn't exist.
==== Inline Rules Status ====
No inline rules configured.
root@OpenWrt:~#

Am i still missing something to make it survive sysupgrade ?

Edit: i didn't reinstalled qosmate, just did branch update to snapshot for qosmate in advanced, and rebooted, after reboot it's says disabled again in luci startup :frowning: but service qosmate status shows it's active, what sorcery this is, I'm unable to understand and confused :confused:

You have multiple errors in your console output, let's go one by one.

Error: get_frontend_spec: Failed to get frontend version from file '/www/luci-static/resources/view/qosmate/settings.js'.

Frontend files were missing (frontend not installed).

Error: Missing packages: kmod-sched ip-full kmod-veth tc-full kmod-netem kmod-sched-ctinfo kmod-ifb kmod-sched-cake kmod-sched-red luci-lib-jsonc lua jq
/etc/rc.common: line 2092: tc: not found

Required packages are missing.

cp: can't stat '/var/run/qosmate-update/FRONTEND/www/luci-static/resources/view/qosmate/ratelimits.js': No such file or directory
Error: Failed to copy file '/var/run/qosmate-update/FRONTEND/www/luci-static/resources/view/qosmate/ratelimits.js' to '/www/luci-static/resources/view/qosmate/ratelimits.js'.

qosmate tried to automatically fetch and install the missing frontend, however the downloaded version of the frontend doesn't include the file ratelimits.js. This is because the release frontend version was automatically fetched and it doesn't include this file (it was added recently and the snapshot version includes it). However the backend manages the version update process, and the snapshot version of backend which you installed expects that the frontend has this file.

[ This is an oversight by someone who implemented the version update mechanism (i.e. myself). Perhaps when the frontend component is missing entirely, qosmate should automatically install latest version from the same update channel as the backend? @Hudra ]

So in short: you need to install the required packages, then use the command service qosmate update -f -v snapshot to install the snapshot version of the qosmate frontend.

If you still have the issue of qosmate service showing up as disabled in luci: if the service qosmate status command reports that the service is enabled, i.e.:

qosmate autostart is enabled.
qosmate global:enabled is true.
...
==== Health Check ====
status=service:enabled;[...]

then likely this is a bug in the OpenWrt rpc implementation. We can further investigate this but please do the above steps first.

2 Likes

Yes, that makes sense... do you have time to make a PR for that?

@immi803 What’s strange, though, is that the packages couldn’t be installed. QoSmate normally installs them automatically on startup, but since you mentioned that you are using a snapshot version, the kmods probably are outdated or no longer available and therefore the packages cannot be installed. This is not directly a QoSmate issue... in this case, you should either include all necessary QoSmate packages in your snapshot beforehand, or start QoSmate immediately after the update while the kmods are still available, so it can install them.

2 Likes

This would be very helpful.

1 Like

yes, it did installed snapshot version i was on before upgrade, but still reboot shows service disabled in luci whereas service qosmate status shows it's fully active, looks rpc issue as you mentioned in your post.
Idea of yours to do check which version stable or snapshot qosmate was running at before upgrade as config file already saved during upgrade and switch to that branch automaticcaly, this would be promising and will survive any type of sysupgrade easily :100:

Also i suggest some sort of sanity check at sysupgrade if all required is installed and up.... may be i'm asking too much :smiley: further delay in hotplug if wan is up and do proper reinstall automatically. Further i do have feeling that Hotplug was waiting and never finished and caused trouble with rpc or something, that's why luci was not informed properly that qosmate service is UP

You and @Hudra doing marvellous stuff with QOS and i would say REALLY SERIOUS JOB :smiley: , Thank you Sir

exactly, issue pointed :+1:

@Hudra sir i'm curious how owut sysupgrade (attended sysupgrade) will react to the mechanism of surviving sysupgrade? @antonk

Sure, but I'd prefer to do this after we merge (or discard) the refactor branch, otherwise I think I'll have to rebase it which is a bit of a hassle (as I'm not very good with git). This backend-frontend compatibility issue seems not very urgent and could be temporarily mitigated by making a new small release with the current code in main.

I'm not sure what you mean by "at sysupgrade". In general, qosmate does not control the sysupgrade process. What qosmate can do is specify its own files in /etc/sysupgrade.conf (which qosmate does automatically already when the option PRESERVE_CONFIG_FILES is set to 1), and verify its own files at runtime (which qosmate does already).

I reviewed the code and it looks correct in regards to preserving the backend files. Frontend files are currently not automatically added to /etc/sysupgrade.conf, which is why you had frontend files missing after sysupgrade. @Hudra do you think frontend files should be preserved as well?

I don't think this has anything to do with hotplug. As long as the service is enabled (i.e. symlinks /etc/rc.d/S99qosmate, /etc/rc.d/K99qosmate exist and are pointing to /etc/init.d/qosmate), that luci page should show qosmate service as enabled. The rpc code does perform some extra checks though. Specifically it checks for values of $START, $STOP variables set in /etc/init.d/qosmate, and possibly for some more info in that file. If it can not retrieve some of that info, this may cause rpc to report qosmate service as disabled. We had a similar issue with adblock-lean, which we traced to the $START and $STOP variables being set a bit too far down in the code, which caused rpc to not find them because it was only looking in the first 10 lines.

So in short, we may need to install current OpenWrt snapshot, see if the issue still exists in it and if so then try and figure out the cause. Regardless, I don't think this has any practical effect on qosmate functionality.

1 Like

this is what i was referring as sanity check and it's already checking it's files, so no need to change anything here imo

instead of preserving , install latest available packages for frontend, possible? as it meets any kernel requirements and remain error free in case

i may not put proper words and indeed said feeling, yes qosmate may be suffering from similiar issue where rpc is not reading $start ...

best is to check yourself with latest snapshot and i'm sure you will nail the issue in seconds :+1:

Thank you for your attention :slight_smile:

I really like Qosmate so far and i mainly used it in Apex, but there is one issue i cant seem to fix, whenever i have it on, it causes some weird screen shake/stutter when i shoot my gun, on stock settings. Strange thing is that when i have it disabled, the screen shake is completely gone. My connection pppoe and i use it with the Flint 2, latest firmware. Any tips are more than welcome!

Was the rate limiting tab removed from qosmate where can i find it