mirror of
https://github.com/daeuniverse/dae.git
synced 2025-01-13 08:14:33 +07:00
b9b1624b0b
Co-authored-by: kev <yqlbu@bu.edu> Co-authored-by: dae-bot[bot] <136105375+dae-bot[bot]@users.noreply.github.com>
30 lines
1.0 KiB
Bash
Executable File
30 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
lan=docker0
|
|
wan=ens192
|
|
|
|
sudo tc qdisc add dev $lan clsact > /dev/null 2>&1
|
|
sudo tc qdisc add dev $wan clsact > /dev/null 2>&1
|
|
|
|
set -ex
|
|
|
|
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-14 -O2 -g -Wall -c ../../control/kern/tproxy.c -target bpf -D__TARGET_ARCH_x86 -o foo.o
|
|
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
|
|
|
|
sudo tc filter add dev $lan ingress bpf direct-action obj foo.o sec tc/ingress
|
|
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
|
|
|
|
exit 0
|