]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
selftests/bpf: fix netdevsim trap_flow_action_cookie read
authorHangbin Liu <liuhangbin@gmail.com>
Mon, 27 Jul 2020 11:04:55 +0000 (19:04 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Jul 2020 23:33:07 +0000 (16:33 -0700)
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>
tools/testing/selftests/bpf/test_offload.py

index 8294ae3ffb3cbe4197a9c2b90bc531a41b903fe6..43c9cda199b82b69ceda9eabacc25527b57516cd 100755 (executable)
@@ -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):