diff --git a/traffic-pacing-edt/Makefile b/traffic-pacing-edt/Makefile index 3b3d18b..b738fc7 100644 --- a/traffic-pacing-edt/Makefile +++ b/traffic-pacing-edt/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) USER_TARGETS := -BPF_TARGETS := pacer01 +BPF_TARGETS := edt_pacer01 LIB_DIR = ../lib @@ -14,7 +14,7 @@ include $(LIB_DIR)/common.mk # creating maps # .PHONY: strip_tc_obj -strip_tc_obj: ${BPF_TARGETS :=.o} +strip_tc_obj: ${BPF_TARGETS:=.o} $(Q) llvm-strip --no-strip-all --remove-section .BTF $? all: strip_tc_obj diff --git a/traffic-pacing-edt/edt_pacer01.c b/traffic-pacing-edt/edt_pacer01.c new file mode 100644 index 0000000..98c446a --- /dev/null +++ b/traffic-pacing-edt/edt_pacer01.c @@ -0,0 +1,28 @@ +#include +#include +#include + +char _license[] SEC("license") = "GPL"; + +SEC("classifier") int tc_dummy(struct __sk_buff *skb) +{ + volatile void *data, *data_end; + int ret = BPF_OK; + struct ethhdr *eth; + + data = (void *)(long)skb->data; + data_end = (void *)(long)skb->data_end; + eth = (struct ethhdr *)data; + + if (data + sizeof(*eth) > data_end) + return BPF_DROP; + + /* Keep ARP resolution working */ + if (eth->h_proto == bpf_htons(ETH_P_ARP)) { + ret = BPF_OK; + goto out; + } + + out: + return ret; +}