[Openvpn-devel,v2] t_client.sh.in: Check whether addresses are in "tentative" state

Message ID 20261009161741.79370-1-frank@lichtenheld.com
State New
Headers
Series [Openvpn-devel,v2] t_client.sh.in: Check whether addresses are in "tentative" state |

Commit Message

Frank Lichtenheld Oct. 9, 2026, 4:17 p.m. UTC
  We see this sometimes with IPv6 addresses (especially
in t_server context). Make sure we wait until the
tentative state is removed. Otherwise we might get
spurious failures on comparing state.

Change-Id: I07b373851175d865abdb1513f90655b3fa31d5fa
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1882
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1882
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <razvanc@mailbox.org>
  

Patch

diff --git a/tests/t_client.sh.in b/tests/t_client.sh.in
index 0568007..5e924bb 100755
--- a/tests/t_client.sh.in
+++ b/tests/t_client.sh.in
@@ -264,6 +264,27 @@ 
 }
 
 # ----------------------------------------------------------
+# check ifconfig output on whether some address is in "tentative" state
+# repeats calling get_ifconfig_route until it does not
+#  arg1: log file
+check_tentative_state()
+{
+    logfile="$1"
+    network_tentative_check=0
+    while grep -q tentative $logfile; do
+        output "waiting for tentative state to end ($network_tentative_check)"
+        if [ "$network_tentative_check" -ge 30 ]; then
+            fail "network interface stuck in tentative state"
+            return 1
+        fi
+        sleep 1
+        network_tentative_check=$((network_tentative_check + 1))
+        get_ifconfig_route >$logfile
+    done
+    return 0
+}
+
+# ----------------------------------------------------------
 # check ifconfig
 #  arg1: "4" or "6" -> for message
 #  arg2: IPv4/IPv6 address that must show up in out of "get_ifconfig_route"
@@ -392,6 +413,10 @@ 
 
     output "save pre-openvpn ifconfig + route"
     get_ifconfig_route >$LOGDIR/$SUF:ifconfig_route_pre.txt
+    if ! check_tentative_state $LOGDIR/$SUF:ifconfig_route_pre.txt; then
+        printf "$outbuf"
+        exit 1
+    fi
 
     output "\nrun pre-openvpn ping tests - targets must not be reachable..."
     run_ping_tests 4 want_fail "$ping4_hosts"
@@ -498,6 +523,10 @@ 
     # compare whether anything changed in ifconfig/route setup?
     output "save ifconfig+route"
     get_ifconfig_route >$LOGDIR/$SUF:ifconfig_route.txt
+    if ! check_tentative_state $LOGDIR/$SUF:ifconfig_route.txt; then
+        printf "$outbuf"
+        exit 1
+    fi
 
     if [ "$expect_ifconfig4" = "-" ]; then
         output "skip ifconfig+route check"
@@ -535,6 +564,10 @@ 
 
     output "\nsave post-openvpn ifconfig + route..."
     get_ifconfig_route >$LOGDIR/$SUF:ifconfig_route_post.txt
+    if ! check_tentative_state $LOGDIR/$SUF:ifconfig_route_post.txt; then
+        printf "$outbuf"
+        exit 1
+    fi
 
     output -n "compare pre- and post-openvpn ifconfig + route..."
     if diff $LOGDIR/$SUF:ifconfig_route_pre.txt \