magnific0 / wondershaper

Command-line utility for limiting an adapter's bandwidth
GNU General Public License v2.0
1.73k stars 264 forks source link

‘Illegal "match"’ on CentOS8.1 #44

Closed honglei closed 4 years ago

honglei commented 4 years ago
[root@localhost wondershaper-master]# ip addr list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:0c:29:25:d5:54 brd ff:ff:ff:ff:ff:ff
    inet 192.168.3.8/24 brd 192.168.3.255 scope global dynamic noprefixroute ens160
       valid_lft 70579sec preferred_lft 70579sec
    inet6 240e:b0:40ae:41e0:5492:958:a8e9:6/128 scope global dynamic noprefixroute
       valid_lft 5813sec preferred_lft 2213sec
    inet6 240e:b0:40ae:41e3:659:7c04:fd56:3545/64 scope global dynamic noprefixroute
       valid_lft 7061sec preferred_lft 3461sec
    inet6 fe80::98b5:ec3a:fc37:4f41/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:76:1c:95 brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:76:1c:95 brd ff:ff:ff:ff:ff:ff
[root@localhost wondershaper-master]# ./wondershaper -a ens160 -d 4096 -u 4096
Illegal "match"
Illegal "match"
Illegal "match"
Illegal "match"
Illegal "match"
magnific0 commented 4 years ago

Thanks for the report. Can you please confirm what it says on line 139 to 141 for you?

https://github.com/magnific0/wondershaper/blob/master/wondershaper#L139-L141

Also can you copy your conf files? CONF="/etc/systemd/wondershaper.conf"; if that does not exist: CONFLEGACY="/etc/conf.d/wondershaper.conf";

honglei commented 4 years ago

line 138~141

if [[ -n "$USPEED" ]]; then
  tc class add dev "$IFACE" parent 1: classid 1:1 htb \
    rate "${USPEED}kbit" \
    prio 5 ${COMMONOPTIONS[@]};

So, do I need copy the wondershaper-master/wondershaper.conf to dir /etc/systemd/?

[root@localhost wondershaper-master]# ls /etc/conf.d
ls: cannot access '/etc/conf.d': No such file or directory
[root@localhost wondershaper-master]# ls /etc/systemd/
coredump.conf  logind.conf    system       user
journald.conf  resolved.conf  system.conf  user.conf
magnific0 commented 4 years ago

Hmm, thanks. That rules out my few guesses. Can you do

PS4='Line ${LINENO}: ' bash -x ./wondershaper -a ens160 -d 4096 -u 4096

so we can figure out which line the warnings are originating.

honglei commented 4 years ago
[root@localhost wondershaper-master]# PS4='Line ${LINENO}: ' bash -x ./wondershaper -a ens160 -d 4096 -u 4096
+ QUANTUM=6000
+ VERSION=1.4.1
+ CONF=/etc/systemd/wondershaper.conf
+ CONFLEGACY=/etc/conf.d/wondershaper.conf
+ eval export HIPRIODST=
++ export HIPRIODST=
++ HIPRIODST=
+ eval export COMMONOPTIONS=
++ export COMMONOPTIONS=
++ COMMONOPTIONS=
+ eval export NOPRIOHOSTSRC=
++ export NOPRIOHOSTSRC=
++ NOPRIOHOSTSRC=
+ eval export NOPRIOHOSTDST=
++ export NOPRIOHOSTDST=
++ NOPRIOHOSTDST=
+ eval export NOPRIOPORTSRC=
++ export NOPRIOPORTSRC=
++ NOPRIOPORTSRC=
+ eval export NOPRIOPORTDST=
++ export NOPRIOPORTDST=
++ NOPRIOPORTDST=
+ DSPEED=
+ USPEED=
+ IFACE=
+ IFB=ifb0
+ MODE=
+ getopts hvd:u:a:pcs o
+ case "$o" in
+ IFACE=ens160
+ getopts hvd:u:a:pcs o
+ case "$o" in
+ DSPEED=4096
+ getopts hvd:u:a:pcs o
+ case "$o" in
+ USPEED=4096
+ getopts hvd:u:a:pcs o
+ '[' '' = presets ']'
+ [[ -n '' ]]
+ '[' '' = status ']'
+ '[' '' = clear ']'
+ [[ -z 4096 ]]
+ [[ -z ens160 ]]
+ tc qdisc add dev ens160 root handle 1: htb default 20
Error: NLM_F_REPLACE needed to override.
+ [[ -n 4096 ]]
+ tc class add dev ens160 parent 1: classid 1:1 htb rate 4096kbit prio 5
RTNETLINK answers: No such file or directory
+ RATE=819
+ '[' 819 -eq 0 ']'
+ tc class add dev ens160 parent 1:1 classid 1:10 htb rate 819kbit ceil 3891kbit prio 1
RTNETLINK answers: No such file or directory
+ RATE=1638
+ '[' 1638 -eq 0 ']'
+ tc class add dev ens160 parent 1:1 classid 1:20 htb rate 4096kbit ceil 3891kbit prio 2
RTNETLINK answers: No such file or directory
+ RATE=819
+ '[' 819 -eq 0 ']'
+ tc class add dev ens160 parent 1:1 classid 1:30 htb rate 4096kbit ceil 3686kbit prio 3
RTNETLINK answers: No such file or directory
+ tc qdisc add dev ens160 parent 1:10 handle 10: sfq perturb 10 quantum 6000
Error: Failed to find specified qdisc.
+ tc qdisc add dev ens160 parent 1:20 handle 20: sfq perturb 10 quantum 6000
Error: Failed to find specified qdisc.
+ tc qdisc add dev ens160 parent 1:30 handle 30: sfq perturb 10 quantum 6000
Error: Failed to find specified qdisc.
+ tc filter add dev ens160 parent 1: protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:10
Error: Parent Qdisc doesn't exists.
We have an error talking to the kernel, -1
+ for host in "${HIPRIODST[@]}"
+ tc filter add dev ens160 parent 1: protocol ip prio 10 u32 match ip dst '' flowid 1:10
Illegal "match"
+ tc filter add dev ens160 parent 1: protocol ip prio 11 u32 match ip protocol 1 0xff flowid 1:10
Error: Parent Qdisc doesn't exists.
We have an error talking to the kernel, -1
+ tc filter add dev ens160 parent 1: protocol ip prio 12 u32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 flowid 1:10
Error: Parent Qdisc doesn't exists.
We have an error talking to the kernel, -1
+ for a in "${NOPRIOPORTDST[@]}"
+ tc filter add dev ens160 parent 1: protocol ip prio 14 u32 match ip dport '' 0xffff flowid 1:30
Illegal "match"
+ for a in "${NOPRIOPORTSRC[@]}"
+ tc filter add dev ens160 parent 1: protocol ip prio 15 u32 match ip sport '' 0xffff flowid 1:30
Illegal "match"
+ for a in "${NOPRIOHOSTSRC[@]}"
+ tc filter add dev ens160 parent 1: protocol ip prio 16 u32 match ip src '' flowid 1:30
Illegal "match"
+ for a in "${NOPRIOHOSTDST[@]}"
+ tc filter add dev ens160 parent 1: protocol ip prio 17 u32 match ip dst flowid 1:30
Illegal "match"
+ tc filter add dev ens160 parent 1: protocol ip prio 18 u32 match ip dst 0.0.0.0/0 flowid 1:20
Error: Parent Qdisc doesn't exists.
We have an error talking to the kernel, -1
+ [[ -n 4096 ]]
+ modprobe ifb numifbs=1
+ ip link set dev ifb0 up
+ tc qdisc add dev ens160 handle ffff: ingress
Error: Exclusivity flag on, cannot modify.
+ tc filter add dev ens160 parent ffff: protocol ip u32 match u32 0 0 action mirred egress redirect dev ifb0
+ tc qdisc add dev ifb0 root handle 2: htb
Error: Exclusivity flag on, cannot modify.
+ tc class add dev ifb0 parent 2: classid 2:1 htb rate 4096kbit
RTNETLINK answers: File exists
+ tc filter add dev ifb0 protocol ip parent 2: prio 1 u32 match ip src 0.0.0.0/0 flowid 2:1
[root@localhost wondershaper-master]#
StormYudi commented 4 years ago

I have same problem while using Debian 10. But wondershaper V1.4.0 was work for me before.

magnific0 commented 4 years ago

@honglei thank you for showing the log. This helps a lot. It seems with empty arrays for the PRIO NONPRIO hosts the loops were still engaged. @StormYudi thanks for confirming.

Can you please let me know if the latest version is now also fixed for you?

StormYudi commented 4 years ago

I've tested the latest version in Debian 10, it fixed the problem, thank you for your work, that's a great project and I am loving it : )

magnific0 commented 4 years ago

Thanks for the quick reply and kind words!