diff mbox series

[net] selftests/bpf: fix netdevsim trap_flow_action_cookie read

Message ID 20200727110455.2969281-1-liuhangbin@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series [net] selftests/bpf: fix netdevsim trap_flow_action_cookie read | expand

Commit Message

Hangbin Liu July 27, 2020, 11:04 a.m. UTC
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>
---
 tools/testing/selftests/bpf/test_offload.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Miller July 30, 2020, 11:34 p.m. UTC | #1
From: Hangbin Liu <liuhangbin@gmail.com>
Date: Mon, 27 Jul 2020 19:04:55 +0800

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

Applied.
diff mbox series

Patch

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