]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Add an event script unit test for updateip
authorMartin Schwenke <mschwenke@ddn.com>
Wed, 15 Oct 2025 23:42:22 +0000 (10:42 +1100)
committerJule Anger <janger@samba.org>
Wed, 22 Oct 2025 09:51:19 +0000 (09:51 +0000)
This illustrates the current failure where an unassigned public IP
address causes updateip to fail.

After commit 0536d7a98b832fc00d26b09c26bf14fb63dbf5fb (which improves
IP address state checking), this will almost certainly not occur on
platforms with getifaddrs(3) (e.g. Linux).  This means it is only
likely to occur in 4.21 when net.ipv4.ip_nonlocal_bind=1.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15935

Reported-by: Bailey Allison <ballison@45drives.com>
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
(cherry picked from commit a98ffb96efc4a9ea2110c654860a4ba3896ab3d5)

ctdb/tests/UNIT/eventscripts/10.interface.updateip.001.sh [new file with mode: 0755]

diff --git a/ctdb/tests/UNIT/eventscripts/10.interface.updateip.001.sh b/ctdb/tests/UNIT/eventscripts/10.interface.updateip.001.sh
new file mode 100755 (executable)
index 0000000..af87bc1
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+define_test "error - update a non-existent ip"
+
+setup
+
+public_address=$(ctdb_get_1_public_address)
+ip="${public_address% *}"
+ip="${ip#* }"
+
+required_result 1 "ERROR: Unable to determine interface for IP ${ip}"
+# Want separate words from public_address: interface IP maskbits
+# shellcheck disable=SC2086
+simple_test "__none__" $public_address