forked from Minki/linux
Merge branch 'fix-samples'
Jakub Kicinski says: ==================== Following patches address build issues after recent move to libbpf. For out-of-tree builds we would see the following error: gcc: error: samples/bpf/../../tools/lib/bpf/libbpf.a: No such file or directory libbpf build system is now always invoked explicitly rather than relying on building single objects most of the time. We need to resolve the friction between Kbuild and tools/ build system. Mini-library called libbpf.h in samples is renamed to bpf_insn.h, using linux/filter.h seems not completely trivial since some samples get upset when order on include search path in changed. We do have to rename libbpf.h, however, because otherwise it's hard to reliably get to libbpf's header in out-of-tree builds. v2: - fix the build error harder (patch 3); - add patch 5 (make clang less noisy). ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
commit
1d827879fc
@ -1,4 +1,8 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
BPF_SAMPLES_PATH ?= $(abspath $(srctree)/$(src))
|
||||||
|
TOOLS_PATH := $(BPF_SAMPLES_PATH)/../../tools
|
||||||
|
|
||||||
# List of programs to build
|
# List of programs to build
|
||||||
hostprogs-y := test_lru_dist
|
hostprogs-y := test_lru_dist
|
||||||
hostprogs-y += sock_example
|
hostprogs-y += sock_example
|
||||||
@ -49,59 +53,58 @@ hostprogs-y += xdpsock
|
|||||||
hostprogs-y += xdp_fwd
|
hostprogs-y += xdp_fwd
|
||||||
|
|
||||||
# Libbpf dependencies
|
# Libbpf dependencies
|
||||||
LIBBPF := ../../tools/lib/bpf/libbpf.a
|
LIBBPF = $(TOOLS_PATH)/lib/bpf/libbpf.a
|
||||||
|
|
||||||
CGROUP_HELPERS := ../../tools/testing/selftests/bpf/cgroup_helpers.o
|
CGROUP_HELPERS := ../../tools/testing/selftests/bpf/cgroup_helpers.o
|
||||||
TRACE_HELPERS := ../../tools/testing/selftests/bpf/trace_helpers.o
|
TRACE_HELPERS := ../../tools/testing/selftests/bpf/trace_helpers.o
|
||||||
|
|
||||||
test_lru_dist-objs := test_lru_dist.o $(LIBBPF)
|
fds_example-objs := bpf_load.o fds_example.o
|
||||||
sock_example-objs := sock_example.o $(LIBBPF)
|
sockex1-objs := bpf_load.o sockex1_user.o
|
||||||
fds_example-objs := bpf_load.o $(LIBBPF) fds_example.o
|
sockex2-objs := bpf_load.o sockex2_user.o
|
||||||
sockex1-objs := bpf_load.o $(LIBBPF) sockex1_user.o
|
sockex3-objs := bpf_load.o sockex3_user.o
|
||||||
sockex2-objs := bpf_load.o $(LIBBPF) sockex2_user.o
|
tracex1-objs := bpf_load.o tracex1_user.o
|
||||||
sockex3-objs := bpf_load.o $(LIBBPF) sockex3_user.o
|
tracex2-objs := bpf_load.o tracex2_user.o
|
||||||
tracex1-objs := bpf_load.o $(LIBBPF) tracex1_user.o
|
tracex3-objs := bpf_load.o tracex3_user.o
|
||||||
tracex2-objs := bpf_load.o $(LIBBPF) tracex2_user.o
|
tracex4-objs := bpf_load.o tracex4_user.o
|
||||||
tracex3-objs := bpf_load.o $(LIBBPF) tracex3_user.o
|
tracex5-objs := bpf_load.o tracex5_user.o
|
||||||
tracex4-objs := bpf_load.o $(LIBBPF) tracex4_user.o
|
tracex6-objs := bpf_load.o tracex6_user.o
|
||||||
tracex5-objs := bpf_load.o $(LIBBPF) tracex5_user.o
|
tracex7-objs := bpf_load.o tracex7_user.o
|
||||||
tracex6-objs := bpf_load.o $(LIBBPF) tracex6_user.o
|
load_sock_ops-objs := bpf_load.o load_sock_ops.o
|
||||||
tracex7-objs := bpf_load.o $(LIBBPF) tracex7_user.o
|
test_probe_write_user-objs := bpf_load.o test_probe_write_user_user.o
|
||||||
load_sock_ops-objs := bpf_load.o $(LIBBPF) load_sock_ops.o
|
trace_output-objs := bpf_load.o trace_output_user.o $(TRACE_HELPERS)
|
||||||
test_probe_write_user-objs := bpf_load.o $(LIBBPF) test_probe_write_user_user.o
|
lathist-objs := bpf_load.o lathist_user.o
|
||||||
trace_output-objs := bpf_load.o $(LIBBPF) trace_output_user.o $(TRACE_HELPERS)
|
offwaketime-objs := bpf_load.o offwaketime_user.o $(TRACE_HELPERS)
|
||||||
lathist-objs := bpf_load.o $(LIBBPF) lathist_user.o
|
spintest-objs := bpf_load.o spintest_user.o $(TRACE_HELPERS)
|
||||||
offwaketime-objs := bpf_load.o $(LIBBPF) offwaketime_user.o $(TRACE_HELPERS)
|
map_perf_test-objs := bpf_load.o map_perf_test_user.o
|
||||||
spintest-objs := bpf_load.o $(LIBBPF) spintest_user.o $(TRACE_HELPERS)
|
test_overhead-objs := bpf_load.o test_overhead_user.o
|
||||||
map_perf_test-objs := bpf_load.o $(LIBBPF) map_perf_test_user.o
|
test_cgrp2_array_pin-objs := test_cgrp2_array_pin.o
|
||||||
test_overhead-objs := bpf_load.o $(LIBBPF) test_overhead_user.o
|
test_cgrp2_attach-objs := test_cgrp2_attach.o
|
||||||
test_cgrp2_array_pin-objs := test_cgrp2_array_pin.o $(LIBBPF)
|
test_cgrp2_attach2-objs := test_cgrp2_attach2.o $(CGROUP_HELPERS)
|
||||||
test_cgrp2_attach-objs := test_cgrp2_attach.o $(LIBBPF)
|
test_cgrp2_sock-objs := test_cgrp2_sock.o
|
||||||
test_cgrp2_attach2-objs := test_cgrp2_attach2.o $(LIBBPF) $(CGROUP_HELPERS)
|
test_cgrp2_sock2-objs := bpf_load.o test_cgrp2_sock2.o
|
||||||
test_cgrp2_sock-objs := test_cgrp2_sock.o $(LIBBPF)
|
xdp1-objs := xdp1_user.o
|
||||||
test_cgrp2_sock2-objs := bpf_load.o $(LIBBPF) test_cgrp2_sock2.o
|
|
||||||
xdp1-objs := xdp1_user.o $(LIBBPF)
|
|
||||||
# reuse xdp1 source intentionally
|
# reuse xdp1 source intentionally
|
||||||
xdp2-objs := xdp1_user.o $(LIBBPF)
|
xdp2-objs := xdp1_user.o
|
||||||
xdp_router_ipv4-objs := bpf_load.o $(LIBBPF) xdp_router_ipv4_user.o
|
xdp_router_ipv4-objs := bpf_load.o xdp_router_ipv4_user.o
|
||||||
test_current_task_under_cgroup-objs := bpf_load.o $(LIBBPF) $(CGROUP_HELPERS) \
|
test_current_task_under_cgroup-objs := bpf_load.o $(CGROUP_HELPERS) \
|
||||||
test_current_task_under_cgroup_user.o
|
test_current_task_under_cgroup_user.o
|
||||||
trace_event-objs := bpf_load.o $(LIBBPF) trace_event_user.o $(TRACE_HELPERS)
|
trace_event-objs := bpf_load.o trace_event_user.o $(TRACE_HELPERS)
|
||||||
sampleip-objs := bpf_load.o $(LIBBPF) sampleip_user.o $(TRACE_HELPERS)
|
sampleip-objs := bpf_load.o sampleip_user.o $(TRACE_HELPERS)
|
||||||
tc_l2_redirect-objs := bpf_load.o $(LIBBPF) tc_l2_redirect_user.o
|
tc_l2_redirect-objs := bpf_load.o tc_l2_redirect_user.o
|
||||||
lwt_len_hist-objs := bpf_load.o $(LIBBPF) lwt_len_hist_user.o
|
lwt_len_hist-objs := bpf_load.o lwt_len_hist_user.o
|
||||||
xdp_tx_iptunnel-objs := bpf_load.o $(LIBBPF) xdp_tx_iptunnel_user.o
|
xdp_tx_iptunnel-objs := bpf_load.o xdp_tx_iptunnel_user.o
|
||||||
test_map_in_map-objs := bpf_load.o $(LIBBPF) test_map_in_map_user.o
|
test_map_in_map-objs := bpf_load.o test_map_in_map_user.o
|
||||||
per_socket_stats_example-objs := cookie_uid_helper_example.o $(LIBBPF)
|
per_socket_stats_example-objs := cookie_uid_helper_example.o
|
||||||
xdp_redirect-objs := bpf_load.o $(LIBBPF) xdp_redirect_user.o
|
xdp_redirect-objs := bpf_load.o xdp_redirect_user.o
|
||||||
xdp_redirect_map-objs := bpf_load.o $(LIBBPF) xdp_redirect_map_user.o
|
xdp_redirect_map-objs := bpf_load.o xdp_redirect_map_user.o
|
||||||
xdp_redirect_cpu-objs := bpf_load.o $(LIBBPF) xdp_redirect_cpu_user.o
|
xdp_redirect_cpu-objs := bpf_load.o xdp_redirect_cpu_user.o
|
||||||
xdp_monitor-objs := bpf_load.o $(LIBBPF) xdp_monitor_user.o
|
xdp_monitor-objs := bpf_load.o xdp_monitor_user.o
|
||||||
xdp_rxq_info-objs := xdp_rxq_info_user.o $(LIBBPF)
|
xdp_rxq_info-objs := xdp_rxq_info_user.o
|
||||||
syscall_tp-objs := bpf_load.o $(LIBBPF) syscall_tp_user.o
|
syscall_tp-objs := bpf_load.o syscall_tp_user.o
|
||||||
cpustat-objs := bpf_load.o $(LIBBPF) cpustat_user.o
|
cpustat-objs := bpf_load.o cpustat_user.o
|
||||||
xdp_adjust_tail-objs := xdp_adjust_tail_user.o $(LIBBPF)
|
xdp_adjust_tail-objs := xdp_adjust_tail_user.o
|
||||||
xdpsock-objs := bpf_load.o $(LIBBPF) xdpsock_user.o
|
xdpsock-objs := bpf_load.o xdpsock_user.o
|
||||||
xdp_fwd-objs := bpf_load.o $(LIBBPF) xdp_fwd_user.o
|
xdp_fwd-objs := bpf_load.o xdp_fwd_user.o
|
||||||
|
|
||||||
# Tell kbuild to always build the programs
|
# Tell kbuild to always build the programs
|
||||||
always := $(hostprogs-y)
|
always := $(hostprogs-y)
|
||||||
@ -173,53 +176,12 @@ HOSTCFLAGS_spintest_user.o += -I$(srctree)/tools/lib/bpf/
|
|||||||
HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/
|
HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/
|
||||||
HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/
|
HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/
|
||||||
|
|
||||||
HOSTLOADLIBES_test_lru_dist += -lelf
|
HOST_LOADLIBES += $(LIBBPF) -lelf
|
||||||
HOSTLOADLIBES_sock_example += -lelf
|
HOSTLOADLIBES_tracex4 += -lrt
|
||||||
HOSTLOADLIBES_fds_example += -lelf
|
HOSTLOADLIBES_trace_output += -lrt
|
||||||
HOSTLOADLIBES_sockex1 += -lelf
|
HOSTLOADLIBES_map_perf_test += -lrt
|
||||||
HOSTLOADLIBES_sockex2 += -lelf
|
HOSTLOADLIBES_test_overhead += -lrt
|
||||||
HOSTLOADLIBES_sockex3 += -lelf
|
HOSTLOADLIBES_xdpsock += -pthread
|
||||||
HOSTLOADLIBES_tracex1 += -lelf
|
|
||||||
HOSTLOADLIBES_tracex2 += -lelf
|
|
||||||
HOSTLOADLIBES_tracex3 += -lelf
|
|
||||||
HOSTLOADLIBES_tracex4 += -lelf -lrt
|
|
||||||
HOSTLOADLIBES_tracex5 += -lelf
|
|
||||||
HOSTLOADLIBES_tracex6 += -lelf
|
|
||||||
HOSTLOADLIBES_tracex7 += -lelf
|
|
||||||
HOSTLOADLIBES_test_cgrp2_array_pin += -lelf
|
|
||||||
HOSTLOADLIBES_test_cgrp2_attach += -lelf
|
|
||||||
HOSTLOADLIBES_test_cgrp2_attach2 += -lelf
|
|
||||||
HOSTLOADLIBES_test_cgrp2_sock += -lelf
|
|
||||||
HOSTLOADLIBES_test_cgrp2_sock2 += -lelf
|
|
||||||
HOSTLOADLIBES_load_sock_ops += -lelf
|
|
||||||
HOSTLOADLIBES_test_probe_write_user += -lelf
|
|
||||||
HOSTLOADLIBES_trace_output += -lelf -lrt
|
|
||||||
HOSTLOADLIBES_lathist += -lelf
|
|
||||||
HOSTLOADLIBES_offwaketime += -lelf
|
|
||||||
HOSTLOADLIBES_spintest += -lelf
|
|
||||||
HOSTLOADLIBES_map_perf_test += -lelf -lrt
|
|
||||||
HOSTLOADLIBES_test_overhead += -lelf -lrt
|
|
||||||
HOSTLOADLIBES_xdp1 += -lelf
|
|
||||||
HOSTLOADLIBES_xdp2 += -lelf
|
|
||||||
HOSTLOADLIBES_xdp_router_ipv4 += -lelf
|
|
||||||
HOSTLOADLIBES_test_current_task_under_cgroup += -lelf
|
|
||||||
HOSTLOADLIBES_trace_event += -lelf
|
|
||||||
HOSTLOADLIBES_sampleip += -lelf
|
|
||||||
HOSTLOADLIBES_tc_l2_redirect += -l elf
|
|
||||||
HOSTLOADLIBES_lwt_len_hist += -l elf
|
|
||||||
HOSTLOADLIBES_xdp_tx_iptunnel += -lelf
|
|
||||||
HOSTLOADLIBES_test_map_in_map += -lelf
|
|
||||||
HOSTLOADLIBES_per_socket_stats_example += -lelf
|
|
||||||
HOSTLOADLIBES_xdp_redirect += -lelf
|
|
||||||
HOSTLOADLIBES_xdp_redirect_map += -lelf
|
|
||||||
HOSTLOADLIBES_xdp_redirect_cpu += -lelf
|
|
||||||
HOSTLOADLIBES_xdp_monitor += -lelf
|
|
||||||
HOSTLOADLIBES_xdp_rxq_info += -lelf
|
|
||||||
HOSTLOADLIBES_syscall_tp += -lelf
|
|
||||||
HOSTLOADLIBES_cpustat += -lelf
|
|
||||||
HOSTLOADLIBES_xdp_adjust_tail += -lelf
|
|
||||||
HOSTLOADLIBES_xdpsock += -lelf -pthread
|
|
||||||
HOSTLOADLIBES_xdp_fwd += -lelf
|
|
||||||
|
|
||||||
# Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline:
|
# Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline:
|
||||||
# make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
|
# make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
|
||||||
@ -233,15 +195,16 @@ CLANG_ARCH_ARGS = -target $(ARCH)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Trick to allow make to be run from this directory
|
# Trick to allow make to be run from this directory
|
||||||
all: $(LIBBPF)
|
all:
|
||||||
$(MAKE) -C ../../ $(CURDIR)/
|
$(MAKE) -C ../../ $(CURDIR)/ BPF_SAMPLES_PATH=$(CURDIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -C ../../ M=$(CURDIR) clean
|
$(MAKE) -C ../../ M=$(CURDIR) clean
|
||||||
@rm -f *~
|
@rm -f *~
|
||||||
|
|
||||||
$(LIBBPF): FORCE
|
$(LIBBPF): FORCE
|
||||||
$(MAKE) -C $(dir $@)
|
# Fix up variables inherited from Kbuild that tools/ build system won't like
|
||||||
|
$(MAKE) -C $(dir $@) RM='rm -rf' LDFLAGS= srctree=$(BPF_SAMPLES_PATH)/../../ O=
|
||||||
|
|
||||||
$(obj)/syscall_nrs.s: $(src)/syscall_nrs.c
|
$(obj)/syscall_nrs.s: $(src)/syscall_nrs.c
|
||||||
$(call if_changed_dep,cc_s_c)
|
$(call if_changed_dep,cc_s_c)
|
||||||
@ -272,7 +235,8 @@ verify_target_bpf: verify_cmds
|
|||||||
exit 2; \
|
exit 2; \
|
||||||
else true; fi
|
else true; fi
|
||||||
|
|
||||||
$(src)/*.c: verify_target_bpf
|
$(BPF_SAMPLES_PATH)/*.c: verify_target_bpf $(LIBBPF)
|
||||||
|
$(src)/*.c: verify_target_bpf $(LIBBPF)
|
||||||
|
|
||||||
$(obj)/tracex5_kern.o: $(obj)/syscall_nrs.h
|
$(obj)/tracex5_kern.o: $(obj)/syscall_nrs.h
|
||||||
|
|
||||||
@ -280,7 +244,8 @@ $(obj)/tracex5_kern.o: $(obj)/syscall_nrs.h
|
|||||||
# But, there is no easy way to fix it, so just exclude it since it is
|
# But, there is no easy way to fix it, so just exclude it since it is
|
||||||
# useless for BPF samples.
|
# useless for BPF samples.
|
||||||
$(obj)/%.o: $(src)/%.c
|
$(obj)/%.o: $(src)/%.c
|
||||||
$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \
|
@echo " CLANG-bpf " $@
|
||||||
|
$(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \
|
||||||
-I$(srctree)/tools/testing/selftests/bpf/ \
|
-I$(srctree)/tools/testing/selftests/bpf/ \
|
||||||
-D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \
|
-D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \
|
||||||
-D__TARGET_ARCH_$(ARCH) -Wno-compare-distinct-pointer-types \
|
-D__TARGET_ARCH_$(ARCH) -Wno-compare-distinct-pointer-types \
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0 */
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
/* eBPF mini library */
|
/* eBPF instruction mini library */
|
||||||
#ifndef __LIBBPF_H
|
#ifndef __BPF_INSN_H
|
||||||
#define __LIBBPF_H
|
#define __BPF_INSN_H
|
||||||
|
|
||||||
#include <bpf/bpf.h>
|
|
||||||
|
|
||||||
struct bpf_insn;
|
struct bpf_insn;
|
||||||
|
|
@ -24,7 +24,7 @@
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "perf-sys.h"
|
#include "perf-sys.h"
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#ifndef __BPF_LOAD_H
|
#ifndef __BPF_LOAD_H
|
||||||
#define __BPF_LOAD_H
|
#define __BPF_LOAD_H
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
#define MAX_MAPS 32
|
#define MAX_MAPS 32
|
||||||
#define MAX_PROGS 32
|
#define MAX_PROGS 32
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <bpf/bpf.h>
|
#include <bpf/bpf.h>
|
||||||
#include "libbpf.h"
|
#include "bpf_insn.h"
|
||||||
|
|
||||||
#define PORT 8888
|
#define PORT 8888
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
#define MAX_CPU 8
|
#define MAX_CPU 8
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
|
#include "bpf_insn.h"
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "libbpf.h"
|
|
||||||
#include "sock_example.h"
|
#include "sock_example.h"
|
||||||
|
|
||||||
#define BPF_F_PIN (1 << 0)
|
#define BPF_F_PIN (1 << 0)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
#define MAX_ENTRIES 20
|
#define MAX_ENTRIES 20
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
|
|
||||||
#define MAX_INDEX 64
|
#define MAX_INDEX 64
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
#define TEST_BIT(t) (1U << (t))
|
#define TEST_BIT(t) (1U << (t))
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
#include <linux/if_ether.h>
|
#include <linux/if_ether.h>
|
||||||
#include <linux/ip.h>
|
#include <linux/ip.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
|
#include "bpf_insn.h"
|
||||||
#include "sock_example.h"
|
#include "sock_example.h"
|
||||||
|
|
||||||
char bpf_log_buf[BPF_LOG_BUF_SIZE];
|
char bpf_log_buf[BPF_LOG_BUF_SIZE];
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <linux/if_packet.h>
|
#include <linux/if_packet.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include "libbpf.h"
|
|
||||||
|
|
||||||
static inline int open_raw_sock(const char *name)
|
static inline int open_raw_sock(const char *name)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "sock_example.h"
|
#include "sock_example.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "sock_example.h"
|
#include "sock_example.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "sock_example.h"
|
#include "sock_example.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
/* This program verifies bpf attachment to tracepoint sys_enter_* and sys_exit_*.
|
/* This program verifies bpf attachment to tracepoint sys_enter_* and sys_exit_*.
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
|
@ -28,8 +28,9 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include "bpf_insn.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MAP_KEY_PACKETS,
|
MAP_KEY_PACKETS,
|
||||||
|
@ -24,8 +24,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include "bpf_insn.h"
|
||||||
#include "cgroup_helpers.h"
|
#include "cgroup_helpers.h"
|
||||||
|
|
||||||
#define FOO "/foo"
|
#define FOO "/foo"
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include "bpf_insn.h"
|
||||||
|
|
||||||
char bpf_log_buf[BPF_LOG_BUF_SIZE];
|
char bpf_log_buf[BPF_LOG_BUF_SIZE];
|
||||||
|
|
||||||
|
@ -19,8 +19,9 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include "bpf_insn.h"
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
static int usage(const char *argv0)
|
static int usage(const char *argv0)
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include "cgroup_helpers.h"
|
#include "cgroup_helpers.h"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
|
|
||||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
#define PORT_A (map_fd[0])
|
#define PORT_A (map_fd[0])
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
#define MAX_CNT 1000000
|
#define MAX_CNT 1000000
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "libbpf.h"
|
#include <libbpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "perf-sys.h"
|
#include "perf-sys.h"
|
||||||
#include "trace_helpers.h"
|
#include "trace_helpers.h"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
int main(int ac, char **argv)
|
int main(int ac, char **argv)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
struct pair {
|
struct pair {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <linux/filter.h>
|
#include <linux/filter.h>
|
||||||
#include <linux/seccomp.h>
|
#include <linux/seccomp.h>
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "perf-sys.h"
|
#include "perf-sys.h"
|
||||||
|
|
||||||
#define SAMPLE_PERIOD 0x7fffffffffffffffULL
|
#define SAMPLE_PERIOD 0x7fffffffffffffffULL
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
|
|
||||||
static int do_attach(int idx, int fd, const char *name)
|
static int do_attach(int idx, int fd, const char *name)
|
||||||
|
@ -26,7 +26,7 @@ static const char *__doc_err_only__=
|
|||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ static const char *__doc__ =
|
|||||||
* use bpf/libbpf.h), but cannot as (currently) needed for XDP
|
* use bpf/libbpf.h), but cannot as (currently) needed for XDP
|
||||||
* attaching to a device via bpf_set_link_xdp_fd()
|
* attaching to a device via bpf_set_link_xdp_fd()
|
||||||
*/
|
*/
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
|
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
static int ifindex_in;
|
static int ifindex_in;
|
||||||
static int ifindex_out;
|
static int ifindex_out;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
static int ifindex_in;
|
static int ifindex_in;
|
||||||
static int ifindex_out;
|
static int ifindex_out;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
#include "xdp_tx_iptunnel_common.h"
|
#include "xdp_tx_iptunnel_common.h"
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include "bpf_load.h"
|
#include "bpf_load.h"
|
||||||
#include "bpf_util.h"
|
#include "bpf_util.h"
|
||||||
#include "libbpf.h"
|
#include <bpf/bpf.h>
|
||||||
|
|
||||||
#include "xdpsock.h"
|
#include "xdpsock.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user