]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Add an extra variable to help reviewers
authorMartin Schwenke <mschwenke@ddn.com>
Fri, 10 Apr 2026 01:22:19 +0000 (11:22 +1000)
committerMartin Schwenke <martins@samba.org>
Thu, 16 Apr 2026 23:09:33 +0000 (23:09 +0000)
Using $_bcast to determine if the address is an IPv6 one is lazy.  It
causes anyone reading the code (including the original author) to have
to go back and confirm that the condition makes sense.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
ctdb/config/functions

index 581e5a29e68a6228eb997441cd52376c9d29041f..c0cb2cc19ea6d522bcb05576a510994f6cb6b73e 100755 (executable)
@@ -660,8 +660,14 @@ ip_addr_add()
 
        # Only need to define broadcast for IPv4
        case "$_ip" in
-       *:*) _bcast="" ;;
-       *) _bcast="brd +" ;;
+       *:*)
+               _bcast=""
+               _ipv6=true
+               ;;
+       *)
+               _bcast="brd +"
+               _ipv6=false
+               ;;
        esac
 
        # Intentionally unquoted multi-word value here
@@ -672,7 +678,7 @@ ip_addr_add()
        fi
 
        # Wait 5 seconds for IPv6 addresses to stop being tentative...
-       if [ -z "$_bcast" ]; then
+       if $_ipv6; then
                _ip="${_prefix%/*}"
                for _x in $(seq 1 10); do
                        ip addr show to "${_ip}/128" | grep -q "tentative" || break