1. 15 7月, 2018 1 次提交
    • A
      bpf: Add BPF_SOCK_OPS_TCP_LISTEN_CB · f333ee0c
      Andrey Ignatov 提交于
      Add new TCP-BPF callback that is called on listen(2) right after socket
      transition to TCP_LISTEN state.
      
      It fills the gap for listening sockets in TCP-BPF. For example BPF
      program can set BPF_SOCK_OPS_STATE_CB_FLAG when socket becomes listening
      and track later transition from TCP_LISTEN to TCP_CLOSE with
      BPF_SOCK_OPS_STATE_CB callback.
      
      Before there was no way to do it with TCP-BPF and other options were
      much harder to work with. E.g. socket state tracking can be done with
      tracepoints (either raw or regular) but they can't be attached to cgroup
      and their lifetime has to be managed separately.
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      f333ee0c
  2. 14 7月, 2018 13 次提交
  3. 13 7月, 2018 24 次提交
  4. 12 7月, 2018 2 次提交
    • D
      Merge branch 'bpf-bpftool-improved-prog-load' · 671dffa7
      Daniel Borkmann 提交于
      Jakub Kicinski says:
      
      ====================
      This series starts with two minor clean ups to test_offload.py
      selftest script.
      
      The next 11 patches extend the abilities of bpftool prog load
      beyond the simple cgroup use cases.  Three new parameters are
      added:
      
       - type - allows specifying program type, independent of how
         code sections are named;
       - map  - allows reusing existing maps, instead of creating a new
         map on every program load;
       - dev  - offload/binding to a device.
      
      A number of changes to libbpf is required to accomplish the task.
      The section - program type logic mapping is exposed.  We should
      probably aim to use the libbpf program section naming everywhere.
      For reuse of maps we need to allow users to set FD for bpf map
      object in libbpf.
      
      Examples
      
      Load program my_xdp.o and pin it as /sys/fs/bpf/my_xdp, for xdp
      program type:
      
      $ bpftool prog load my_xdp.o /sys/fs/bpf/my_xdp \
        type xdp
      
      As above but for offload:
      
      $ bpftool prog load my_xdp.o /sys/fs/bpf/my_xdp \
        type xdp \
        dev netdevsim0
      
      Load program my_maps.o, but for the first map reuse map id 17,
      and for the map called "other_map" reuse pinned map /sys/fs/bpf/map0:
      
      $ bpftool prog load my_maps.o /sys/fs/bpf/prog \
        map idx 0 id 17 \
        map name other_map pinned /sys/fs/bpf/map0
      
      v3:
       - fix return codes in patch 5;
       - rename libbpf_prog_type_by_string() -> libbpf_prog_type_by_name();
       - fold file path into xattr in patch 8;
       - add patch 10;
       - use dup3() in patch 12;
       - depend on fd value in patch 12;
       - close old fd in patch 12.
      v2:
       - add compat for reallocarray().
      ====================
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      671dffa7
    • J
      tools: bpftool: allow reuse of maps with bpftool prog load · 3ff5a4dc
      Jakub Kicinski 提交于
      Add map parameter to prog load which will allow reuse of existing
      maps instead of creating new ones.
      
      We need feature detection and compat code for reallocarray, since
      it's not available in many libc versions.
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      3ff5a4dc