-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (27 loc) · 905 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
IFACE?=enp0s3
KERN?=$(shell uname -r | awk -F '-' 'BEGIN{OFS="-"}{NF--; print $0}')
bpf.bc: bpf.c bpf_helpers.h
clang -O2 -emit-llvm -c bpf.c -o bpf.bc
bpf.o: bpf.bc
llc -march=bpf -filetype=obj -o bpf.o bpf.bc
read_result: read_result.c
clang read_result.c -o read_result -lm
.PHONY: load
load: bpf.o
sudo tc qdisc add dev ${IFACE} clsact || true
sudo tc filter del dev ${IFACE} egress
sudo tc filter add dev ${IFACE} egress bpf obj bpf.o sec out_daddr
sudo tc filter del dev ${IFACE} ingress
sudo tc filter add dev ${IFACE} ingress bpf obj bpf.o sec in_saddr
status:
sudo tc filter show dev ${IFACE} egress
sudo tc filter show dev ${IFACE} ingress
unload:
sudo tc filter del dev ${IFACE} egress
sudo tc filter del dev ${IFACE} ingress
sudo tc qdisc del dev ${IFACE} clsact || true
.PHONY: read
read: read_result
sudo ./read_result
clean:
rm -rf ./read_result bpf.bc bpf.o hll.log