Skip to contentSkip to conversation

selftests/bpf: fix netdevsim trap_flow_action_cookie read

PATCH Applied Hangbin Liu 2 participants 2 messages Jul 27, 2020 – Jul 30, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 tools/testing/selftests/bpf/test_offload.py | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/bpf/test_offload.py +3 -0
index 8294ae3ffb3c..43c9cda199b8 100755
@@ -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):
Signature · 1 line
2.25.4
maintainer Applied
#1 lore raw

From: Hangbin Liu <[email protected]>
Date: Mon, 27 Jul 2020 19:04:55 +0800

Quoted 5 lines

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")

Applied.