
if [ "$MODE" == "start" ]; then
	ips create dropset4 hash:net family inet
	ips create dropset4-local hash:net family inet
	ips create dropset6 hash:net family inet6
	ips create dropset6-local hash:net family inet6
fi

ipt4 -A in_inet -m set --match-set dropset4 src,dst -j DROP
ipt4 -A in_inet -m set --match-set dropset4-local src,dst -j DROP
ipt6 -A in_inet -m set --match-set dropset6 src,dst -j DROP
ipt6 -A in_inet -m set --match-set dropset6-local src,dst -j DROP

DROPLIST=/var/lib/droplist/drop.txt

if [ -f $DROPLIST ]; then
	ips flush dropset4
	cat "$DROPLIST" \
	| sed -e 's/;.*//' \
	| grep -v '^ *$' \
	| while read NB ; do
		ips add dropset4 "$NB"
	done
fi

DROPLIST6=/var/lib/droplist/drop6.txt

if [ -f $DROPLIST6 ]; then
	ips flush dropset6
	cat "$DROPLIST6" \
	| sed -e 's/;.*//' \
	| grep -v '^ *$' \
	| while read NB ; do
		ips add dropset6 "$NB"
	done
fi


LDROPLIST=/var/lib/droplist/3gdrop.txt

if [ -f $LDROPLIST ]; then
	ips flush dropset4-local
	cat "$LDROPLIST" \
	| sed -e 's/;.*//' \
	| grep -v '^ *$' \
	| while read NB ; do
		ips add dropset4-local "$NB"
	done
fi

LDROPLIST6=/var/lib/droplist/3gdrop6.txt

if [ -f $LDROPLIST6 ]; then
	ips flush dropset6-local
	cat "$LDROPLIST6" \
	| sed -e 's/;.*//' \
	| grep -v '^ *$' \
	| while read NB ; do
		ips add dropset6-local "$NB"
	done
fi
