eventscripts: Fix regression in IP add/delete functions
authorMartin Schwenke <martin@meltin.net>
Fri, 14 Mar 2014 02:14:18 +0000 (13:14 +1100)
committerMartin Schwenke <martin@meltin.net>
Wed, 10 Dec 2014 04:04:29 +0000 (15:04 +1100)
Commit 176ae6c704528c021fcc34a41878584f43a00119 caused these functions
to exit on failure.  This is incorrect and broke NAT gateway.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(Imported from commit 058e14cdb0b6eb2e999dca599961ae6734105f99)

config/functions

index 268a172fe27fd1a360d0901011a23927bc385af3..23a395850e6acf75c70dfcd0dc3124b9923f3a2b 100755 (executable)
@@ -849,8 +849,10 @@ add_ip_to_iface ()
     ip link set "$_iface" up || \
        die "Failed to bringup interface $_iface"
 
-    ip addr add "$_ip/$_maskbits" brd + dev "$_iface" || \
-       die "Failed to add $_ip/$_maskbits on dev $_iface"
+    ip addr add "$_ip/$_maskbits" brd + dev "$_iface" || {
+       echo "Failed to add $_ip/$_maskbits on dev $_iface"
+       return 1
+    }
 }
 
 delete_ip_from_iface()
@@ -866,8 +868,10 @@ delete_ip_from_iface()
     # remembering and re-adding secondaries.
     set_proc "sys/net/ipv4/conf/${_iface}/promote_secondaries" 1
 
-    ip addr del "$_ip/$_maskbits" dev "$_iface" || \
-       die "Failed to del $_ip on dev $_iface"
+    ip addr del "$_ip/$_maskbits" dev "$_iface" || {
+       echo "Failed to del $_ip on dev $_iface"
+       return 1
+    }
 }
 
 # If the given IP is hosted then print 2 items: maskbits and iface