selftests/bpf: Add cgroup id helpers to bpf_helpers.h
authorAndrey Ignatov <rdna@fb.com>
Sun, 12 Aug 2018 17:49:29 +0000 (10:49 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Sun, 12 Aug 2018 23:02:39 +0000 (01:02 +0200)
Add bpf_skb_cgroup_id and bpf_skb_ancestor_cgroup_id helpers to
bpf_helpers.h to use them in tests and samples.

Signed-off-by: Andrey Ignatov <rdna@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/bpf_helpers.h

index 5c32266c2c389babf6fcc5c3d7178421fef4ceba..e4be7730222dff86afb2f6a7fbeb24ddc027ba7e 100644 (file)
@@ -139,6 +139,10 @@ static unsigned long long (*bpf_get_current_cgroup_id)(void) =
        (void *) BPF_FUNC_get_current_cgroup_id;
 static void *(*bpf_get_local_storage)(void *map, unsigned long long flags) =
        (void *) BPF_FUNC_get_local_storage;
+static unsigned long long (*bpf_skb_cgroup_id)(void *ctx) =
+       (void *) BPF_FUNC_skb_cgroup_id;
+static unsigned long long (*bpf_skb_ancestor_cgroup_id)(void *ctx, int level) =
+       (void *) BPF_FUNC_skb_ancestor_cgroup_id;
 
 /* llvm builtin functions that eBPF C program may use to
  * emit BPF_LD_ABS and BPF_LD_IND instructions