maxlen filter script: Add UCI support

This commit is contained in:
Marek Küthe 2023-04-11 22:58:02 +02:00
parent 1c0af810f3
commit 9a5e42bee5
No known key found for this signature in database
GPG Key ID: 7E869146699108C7
1 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,7 @@ if [ ! "$1" ]; then
echo ""
echo "Options:"
echo "babeld - [with-deny]"
echo "babeld-uci - [with-deny]"
echo "bird - [prefix-list]"
exit 1
fi
@ -35,6 +36,11 @@ for file in *.json; do
if [ "$2" == "with-deny" ]; then
filter="${filter}in ip $prefix deny\n"
fi
elif [ "$1" == "babeld-uci" ]; then
filter="${filter}config filter\n\toption 'type'\t'in'\n\toption 'ip'\t'$prefix'\n\toption 'le'\t'$maxlen'\n\toption 'action'\t'allow'\n\n"
if [ "$2" == "with-deny" ]; then
filter="${filter}config filter\n\toption 'type'\t'in'\n\toption 'ip'\t'$prefix'\n\toption 'action'\t'deny'\n\n"
fi
fi
done
done
@ -42,6 +48,8 @@ done
if [ "$filter" == "" ]; then
echo "Failed: Filter seems empty"
exit 1
elif [ "$1" == "babeld-uci" ]; then
filter=${filter::-4}
elif [ "$1" == "bird" ]; then
filter=${filter::-3}
elif [ "$1" == "babeld" ]; then