OSDN Git Service

samples/bpf: add multi-prog cgroup test case
authorAlexei Starovoitov <ast@fb.com>
Tue, 3 Oct 2017 05:50:25 +0000 (22:50 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Oct 2017 23:05:05 +0000 (16:05 -0700)
commit39323e788cb672adba8709ca407bd6763aae577d
tree717fc5a1b5ce6852fd28d1d5f5270d84db0b6f24
parent244d20efdb68c5c1a26c667baeb232ea163e2f69
samples/bpf: add multi-prog cgroup test case

create 5 cgroups, attach 6 progs and check that progs are executed as:
cgrp1 (MULTI progs A, B) ->
   cgrp2 (OVERRIDE prog C) ->
     cgrp3 (MULTI prog D) ->
       cgrp4 (OVERRIDE prog E) ->
         cgrp5 (NONE prog F)
the event in cgrp5 triggers execution of F,D,A,B in that order.
if prog F is detached, the execution is E,D,A,B
if prog F and D are detached, the execution is E,A,B
if prog F, E and D are detached, the execution is C,A,B

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
samples/bpf/cgroup_helpers.c
samples/bpf/test_cgrp2_attach2.c