FlexQoS FlexQoS - Flexible QoS Enhancement Script for Adaptive QoS

  • ATTENTION! You'll notice a Prefix dropdown when you create a thread. If your post applies to one of the topics listed, please use that Prefix for your post. When browsing the thread list you can use the Prefix to filter the view.
  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

chris.at

Regular Contributor
Sorry Dave, luckily only a short outage (bandwidth is awful on lte, but better than no internet at all). Will run the command next time it happens (2 home office workers at the moment...).
 

dave14305

Part of the Furniture
Sorry Dave, luckily only a short outage (bandwidth is awful on lte, but better than no internet at all). Will run the command next time it happens (2 home office workers at the moment...).
I imagine your primary WAN QoS bandwidth settings would overwhelm the LTE backup? Not sure if there is a benefit to trying to make this work if it‘s usually a temporary situation. But send the data next time it happens anyway. :)
 

chris.at

Regular Contributor
You imagine right Dave, that's why I implemented the following wan-event script:
Code:
case $1 in
        '0')
                case $2 in
                        'connected')
                                logger $(date) DSL verbunden
                                nvram set qos_ibw=92160
                                nvram set qos_obw=20480
                                service "restart_qos;restart_firewall"
                        ;;
                        'disconnected')
                                logger $(date) DSL getrennt
                        ;;
                esac
        ;;
        '1')
                case $2 in
                        'connected')
                                logger $(date) LTE-Backup verbunden
                                nvram set qos_ibw=10240
                                nvram set qos_obw=1024
                                service "restart_qos;restart_firewall"
                        ;;
                        'disconnected')
                                logger $(date) LTE-Backup getrennt
                        ;;
                esac
        ;;
esac

Sure it's not mandatory to have working qos on usb0 at the moment, but back in time there were days where lte was the main connection because the dsl line was faulty. Hopefully it doesn't happen again but who knows. But please don't focus on it, just thought maybe the errors could tell you somehing.

Best wishes,
chris
 

dave14305

Part of the Furniture
But please don't focus on it, just thought maybe the errors could tell you somehing.
Yes, the errors are because I only expect an “eth” interface name for tc, so I don’t even look for anything like usb0. So I will need to see what the situation looks like with usb0. You can run those commands now and post the results if they include any hint of usb0 in the output.
 

chris.at

Regular Contributor
Yes, the errors are because I only expect an “eth” interface name for tc, so I don’t even look for anything like usb0.
Ok, so that's a valid explanation of course :D
So I will need to see what the situation looks like with usb0. You can run those commands now and post the results if they include any hint of usb0 in the output.
If I'm not completely wrong back in time this already worked because you were the one who told me the trick with setting nvram and restarting qos/firewall in wan-event to reinitialize the new bandwidth values. But nevertheless, here we go:

Code:
[email protected]:/tmp/home/root# tc qdisc ls | grep root
qdisc htb 1: dev eth0 root refcnt 2 r2q 10 default 0 direct_packets_stat 521
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc htb 1: dev br0 root refcnt 2 r2q 10 default 0 direct_packets_stat 32
qdisc pfifo_fast 0: dev wl0.1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev usb0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev tun21 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1

[email protected]:/tmp/home/root# cat /tmp/bwdpi/dev_wan
eth0
 

dave14305

Part of the Furniture
Ok, so that's a valid explanation of course :D

If I'm not completely wrong back in time this already worked because you were the one who told me the trick with setting nvram and restarting qos/firewall in wan-event to reinitialize the new bandwidth values. But nevertheless, here we go:

Code:
[email protected]:/tmp/home/root# tc qdisc ls | grep root
qdisc htb 1: dev eth0 root refcnt 2 r2q 10 default 0 direct_packets_stat 521
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc htb 1: dev br0 root refcnt 2 r2q 10 default 0 direct_packets_stat 32
qdisc pfifo_fast 0: dev wl0.1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev usb0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev tun21 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1

[email protected]:/tmp/home/root# cat /tmp/bwdpi/dev_wan
eth0
Add those 2 commands to the wan-start script after wan 1 is connected. It might be too soon after QoS restarts to get the results, but it might help catch it automatically. Log the output to a file.
 

chris.at

Regular Contributor
Dave, I have some logging for you ;)

Code:
[email protected]:/jffs# cat flexqos-failover-log-qdisc
qdisc pfifo_fast 0: dev eth0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev wl0.1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev usb0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1

[email protected]:/jffs# cat flexqos-failover-log-bwdpi
usb0
 
Last edited:

dave14305

Part of the Furniture
Dave, I have some logging for you ;)

Code:
[email protected]:/jffs# cat flexqos-failover-log-qdisc
qdisc pfifo_fast 0: dev eth0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev wl0.1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev usb0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1

[email protected]:/jffs# cat flexqos-failover-log-bwdpi
usb0
I pushed a possible workaround to develop branch if you want to see if it helps next time.
 

chris.at

Regular Contributor
Sure, thank you! Switching to dev right now. :) Should I implement any other logs for you in case a failover happens?
 

dave14305

Part of the Furniture
Sure, thank you! Switching to dev right now. :) Should I implement any other logs for you in case a failover happens?
No, but while you're running on primary, please post the output of the 2 commands again. I really want to make sure usb0 isn't in dev_wan when it's not primary.
 

chris.at

Regular Contributor
Code:
[email protected]:/tmp/home/root# tc qdisc ls | grep root
qdisc htb 1: dev eth0 root refcnt 2 r2q 10 default 0 direct_packets_stat 1202
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc htb 1: dev br0 root refcnt 2 r2q 10 default 0 direct_packets_stat 27
qdisc pfifo_fast 0: dev wl0.1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev usb0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev tun21 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1

[email protected]:/tmp/home/root# cat /tmp/bwdpi/dev_wan
eth0
 

dave14305

Part of the Furniture
Code:
[email protected]:/tmp/home/root# tc qdisc ls | grep root
qdisc htb 1: dev eth0 root refcnt 2 r2q 10 default 0 direct_packets_stat 1202
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc htb 1: dev br0 root refcnt 2 r2q 10 default 0 direct_packets_stat 27
qdisc pfifo_fast 0: dev wl0.1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev usb0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev tun21 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1

[email protected]:/tmp/home/root# cat /tmp/bwdpi/dev_wan
eth0
You can add this command to wan-start instead of the earlier ones:
Code:
cat /tmp/bwdpi/dev_wan
realtc qdisc ls | sed -n 's/qdisc htb.*dev \([^b][^r].*\) root.*/\1/p'
 

tmcb82

Occasional Visitor
I'm getting this error on boot after upgrading to 1.0.4. It shows the below in the System Log"

Code:
May  5 01:06:07 FlexQoS: Applying AppDB rules and TC rates
May  5 01:06:07 FlexQoS: ERROR! Check /tmp/flexqos_tcrules.log
and when I pull /tmp/flexqos_tcrules.log it shows:

Code:
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:47
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:48
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:49
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:50
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:51
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:52
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:53
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:54
I'm not sure what's going wrong. Any ideas? Thank you!
 

dave14305

Part of the Furniture
I'm getting this error on boot after upgrading to 1.0.4. It shows the below in the System Log"

Code:
May  5 01:06:07 FlexQoS: Applying AppDB rules and TC rates
May  5 01:06:07 FlexQoS: ERROR! Check /tmp/flexqos_tcrules.log
and when I pull /tmp/flexqos_tcrules.log it shows:

Code:
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:47
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:48
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:49
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:50
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:51
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:52
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:53
RTNETLINK answers: No such file or directory
Command failed /tmp/flexqos_tcrules:54
I'm not sure what's going wrong. Any ideas? Thank you!
There has been a timing issue with FlexQoS on reboot and it usually starts too soon for Adaptive QoS to be initialized. I've just pushed a potential fix to the develop branch so that the FlexQoS startup process will wait until the necessary WAN interface is setup in Adaptive QoS.

I'm not willing to test it myself by rebooting my router since I'm on the verge of 60 days uptime (up 59 days, 9:17), but if you want to switch to the develop branch and try a reboot, it might resolve the startup issue. You can switch (temporarily) with flexqos develop

To switch back to stable, run flexqos stable
 

tmcb82

Occasional Visitor
There has been a timing issue with FlexQoS on reboot and it usually starts too soon for Adaptive QoS to be initialized. I've just pushed a potential fix to the develop branch so that the FlexQoS startup process will wait until the necessary WAN interface is setup in Adaptive QoS.

I'm not willing to test it myself by rebooting my router since I'm on the verge of 60 days uptime (up 59 days, 9:17), but if you want to switch to the develop branch and try a reboot, it might resolve the startup issue. You can switch (temporarily) with flexqos develop

To switch back to stable, run flexqos stable
I try to avoid the the dev branch simply because I work from home and am connected to a virtual desktop 9 hours a day, so I'm a bit nervous about any hiccups in the dev branch. I did flexqos check after it fully booted and it said "No TC modifications necessary." If I were to stay on the stable branch (until the next version) does that mean A.QOS/FlexQOS is now working properly? Thank you very much!
 

dave14305

Part of the Furniture
I try to avoid the the dev branch simply because I work from home and am connected to a virtual desktop 8 hours a day, so I'm a bit nervous about any hiccups in the dev branch. I did flexqos check after it fully booted and it said "No TC modifications necessary." If I were to stay on the stable branch (until the next version) does that mean A.QOS/FlexQOS is now working properly? Thank you very much!
Yes, as long as the syslog shows that it eventually applies the appdb rules and custom rates correctly, there's no permanent problem. Just startup sequencing issues during a fresh reboot.

I feel your pain and concern. I wouldn't run develop on my router either, except some people expect me to test it before I publish it. ;) But as I mentioned, I'm going on almost 2 months of uptime, which means I need my router to be stable and available for my children and their Zoom classes, plus my inevitable work meetings.

Do like I do and wait for other volunteers to find the bugs. This one has been reported often enough that I will probably push it to stable branch fairly quickly once someone confirms it works better than the current version.
 

Authority

Senior Member
Hello - I just installed this.

FlexQoS v1.0.4 released 2020-10-18

Installing FlexQoS...
Checking firmware support...
Downloading WebUI files...
Adding FlexQoS entries to Merlin user scripts...
Adding nightly cron job...
Adding flexqos alias in profile.add...
FlexQoS installation complete!

FlexQoS v1.0.4 released 2020-10-18

Advanced configuration available via:
http://192.168.1.1/user1.asp

Would you like to restart QoS for modifications to take effect? [1=Yes 2=No]: 1

FlexQoS customizations will not take effect until QoS is restarted.


Notice at the end it said "Would you like to restart QoS for modifications to take effect?" and I entered "1" for "Yes" then still got a notice "FlexQoS customizations will not take effect until QoS is restarted." Does that mean it didn't restart?
 

dave14305

Part of the Furniture
Notice at the end it said "Would you like to restart QoS for modifications to take effect?" and I entered "1" for "Yes" then still got a notice "FlexQoS customizations will not take effect until QoS is restarted." Does that mean it didn't restart?
Correct, for one reason or another it didn't get the yes response, if maybe you accidentally added a space before or after the 1. Run flexqos restart to force the QoS restart.
 

chris.at

Regular Contributor
You can add this command to wan-start instead of the earlier ones:
Code:
cat /tmp/bwdpi/dev_wan
realtc qdisc ls | sed -n 's/qdisc htb.*dev \([^b][^r].*\) root.*/\1/p'
Manually triggered a failover to get some logs for you while runnin on usb0:
Code:
[email protected]:/jffs# tc qdisc ls | grep root
qdisc htb 1: dev eth0 root refcnt 2 r2q 10 default 0 direct_packets_stat 682
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc htb 1: dev br0 root refcnt 2 r2q 10 default 0 direct_packets_stat 31
qdisc pfifo_fast 0: dev wl0.1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev usb0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev tun21 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
[email protected]:/jffs# cat /tmp/bwdpi/dev_wan
usb0
[email protected]:/jffs# realtc qdisc ls | sed -n 's/qdisc htb.*dev \([^b][^r].*\) root.*/\1/p'
eth0
No more errors in syslog:
Code:
Oct 21 06:25:19 nat: apply nat rules (/tmp/nat_rules_usb0_usb0)
Oct 21 06:25:19 custom_script: Running /jffs/scripts/nat-start
Oct 21 06:25:20 custom_script: Running /jffs/scripts/firewall-start (args: usb0)
Oct 21 06:25:21 custom_script: Running /jffs/scripts/service-event-end (args: restart wan_line)
Oct 21 06:25:25 FlexQoS: /jffs/addons/flexqos/flexqos.sh (pid=13813) called with 2 args: -start usb0
Oct 21 06:25:25 WAN(1)_Connection: Ethernet link down.
Oct 21 06:25:25 FlexQoS: [*] Killing Delayed Process (pid=12303)
Oct 21 06:25:25 FlexQoS: [*] 12303 admin     1572 S    sh /jffs/addons/flexqos/flexqos.sh -start usb0
Oct 21 06:25:27 FlexQoS: Applying iptables static rules
Oct 21 06:25:27 FlexQoS: Applying iptables custom rules
Oct 21 06:25:28 FlexQoS: Flushing conntrack table
Oct 21 06:25:30 FlexQoS: Applying AppDB rules and TC rates
On FlexQoS status page classification is done, speedtest states 10/1 as configured. Looking good so far in my opinion. :)
 

dave14305

Part of the Furniture
Manually triggered a failover to get some logs for you while runnin on usb0:
Code:
[email protected]:/jffs# tc qdisc ls | grep root
qdisc htb 1: dev eth0 root refcnt 2 r2q 10 default 0 direct_packets_stat 682
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev eth2 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc htb 1: dev br0 root refcnt 2 r2q 10 default 0 direct_packets_stat 31
qdisc pfifo_fast 0: dev wl0.1 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev usb0 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: dev tun21 root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
[email protected]:/jffs# cat /tmp/bwdpi/dev_wan
usb0
[email protected]:/jffs# realtc qdisc ls | sed -n 's/qdisc htb.*dev \([^b][^r].*\) root.*/\1/p'
eth0
No more errors in syslog:
Code:
Oct 21 06:25:19 nat: apply nat rules (/tmp/nat_rules_usb0_usb0)
Oct 21 06:25:19 custom_script: Running /jffs/scripts/nat-start
Oct 21 06:25:20 custom_script: Running /jffs/scripts/firewall-start (args: usb0)
Oct 21 06:25:21 custom_script: Running /jffs/scripts/service-event-end (args: restart wan_line)
Oct 21 06:25:25 FlexQoS: /jffs/addons/flexqos/flexqos.sh (pid=13813) called with 2 args: -start usb0
Oct 21 06:25:25 WAN(1)_Connection: Ethernet link down.
Oct 21 06:25:25 FlexQoS: [*] Killing Delayed Process (pid=12303)
Oct 21 06:25:25 FlexQoS: [*] 12303 admin     1572 S    sh /jffs/addons/flexqos/flexqos.sh -start usb0
Oct 21 06:25:27 FlexQoS: Applying iptables static rules
Oct 21 06:25:27 FlexQoS: Applying iptables custom rules
Oct 21 06:25:28 FlexQoS: Flushing conntrack table
Oct 21 06:25:30 FlexQoS: Applying AppDB rules and TC rates
On FlexQoS status page classification is done, speedtest states 10/1 as configured. Looking good so far in my opinion. :)
OK, this is interesting since I wasn’t expecting dev_wan to be different than the sed output. So it seems that Adaptive QoS doesn’t use the usb0 interface name with tc during a failover. I won’t trust dev_wan anymore as the primary source of the WAN interface name for tc. But I could potentially trust it for iptables setup if I don’t want to trigger a complete firewall restart. Will have to think about it some more.

Thanks for the feedback! Always helpful!
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top