ctdb-eventscripts: Specify broadcast optionally to ip addr add
authorAmitay Isaacs <amitay@gmail.com>
Thu, 20 Nov 2014 10:58:31 +0000 (21:58 +1100)
committerMartin Schwenke <martins@samba.org>
Fri, 5 Dec 2014 20:02:40 +0000 (21:02 +0100)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/config/functions

index de373d6261aea18f41f4d49796080694ced04346..b9f3638a7d6164affa372f54c9ae5d7026da9636 100755 (executable)
@@ -859,7 +859,13 @@ add_ip_to_iface ()
     ip link set "$_iface" up || \
        die "Failed to bringup interface $_iface"
 
-    ip addr add "$_ip/$_maskbits" brd + dev "$_iface" || {
+    # Only need to define broadcast for IPv4
+    case "$ip" in
+        *:*) _bcast=""      ;;
+       *)   _bcast="brd +" ;;
+    esac
+
+    ip addr add "$_ip/$_maskbits" $_bcast dev "$_iface" || {
        echo "Failed to add $_ip/$_maskbits on dev $_iface"
        return 1
     }