Rewrite per-source ratelimiting rules to use a custom hashtable
[flowspec-xdp] / install.sh
index d77a8b0a66a5dd941fa78fdb39e14488da44e2cd..b8f83ab1e85823bfdfaadb0dc2ae47c3c6d622ab 100755 (executable)
@@ -15,10 +15,12 @@ fi
 RULES="$(birdc show route table flowspec4 primary all)
 $(birdc show route table flowspec6 primary all)"
 
+echo "const uint8_t COMPILE_TIME_RAND[] = { $(dd if=/dev/urandom of=/dev/stdout bs=1 count=8 2>/dev/null | hexdump -e '4/1 "0x%02x, "') };" > rand.h
+
 echo "$RULES" | ./genrules.py --8021q=drop-vlan --v6frag=ignore-parse-if-rule --ihl=parse-options
-clang $CLANG_ARGS -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Wno-unused-variable -O3 -emit-llvm -c xdp.c -o xdp.bc
+clang $CLANG_ARGS -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Wno-unused-variable -Wno-unused-function -O3 -emit-llvm -c xdp.c -o xdp.bc
 if [ "$2" != "" ]; then
-       clang $4 -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Wno-unused-variable -O3 -emit-llvm -c "$2" -o wrapper.bc
+       clang $4 -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -O3 -emit-llvm -c "$2" -o wrapper.bc
        llvm-link xdp.bc wrapper.bc | llc -O3 -march=bpf -filetype=obj -o xdp
 else
        cat xdp.bc | llc -O3 -march=bpf -filetype=obj -o xdp