#!/bin/sh
# load encap.txt into ipipfilter list
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
cd /var/lib/ampr-ripd || exit 1
#ipset -N ipipfilter hash:ip 2>/dev/null
#ipset flush ipipfilter
#ipset -A ipipfilter 169.228.34.84
nft flush set inet fw4 ipipfilter
nft add element inet fw4 ipipfilter { 169.228.34.84 }
grep addprivate encap.txt | sed -e 's/.*encap //' | sort -u | while read ip
do
nft add element inet fw4 ipipfilter { $ip }
done