From 565de03a784ed441490f8cd0b137b5cec8716d55 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 10 Nov 2010 14:40:43 +1100 Subject: [PATCH] delete from old interface before adding to new interface 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 --- config/events.d/10.interface | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config/events.d/10.interface b/config/events.d/10.interface index c6b871f8..5b31fb81 100755 --- a/config/events.d/10.interface +++ b/config/events.d/10.interface @@ -244,14 +244,13 @@ case "$1" in 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; } -- 2.34.1