dae/insert.sh

17 lines
577 B
Bash
Raw Normal View History

2023-01-23 18:54:21 +07:00
#!/bin/bash
dev=docker0
sudo tc qdisc add dev $dev clsact > /dev/null 2>&1
set -ex
2023-01-27 01:10:27 +07:00
sudo rm -rf /sys/fs/bpf/tc/globals/*
# clang -fno-stack-protector -O2 -g -emit-llvm -c component/control/kern/tproxy.c -o - | llc -march=bpf -mcpu=v3 -filetype=obj -o foo.o
2023-01-23 18:54:21 +07:00
clang -O2 -g -Wall -Werror -c component/control/kern/tproxy.c -target bpf -o foo.o
sudo tc filter del dev $dev ingress
sudo tc filter del dev $dev egress
2023-01-27 01:10:27 +07:00
sudo tc filter add dev $dev ingress bpf direct-action obj foo.o sec tc/ingress
2023-01-23 18:54:21 +07:00
sudo tc filter add dev $dev egress bpf direct-action obj foo.o sec tc/egress
exit 0