git: 956a46311462 - main - if_ovpn tests: fix ra test

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 05 Oct 2023 09:54:42 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=956a46311462423f97b2410065f8caff2c630701

commit 956a46311462423f97b2410065f8caff2c630701
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2023-10-05 07:41:25 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2023-10-05 07:48:49 +0000

    if_ovpn tests: fix ra test
    
    Client one is supposed to be assigend 198.51.100.2, but sometimes it
    loses the race and the address ends up assigned to client two. When this
    happened one would try to ping itself, which failed because the loopback
    interface isn't up.
    
    Ideally we'd generate static address assignments, but that would
    complicate the test. Activate loopback interfaces so the test always
    passes, and just try to ping both possible addresses.
    
    MFC after:      1 week
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/net/if_ovpn/if_ovpn.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh
index c052a6d7eb47..bbaffa0bce73 100644
--- a/tests/sys/net/if_ovpn/if_ovpn.sh
+++ b/tests/sys/net/if_ovpn/if_ovpn.sh
@@ -805,14 +805,18 @@ ra_body()
 	ifconfig ${bridge} addm ${two}a
 
 	vnet_mkjail srv ${srv}b ${lan}a
+	jexec srv ifconfig lo0 inet 127.0.0.1/8 up
 	jexec srv ifconfig ${srv}b 192.0.2.1/24 up
 	jexec srv ifconfig ${lan}a 203.0.113.1/24 up
 	vnet_mkjail lan ${lan}b
+	jexec lan ifconfig lo0 inet 127.0.0.1/8 up
 	jexec lan ifconfig ${lan}b 203.0.113.2/24 up
 	jexec lan route add default 203.0.113.1
 	vnet_mkjail one ${one}b
+	jexec one ifconfig lo0 inet 127.0.0.1/8 up
 	jexec one ifconfig ${one}b 192.0.2.2/24 up
 	vnet_mkjail two ${two}b
+	jexec two ifconfig lo0 inet 127.0.0.1/8 up
 	jexec two ifconfig ${two}b 192.0.2.3/24 up
 
 	# Sanity checks
@@ -890,7 +894,9 @@ ra_body()
 
 	# Client-to-client communication
 	atf_check -s exit:0 -o ignore jexec one ping -c 1 198.51.100.3
+	atf_check -s exit:0 -o ignore jexec one ping -c 1 198.51.100.2
 	atf_check -s exit:0 -o ignore jexec two ping -c 1 198.51.100.2
+	atf_check -s exit:0 -o ignore jexec two ping -c 1 198.51.100.3
 
 	# RA test
 	atf_check -s exit:0 -o ignore jexec one ping -c 1 203.0.113.1