mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
This example demonstrates how to write a simple eBPF Qdisc classifier that classifies flows depending on their destination TCP port. The example script, runner.sh shows how you can use the eBPF Qdisc classifier and implement the same functionality using u32. The script creates two network namespaces called Left and Right, representing two different hosts. The script then illustrates the classifiers in action using iperf3 by starting clients on the Left namespace that connect to iperf3 servers on the Right namespace. The Qdisc classifiers give TCP ports 8080 and 8081 a high rate limit, while TCP port 8082 represents all other traffic capped at 20 Mbps. Signed-off-by: Frey Alfredsson <freysteinn@freysteinn.com>
32 lines
685 B
Makefile
32 lines
685 B
Makefile
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
|
|
|
TC_BPF_TARGETS := filter
|
|
BPF_TARGETS += $(TC_BPF_TARGETS)
|
|
|
|
EXTRA_DEPS += config.mk
|
|
|
|
LIB_DIR = ../lib
|
|
|
|
include $(LIB_DIR)/common.mk
|
|
include config.mk
|
|
|
|
all: config.mk
|
|
|
|
config.mk: configure
|
|
@sh configure
|
|
|
|
ifndef HAVE_TC_LIBBPF
|
|
# If the iproute2 'tc' tool doesn't understand BTF debug info
|
|
# use llvm-strip to remove this debug info from object file
|
|
#
|
|
# *BUT* cannot strip everything as it removes ELF elems needed for
|
|
# creating maps
|
|
#
|
|
.PHONY: strip_tc_obj
|
|
strip_tc_obj: ${TC_BPF_TARGETS:=.o}
|
|
$(Q) echo "TC don't support libbpf - strip BTF info"
|
|
$(Q) llvm-strip --no-strip-all --remove-section .BTF $?
|
|
|
|
all: strip_tc_obj
|
|
endif
|