Add default installer script
[flowspec-xdp] / install.sh
1 #!/bin/bash
2 set -e
3
4 RULES="$(birdc show route table flowspec4)
5 $(birdc show route table flowspec6)"
6
7 echo "$RULES" | ./genrules.py --8021q=drop-vlan --v6frag=ignore-parse-if-rule --ihl=drop-options
8 clang -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Wno-unused-variable -Os -emit-llvm -c xdp.c -o - | llc -march=bpf -filetype=obj -o xdp
9
10 echo "Before unload drop count was:"
11 ./dropcount.sh || echo "Not loaded"
12
13 ip link set "$1" xdp off
14 ip link set "$1" xdpgeneric off
15 # Note that sometimes the automated fallback does not work properly so we have to || generic here
16 ip link set "$1" xdp obj xdp sec xdp_drop || ip link set "$1" xdpgeneric obj xdp sec xdp_drop