dae/hack/mock/insert.sh

30 lines
1.0 KiB
Bash
Raw Permalink Normal View History

2023-01-23 18:54:21 +07:00
#!/bin/bash
2023-01-30 14:50:55 +07:00
lan=docker0
wan=enp5s0
2023-01-23 18:54:21 +07:00
2023-01-30 14:50:55 +07:00
sudo tc qdisc add dev $lan clsact > /dev/null 2>&1
2023-02-07 20:11:12 +07:00
sudo tc qdisc add dev $wan clsact > /dev/null 2>&1
2023-01-23 18:54:21 +07:00
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 ../../control/kern/tproxy.c -o - | llc -march=bpf -mcpu=v3 -mattr=+alu32 -filetype=obj -o foo.o
clang -O2 -g -Wall -c ../../control/kern/tproxy.c -target bpf -D__TARGET_ARCH_x86 -o foo.o
2023-01-30 14:50:55 +07:00
sudo tc filter del dev $lan ingress
sudo tc filter del dev $lan egress
2023-02-07 20:11:12 +07:00
sudo tc filter del dev $wan ingress
sudo tc filter del dev $wan egress
2023-01-30 22:21:00 +07:00
sudo tc filter add dev $lan ingress bpf direct-action obj foo.o sec tc/ingress
2023-02-12 20:50:15 +07:00
sudo tc filter add dev $lan egress bpf direct-action obj foo.o sec tc/egress
sudo tc filter add dev $wan ingress bpf direct-action obj foo.o sec tc/wan_ingress
sudo tc filter add dev $wan egress bpf direct-action obj foo.o sec tc/wan_egress
sudo tc filter del dev $lan ingress
sudo tc filter del dev $lan egress
sudo tc filter del dev $wan ingress
sudo tc filter del dev $wan egress
2023-01-23 18:54:21 +07:00
exit 0