- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 255
Closed
Description
Reproduce steps:
First let's create the clsact qdisc and a bpf filter.
ipr.tc("add", "clsact", 1) # dev lo
ipr.tc(
"add-filter",
"bpf",
1, # dev lo
":1",
fd=func.fd,
name=func.name,
parent='ffff:fff2',
classid=1,
direct_action=True,
)
Then we can check the status:
$ tc filter show dev lo parent ffff:fff2
filter protocol all pref 49152 bpf chain 0
filter protocol all pref 49152 bpf chain 0 handle 0x1 flowid :1 tc_pass direct-action not_in_hw id 329 tag 15858a412926acbb
However the consequent del-filter won't work:
ipr.tc("del-filter", "bpf", iface_idx, ':1', parent='ffff:fff2')
will raise error
Traceback (most recent call last):
File "basic01-xdp-pass/tc_loader.bcc.py", line 45, in <module>
ipr.tc("del-filter", "bpf", iface_idx, ':0', parent=parent)
File "/usr/lib/python3/dist-packages/pyroute2/iproute/linux.py", line 1614, in tc
return tuple(self.nlm_request(msg, msg_type=command, msg_flags=flags))
File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 376, in nlm_request
return tuple(self._genlm_request(*argv, **kwarg))
File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 867, in nlm_request
for msg in self.get(msg_seq=msg_seq,
File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 379, in get
return tuple(self._genlm_get(*argv, **kwarg))
File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 704, in get
raise msg['header']['error']
pyroute2.netlink.exceptions.NetlinkError: (2, 'No such file or directory')
I guess it's caused by tcm_info
in the request of RTM_DELTFILTER, somehow the parameter is set to 0x300 instead of 0, but I don't know how to make the correction.
Activity
jschwinger233 commentedon Jun 10, 2022
Maybe this issue is interrelated?
svinota commentedon Jun 10, 2022
Thanks, working on it!
svinota commentedon Jun 10, 2022
The issue caused by incorrect tcm_info encoding.
To mitigate the error, you can use right now:
Corresponding code:
pyroute2/pyroute2.core/pr2modules/netlink/rtnl/tcmsg/sched_bpf.py
Lines 23 to 26 in 4e73961
Tomorrow I'm to fix this. And #745 as well.
tc: fix info setting
svinota commentedon Jun 11, 2022
Looks like fixed:
pyroute2/tests/test_linux/test_tc/test_bpf.py
Lines 80 to 107 in 878bbc9
The next release which will include this fix is to be tagged tomorrow