• Andrey Ignatov's avatar
    bpftool: Support sysctl hook · f25377ee
    Andrey Ignatov authored
    Add support for recently added BPF_PROG_TYPE_CGROUP_SYSCTL program type
    and BPF_CGROUP_SYSCTL attach type.
    
    Example of bpftool output with sysctl program from selftests:
    
      # bpftool p load ./test_sysctl_prog.o /mnt/bpf/sysctl_prog type cgroup/sysctl
      # bpftool p l
      9: cgroup_sysctl  name sysctl_tcp_mem  tag 0dd05f81a8d0d52e  gpl
              loaded_at 2019-04-16T12:57:27-0700  uid 0
              xlated 1008B  jited 623B  memlock 4096B
      # bpftool c a /mnt/cgroup2/bla sysctl id 9
      # bpftool c t
      CgroupPath
      ID       AttachType      AttachFlags     Name
      /mnt/cgroup2/bla
          9        sysctl                          sysctl_tcp_mem
      # bpftool c d /mnt/cgroup2/bla sysctl id 9
      # bpftool c t
      CgroupPath
      ID       AttachType      AttachFlags     Name
    Signed-off-by: default avatarAndrey Ignatov <rdna@fb.com>
    Acked-by: default avatarSong Liu <songliubraving@fb.com>
    Acked-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    f25377ee
prog.c 24.2 KB