summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_offload.py
diff options
context:
space:
mode:
authorHangbin Liu <liuhangbin@gmail.com>2020-07-27 13:04:55 +0200
committerDavid S. Miller <davem@davemloft.net>2020-07-31 01:33:07 +0200
commit4bbca662df2523ff7ad3224463f1f28e6a118044 (patch)
tree0c8aff68b72c586ef7b71262351e545260975dde /tools/testing/selftests/bpf/test_offload.py
parentipv6: fix memory leaks on IPV6_ADDRFORM path (diff)
downloadlinux-4bbca662df2523ff7ad3224463f1f28e6a118044.tar.xz
linux-4bbca662df2523ff7ad3224463f1f28e6a118044.zip
selftests/bpf: fix netdevsim trap_flow_action_cookie read
When read netdevsim trap_flow_action_cookie, we need to init it first, or we will get "Invalid argument" error. Fixes: d3cbb907ae57 ("netdevsim: add ACL trap reporting cookie as a metadata") Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/bpf/test_offload.py')
-rwxr-xr-xtools/testing/selftests/bpf/test_offload.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_offload.py b/tools/testing/selftests/bpf/test_offload.py
index 8294ae3ffb3c..43c9cda199b8 100755
--- a/tools/testing/selftests/bpf/test_offload.py
+++ b/tools/testing/selftests/bpf/test_offload.py
@@ -318,6 +318,9 @@ class DebugfsDir:
continue
if os.path.isfile(p):
+ # We need to init trap_flow_action_cookie before read it
+ if f == "trap_flow_action_cookie":
+ cmd('echo deadbeef > %s/%s' % (path, f))
_, out = cmd('cat %s/%s' % (path, f))
dfs[f] = out.strip()
elif os.path.isdir(p):