#!/bin/bash
cd /home/marla/ip/tmp
rm -f ipl0
while ! wget -q -O ipl0 'http://ip2.ludost.net/cgi/process?country=1&country_list=bg&format_template=prefix&format_name=&format_target=&format_default=' ; do sleep 2; done
rm -f ipt
for i in `grep -v \# ipl0`; do
        echo iptables -A bgpeer -s $i -j ACCEPT >> ipt
done    
nl=`cat ipt|wc -l`
if [ $nl -gt 100 ]; then
	iptables -F bgpeer
	sh ipt
	/etc/init.d/iptables save active
fi
