From: Martin Schwenke Date: Fri, 10 Apr 2026 01:22:19 +0000 (+1000) Subject: ctdb-scripts: Add an extra variable to help reviewers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ab11549c8c689a7be876408fa7fbee5411cf9c4;p=thirdparty%2Fsamba.git ctdb-scripts: Add an extra variable to help reviewers 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 Reviewed-by: John Mulligan --- diff --git a/ctdb/config/functions b/ctdb/config/functions index 581e5a29e68..c0cb2cc19ea 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -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