this stops the script from failing with an error if
both interfaces are specified as the same, which otherwise breaks and leads to an infinite recovery loop
iptables -D INPUT -i $oiface -d $ip -j DROP 2> /dev/null
iptables -I INPUT -i $oiface -d $ip -j DROP
- # we make sure the interface is up first
- add_ip_to_iface $niface $ip $maskbits || {
+ delete_ip_from_iface $oiface $ip $maskbits || {
+ delete_ip_from_iface $niface $ip $maskbits
iptables -D INPUT -i $oiface -d $ip -j DROP 2> /dev/null
exit 1;
}
- delete_ip_from_iface $oiface $ip $maskbits || {
- delete_ip_from_iface $niface $ip $maskbits
+ add_ip_to_iface $niface $ip $maskbits || {
iptables -D INPUT -i $oiface -d $ip -j DROP 2> /dev/null
exit 1;
}