X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=install.sh;h=58ae6709bbdc7a378965c2c33e0a77b634ad9459;hb=2400b2559ac2947300b90173a3fe25d632dba523;hp=d93664c4146c92015f0d6b07b40e5a6e3467fd34;hpb=fd5a4615a8c2684076a66389fc747be49f3e0b6c;p=flowspec-xdp diff --git a/install.sh b/install.sh index d93664c..58ae670 100755 --- a/install.sh +++ b/install.sh @@ -1,11 +1,11 @@ #!/bin/bash set -e -RULES="$(birdc show route table flowspec4) -$(birdc show route table flowspec6)" +RULES="$(birdc show route table flowspec4 primary all) +$(birdc show route table flowspec6 primary all)" echo "$RULES" | ./genrules.py --8021q=drop-vlan --v6frag=ignore-parse-if-rule --ihl=drop-options -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 +clang -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Wno-unused-variable -O3 -emit-llvm -c xdp.c -o - | llc -O3 -march=bpf -filetype=obj -o xdp echo "Before unload drop count was:" ./dropcount.sh || echo "Not loaded" @@ -13,4 +13,9 @@ echo "Before unload drop count was:" ip link set "$1" xdp off ip link set "$1" xdpgeneric off # Note that sometimes the automated fallback does not work properly so we have to || generic here -ip link set "$1" xdp obj xdp sec xdp_drop || ip link set "$1" xdpgeneric obj xdp sec xdp_drop +ip link set "$1" xdpoffload obj xdp sec xdp_drop || ( + echo "Failed to install in NIC, testing in driver..." && ip link set "$1" xdpdrv obj xdp sec xdp_drop || ( + echo "Failed to install in driver, using generic..." && ip link set "$1" xdpgeneric obj xdp sec xdp_drop + ) +) +echo "$RULES" | grep "^flow. {" > installed-rules.txt