15 May, 2018

1 commit

  • The libbpf.h file in samples is clashing with libbpf's header.
    Since it only includes a subset of filter.h instruction helpers
    rename it to bpf_insn.h. Drop the unnecessary include of bpf/bpf.h.

    Signed-off-by: Jakub Kicinski
    Acked-by: Jesper Dangaard Brouer
    Signed-off-by: Alexei Starovoitov

    Jakub Kicinski
     

28 Mar, 2018

1 commit


12 May, 2017

1 commit

  • Shahid Habib noticed that when xdp1 was killed from a different console the xdp
    program was not cleaned-up properly in the kernel and it continued to forward
    traffic.

    Most of the applications in samples/bpf cleanup properly, but only when getting
    SIGINT. Since kill defaults to using SIGTERM, add support to cleanup when the
    application receives either SIGINT or SIGTERM.

    Signed-off-by: Andy Gospodarek
    Reported-by: Shahid Habib
    Acked-by: Alexei Starovoitov
    Acked-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Andy Gospodarek
     

02 May, 2017

1 commit

  • Fix the following warnings triggered by 51570a5ab2b7 ("A Sample of
    using socket cookie and uid for traffic monitoring"):

    In file included from /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c:54:0:
    /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c: In function 'prog_load':
    /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c:119:27: warning: overflow in implicit constant conversion [-Woverflow]
    -32 + offsetof(struct stats, uid)),
    ^
    /home/foo/net-next/samples/bpf/libbpf.h:135:12: note: in definition of macro 'BPF_STX_MEM'
    .off = OFF, \
    ^
    /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c:121:27: warning: overflow in implicit constant conversion [-Woverflow]
    -32 + offsetof(struct stats, packets), 1),
    ^
    /home/foo/net-next/samples/bpf/libbpf.h:155:12: note: in definition of macro 'BPF_ST_MEM'
    .off = OFF, \
    ^
    /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c:129:27: warning: overflow in implicit constant conversion [-Woverflow]
    -32 + offsetof(struct stats, bytes)),
    ^
    /home/foo/net-next/samples/bpf/libbpf.h:135:12: note: in definition of macro 'BPF_STX_MEM'
    .off = OFF, \
    ^
    HOSTLD /home/foo/net-next/samples/bpf/per_socket_stats_example

    Fixes: 51570a5ab2b7 ("A Sample of using socket cookie and uid for traffic monitoring")
    Signed-off-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

25 Apr, 2017

1 commit

  • Fixes the following warning

    samples/bpf/cookie_uid_helper_example.c: At top level:
    samples/bpf/cookie_uid_helper_example.c:276:6: warning: no previous prototype for ‘finish’ [-Wmissing-prototypes]
    void finish(int ret)
    ^~~~~~
    HOSTLD samples/bpf/per_socket_stats_example

    Signed-off-by: Alexander Alemayhu
    Acked-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Alexander Alemayhu
     

08 Apr, 2017

1 commit

  • Added a per socket traffic monitoring option to illustrate the usage
    of new getsockopt SO_COOKIE. The program is based on the socket traffic
    monitoring program using xt_eBPF and in the new option the data entry
    can be directly accessed using socket cookie. The cookie retrieved
    allow us to lookup an element in the eBPF for a specific socket.

    Signed-off-by: Chenbo Feng
    Signed-off-by: David S. Miller

    Chenbo Feng
     

24 Mar, 2017

1 commit

  • Add a sample program to demostrate the possible usage of
    get_socket_cookie and get_socket_uid helper function. The program will
    store bytes and packets counting of in/out traffic monitored by iptables
    and store the stats in a bpf map in per socket base. The owner uid of
    the socket will be stored as part of the data entry. A shell script for
    running the program is also included.

    Acked-by: Alexei Starovoitov
    Acked-by: Willem de Bruijn
    Signed-off-by: Chenbo Feng
    Signed-off-by: David S. Miller

    Chenbo Feng