Skip to content

Commit

Permalink
samples/bpf: fix a compilation failure
Browse files Browse the repository at this point in the history
samples/bpf build failed with the following errors:

  $ make samples/bpf/
  ...
  HOSTCC  samples/bpf/sockex3_user.o
  /data/users/yhs/work/net-next/samples/bpf/sockex3_user.c:16:8: error: redefinition of ‘struct bpf_flow_keys’
   struct bpf_flow_keys {
          ^
  In file included from /data/users/yhs/work/net-next/samples/bpf/sockex3_user.c:4:0:
  ./usr/include/linux/bpf.h:2338:9: note: originally defined here
    struct bpf_flow_keys *flow_keys;
           ^
  make[3]: *** [samples/bpf/sockex3_user.o] Error 1

Commit d58e468 ("flow_dissector: implements flow dissector BPF hook")
introduced struct bpf_flow_keys in include/uapi/linux/bpf.h and hence
caused the naming conflict with samples/bpf/sockex3_user.c.

The fix is to rename struct bpf_flow_keys in samples/bpf/sockex3_user.c
to flow_keys to avoid the conflict.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Yonghong Song authored and Daniel Borkmann committed Sep 18, 2018
1 parent 664e787 commit 534e0e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/bpf/sockex3_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define PARSE_IP_PROG_FD (prog_fd[0])
#define PROG_ARRAY_FD (map_fd[0])

struct bpf_flow_keys {
struct flow_keys {
__be32 src;
__be32 dst;
union {
Expand Down Expand Up @@ -64,7 +64,7 @@ int main(int argc, char **argv)
(void) f;

for (i = 0; i < 5; i++) {
struct bpf_flow_keys key = {}, next_key;
struct flow_keys key = {}, next_key;
struct pair value;

sleep(1);
Expand Down

0 comments on commit 534e0e5

Please sign in to comment.