From: "cron2 (Code Review)" Date: Sat, 8 Mar 2025 08:55:03 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., samuli@...515..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="ypwZKy2vWtU="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Add lwip support to t_server_null List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mattock , plaisthos , flichtenheld Cc: openvpn-devel --ypwZKy2vWtU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#12) to the change originally created b= y mattock. ( http://gerrit.openvpn.net/c/openvpn/+/811?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by flichtenheld Change subject: Add lwip support to t_server_null ...................................................................... Add lwip support to t_server_null Change-Id: Ie63f302402f469c3aa48ac146ca6b8c029f0d250 Signed-off-by: Samuli Sepp=C3=A4nen Acked-by: Frank Lichtenheld Message-Id: <20250305134642.196598-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 019.html Signed-off-by: Gert Doering --- M doc/t_server_null.rst A tests/lwip_client_up.sh M tests/t_server_null_client.sh M tests/t_server_null_default.rc 4 files changed, 163 insertions(+), 13 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/11/811/12 diff --git a/doc/t_server_null.rst b/doc/t_server_null.rst index 5fe9080..473a7bd 100644 --- a/doc/t_server_null.rst +++ b/doc/t_server_null.rst @@ -16,7 +16,7 @@ * Parallelized for fairly high performance * Mostly operating-system agnostic -* Tested on Fedora Linux 38/39/40 and FreeBSD 14 +* Tested on Fedora Linux 38/39/40, FreeBSD 14, NetBSD 10.0 and OpenBSD 7.5 * POSIX-compliant * Tested and known to work with Bash, Dash, Ksh, Yash and FreeBSD's defaul= t /bin/sh * Uses the sample certificates and keys @@ -31,6 +31,7 @@ * Test cases (client configurations) and server setups (server configurati= ons) are stored in a configuration file, i.e. data and code have been separ= ated * Configuration file format is nearly identical to t_client.rc configurati= on * Supports a set of default tests, overriding default test settings and ad= ding local tests +* Supports client ping tests if ovpnlwip is available Prerequisites ------------- @@ -60,8 +61,9 @@ #. Server instances start #. Brief wait #. Client instances start -#. Tests run +#. ovpnlwip ping tests run #. Client instances stop +#. Test results are collected #. Brief wait #. Server instances stop @@ -77,7 +79,8 @@ * t_server_null_client.sh - * Waits until servers have launched. Then launch all clients, wait f= or them to exit and then check test results by parsing the client log files= . Each client kills itself after some delay using an "--up" script. + * Waits until servers have launched. Then launch all clients, run ov= pnlwip ping tests (if any), wait for clients to exit and then check test re= sults by parsing the client log files. Each client kills itself after some = delay using an "--up" script. + Configuration ------------- @@ -116,6 +119,19 @@ TEST_RUN_LIST=3D"1 2 5 9" +Client ping tests that use ovpnlwip can be added similarly: + + TEST_NAME_9L=3D"t_server_null_client.sh-openvpn_current_udp_custom_lwip" + SHOULD_PASS_9L=3D"yes" + CLIENT_EXEC_9L=3D"${CLIENT_EXEC}" + CLIENT_CONF_9L=3D"${CLIENT_CONF_BASE_LWIP} --remote 127.0.0.1 1194 udp -= -proto udp" + +Note that all ovpnlwip test names need to include a "_lwip" suffix: withou= t it +ping tests won't get activated. Also note that the *tests* directory needs= to +have the lwipovpn executable or ovpnlwip tests will get skipped. The ovpnl= wip +ping tests get the IP addresses to ping from the \*.ips files created by t= he +lwip_client_up.sh script --up script. + Stress-testing the --dev null test suite ---------------------------------------- diff --git a/tests/lwip_client_up.sh b/tests/lwip_client_up.sh new file mode 100755 index 0000000..a6b4d24 --- /dev/null +++ b/tests/lwip_client_up.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Determine the OpenVPN PID from its pid file. This works reliably even wh= en +# the OpenVPN process is backgrounded for parallel tests. +MY_PPID=3D`cat $pid` + +# Add this client's VPN IP and PID to a file. This enables +# t_server_null_client.sh to kill this OpenVPN client after fping tests ha= ve +# finished. +echo "$ifconfig_local,$MY_PPID" >> ./$test_name.lwip + +# Wait long enough to allow fping tests to finish. Also ensure that this +# OpenVPN client is killed even if t_server_null_client.sh failed to do it. +(sleep 15 +echo "ERROR: t_server_null_client.sh failed to kill OpenVPN client with PI= D $MY_PPID in test $test_name. Killing it in lwip_client_up.sh." +kill -15 $MY_PPID +) & diff --git a/tests/t_server_null_client.sh b/tests/t_server_null_client.sh index 2210e63..1745de5 100755 --- a/tests/t_server_null_client.sh +++ b/tests/t_server_null_client.sh @@ -1,5 +1,17 @@ #!/bin/sh +should_run_test() { + test_name=3D"$1" + + if echo "$test_name"|grep -q _lwip; then + if [ "$has_lwipovpn" =3D "no" ]; then + return 1 + fi + fi + + return 0 +} + launch_client() { test_name=3D$1 log=3D"${test_name}.log" @@ -13,10 +25,65 @@ "${client_exec}" \ $client_conf \ --writepid "${pid}" \ - --setenv pid $pid \ + --setenv pid "$pid" \ + --setenv test_name "$test_name" \ --log "${t_server_null_logdir}/${log}" & } +ping_and_kill() { + if fping -q -c 5 $1; then + echo "PASS: fping lwipovpn client $target" + else + echo "FAIL: fping lwipovpn client $target" + + # This function runs multiple times in parallel in subshells. That + # makes it hard to implement "fail the test suite if any single fp= ing + # test fails" using exit codes or variables given the limitations = of + # "wait". Therefore we use a marker file here, which solves the + # problem trivially. + touch ./lwip_failed + fi + kill -15 $2 +} + +ping_lwip_clients() { + if [ "$has_lwipovpn" =3D "yes" ]; then + lwip_client_count=3D$(echo "$lwip_test_names"|wc -w|tr -d " ") + else + lwip_client_count=3D0 + fi + + if [ $lwip_client_count -eq 0 ]; then + return 0 + fi + + count=3D0 + maxcount=3D10 + while [ $count -le $maxcount ]; do + lwip_client_ips=3D$(cat ./*.lwip 2>/dev/null|wc -l) + if [ $lwip_client_ips -lt $lwip_client_count ]; then + echo "Waiting for LWIP clients to start up ($count/$maxcount)" + count=3D$(( count + 1)) + sleep 1 + else + echo "$lwip_client_ips/$lwip_client_count LWIP clients up" + break + fi + done + + wait_pids=3D"" + for line in $(cat ./*.lwip 2>/dev/null); do + target_ip=3D$(echo $line|cut -d "," -f 1) + client_pid=3D$(echo $line|cut -d "," -f 2) + ping_and_kill $target_ip $client_pid & + wait_pids=3D"$wait_pids $!" + done + + wait $wait_pids + + test -e ./lwip_failed && return 1 || return 0 +} + wait_for_results() { tests_running=3D"yes" @@ -77,7 +144,7 @@ server_max_wait=3D15 while [ $count -lt $server_max_wait ]; do servers_up=3D0 - server_count=3D$(echo $TEST_SERVER_LIST|wc -w) + server_count=3D$(echo "$TEST_SERVER_LIST"|wc -w|tr -d " ") # We need to trim single-quotes because some shells return quoted valu= es # and some don't. Using "set -o posix" which would resolve this proble= m is @@ -85,8 +152,8 @@ # # While inactive server configurations may get checked they won't incr= ease # the active server count as the processes won't be running. - for i in `set|grep 'SERVER_NAME_'|cut -d "=3D" -f 2|tr -d "[\']"`; do - server_pid=3D$(cat $i.pid 2> /dev/null) + for i in $(set|grep 'SERVER_NAME_'|cut -d "=3D" -f 2|tr -d "[\']"); do + server_pid=3D$(cat "$i.pid" 2> /dev/null) if [ -z "$server_pid" ] ; then continue fi @@ -111,6 +178,19 @@ fi done +# Check for presence of the lwipovpn executable +if test -r "$LWIPOVPN_PATH"; then + has_lwipovpn=3D"yes" +else + has_lwipovpn=3D"no" + echo "WARNING: lwipovpn executable is missing: lwip tests will be skip= ped" +fi + +# Remove existing LWIP client IP files. This is to avoid pinging non-exist= ent +# IP addresses when tests are disabled. +rm -f ./*.lwip +rm -f ./lwip_failed + # Wait a while to let server processes to settle down sleep 1 @@ -118,6 +198,7 @@ # is used later to determine when all OpenVPN clients have exited and it is # safe to check the test results. test_names=3D"" +lwip_test_names=3D"" for SUF in $TEST_RUN_LIST do eval test_name=3D\"\$TEST_NAME_$SUF\" @@ -125,9 +206,20 @@ eval client_conf=3D\"\$CLIENT_CONF_$SUF\" test_names=3D"${test_names} ${test_name}" - (launch_client "${test_name}" "${client_exec}" "${client_conf}") + + if echo "$test_name"|grep -q _lwip; then + lwip_test_names=3D"${lwip_test_names} ${test_name}" + fi + + if should_run_test "$test_name"; then + (launch_client "${test_name}" "${client_exec}" "${client_conf}") + fi done +ping_lwip_clients +retval=3D$? + + # Wait until all OpenVPN clients have exited (wait_for_results) @@ -137,7 +229,9 @@ eval test_name=3D\"\$TEST_NAME_$SUF\" eval should_pass=3D\"\$SHOULD_PASS_$SUF\" - get_client_test_result "${test_name}" "${should_pass}" + if should_run_test "$test_name"; then + get_client_test_result "${test_name}" "${should_pass}" + fi done exit $retval diff --git a/tests/t_server_null_default.rc b/tests/t_server_null_default.rc index cbf4877..e7bf5bc 100755 --- a/tests/t_server_null_default.rc +++ b/tests/t_server_null_default.rc @@ -20,6 +20,15 @@ SERVER_KEY=3D"${sample_keys}/server.key" TA=3D"${sample_keys}/ta.key" +# This parameter can't be overridden in t_server_null.rc because that gets +# loaded too late. However, you can use +# +# LWIPOVPN_PATH=3D/some/path/to/lwipovpn make check +# +# to run the tests using lwipovpn in a custom location +# +LWIPOVPN_PATH=3D"${LWIPOVPN_PATH:-lwipovpn}" + # Used to detect if graceful kill of any server instance failed during the= test # run SERVER_KILL_FAIL_FILE=3D".t_server_null_server.kill_failed" @@ -28,7 +37,7 @@ MAX_CLIENTS=3D"10" CLIENT_MATCH=3D"Test-Client" SERVER_EXEC=3D"${top_builddir}/src/openvpn/openvpn" -SERVER_BASE_OPTS=3D"--daemon --local 127.0.0.1 --dev tun --topology subnet= --max-clients $MAX_CLIENTS --persist-tun --verb 3" +SERVER_BASE_OPTS=3D"--daemon --local 127.0.0.1 --dev tun --topology subnet= --max-clients $MAX_CLIENTS --persist-tun --verb 3 --duplicate-cn" SERVER_CIPHER_OPTS=3D"" SERVER_CERT_OPTS=3D"--ca ${CA} --dh ${DH} --cert ${SERVER_CERT} --key ${SE= RVER_KEY} --tls-auth ${TA} 0" SERVER_CONF_BASE=3D"${SERVER_BASE_OPTS} ${SERVER_CIPHER_OPTS} ${SERVER_CER= T_OPTS}" @@ -49,23 +58,37 @@ # Test client configurations CLIENT_EXEC=3D"${top_builddir}/src/openvpn/openvpn" -CLIENT_BASE_OPTS=3D"--client --dev null --ifconfig-noexec --nobind --remot= e-cert-tls server --persist-tun --verb 3 --resolv-retry infinite --connect-= retry-max 3 --server-poll-timeout 5 --explicit-exit-notify 3 --script-secur= ity 2 --up ${srcdir}/null_client_up.sh" +CLIENT_BASE_OPTS=3D"--client --nobind --remote-cert-tls server --persist-t= un --verb 3 --resolv-retry infinite --connect-retry-max 3 --server-poll-tim= eout 5 --explicit-exit-notify 3 --script-security 2" +CLIENT_NULL_OPTS=3D"--dev null --ifconfig-noexec --up ${srcdir}/null_clien= t_up.sh" +CLIENT_LWIP_OPTS=3D"--dev null --dev-node unix:${LWIPOVPN_PATH} --up ${src= dir}/lwip_client_up.sh" + CLIENT_CIPHER_OPTS=3D"" CLIENT_CERT_OPTS=3D"--ca ${CA} --cert ${CLIENT_CERT} --key ${CLIENT_KEY} -= -tls-auth ${TA} 1" -TEST_RUN_LIST=3D"1 2 3" -CLIENT_CONF_BASE=3D"${CLIENT_BASE_OPTS} ${CLIENT_CIPHER_OPTS} ${CLIENT_CER= T_OPTS}" +TEST_RUN_LIST=3D"1 1L 2 2L 3" +CLIENT_CONF_BASE=3D"${CLIENT_NULL_OPTS} ${CLIENT_BASE_OPTS} ${CLIENT_CIPHE= R_OPTS} ${CLIENT_CERT_OPTS}" +CLIENT_CONF_BASE_LWIP=3D"${CLIENT_LWIP_OPTS} ${CLIENT_BASE_OPTS} ${CLIENT_= CIPHER_OPTS} ${CLIENT_CERT_OPTS}" TEST_NAME_1=3D"t_server_null_client.sh-openvpn_current_udp" SHOULD_PASS_1=3D"yes" CLIENT_EXEC_1=3D"${CLIENT_EXEC}" CLIENT_CONF_1=3D"${CLIENT_CONF_BASE} --remote 127.0.0.1 1194 udp --proto u= dp" +TEST_NAME_1L=3D"t_server_null_client.sh-openvpn_current_udp_lwip" +SHOULD_PASS_1L=3D"yes" +CLIENT_EXEC_1L=3D"${CLIENT_EXEC}" +CLIENT_CONF_1L=3D"${CLIENT_CONF_BASE_LWIP} --remote 127.0.0.1 1194 udp --p= roto udp" + TEST_NAME_2=3D"t_server_null_client.sh-openvpn_current_tcp" SHOULD_PASS_2=3D"yes" CLIENT_EXEC_2=3D"${CLIENT_EXEC}" CLIENT_CONF_2=3D"${CLIENT_CONF_BASE} --remote 127.0.0.1 1195 tcp --proto t= cp" +TEST_NAME_2L=3D"t_server_null_client.sh-openvpn_current_tcp_lwip" +SHOULD_PASS_2L=3D"yes" +CLIENT_EXEC_2L=3D"${CLIENT_EXEC}" +CLIENT_CONF_2L=3D"${CLIENT_CONF_BASE_LWIP} --remote 127.0.0.1 1195 tcp --p= roto tcp" + TEST_NAME_3=3D"t_server_null_client.sh-openvpn_current_udp_fail" SHOULD_PASS_3=3D"no" CLIENT_EXEC_3=3D"${CLIENT_EXEC}" -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/811?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie63f302402f469c3aa48ac146ca6b8c029f0d250 Gerrit-Change-Number: 811 Gerrit-PatchSet: 12 Gerrit-Owner: mattock Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: mattock Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --ypwZKy2vWtU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #12 to the change originally c= reated by mattock.

View Change

The following approvals got outdated = and were removed: Code-Review+2 by flichtenheld

Add lwip support to t_server_null

Chan= ge-Id: Ie63f302402f469c3aa48ac146ca6b8c029f0d250
Signed-off-by: Samuli S= epp=C3=A4nen <samuli.seppanen@...277...>
Acked-by: Frank Lichtenhe= ld <frank@...2641...>
Message-Id: <20250305134642.196598-1-fran= k@...2641...>
URL: https://www.mail-archive.com/openvpn-devel@...1096...= ourceforge.net/msg31019.html
Signed-off-by: Gert Doering <gert@...1826...= 6...>
---
M doc/t_server_null.rst
A tests/lwip_client_up.sh
= M tests/t_server_null_client.sh
M tests/t_server_null_default.rc
4 fi= les changed, 163 insertions(+), 13 deletions(-)

git pull ssh://ge=
rrit.openvpn.net:29418/openvpn refs/changes/11/811/12
diff --git a/=
doc/t_server_null.rst b/doc/t_server_null.rst
index 5fe9080= ..473a7bd 100644
--- a/doc/t_server_null.rst
+++ b/doc/t_server_null.rst
@@ -16,7 +16,7 @@
<= span>
* Parallelized for fairly high performance * Mostly operating-system agnostic
-* Tested on Fedora Linux 38/39/40 and FreeBSD 14

+* Tested on Fedora Linux= 38/39/40, FreeBSD 14, NetBSD 10.0 and OpenBSD 7.5
* POSIX= -compliant
* Tested and known to work with Bash, Dash, Ksh= , Yash and FreeBSD's default /bin/sh
* Uses the sample= certificates and keys
@@ -31,6 +31,7 @@
*= Test cases (client configurations) and server setups (server configuration= s) are stored in a configuration file, i.e. data and code have been separat= ed
* Configuration file format is nearly identical to t_cl= ient.rc configuration
* Supports a set of default tests, o= verriding default test settings and adding local tests
+* Supports client ping tests if ovpnlwip= is available

Prerequisites
-------------
@@ -60,8 +61,9 @@
#. Se= rver instances start
#. Brief wait
#. Cli= ent instances start
-#.= Tests run
+#. ovpnlw= ip ping tests run
#. Client instances stop
+#. Test results are collected
#. Brief wait
#. Server instances stop<= br>
@@ -77,7 +79,8 @@

* t_server_null_client.sh

- * Waits until servers have launched. = Then launch all clients, wait for them to exit and then check test results = by parsing the client log files. Each client kills itself after some delay = using an "--up" script.
+ * Waits until servers have launched. Then launch all cl= ients, run ovpnlwip ping tests (if any), wait for clients to exit and then = check test results by parsing the client log files. Each client kills itsel= f after some delay using an "--up" script.
+

Confi= guration
-------------
@@ -116,6 +119,19 @= @

TEST_RUN_LIST=3D"1 2 5 9"<= /span>

+Cl= ient ping tests that use ovpnlwip can be added similarly:
+
+ TEST_NAME_9L=3D"t_server_null_client.sh-openvpn_c= urrent_udp_custom_lwip"
+ SHOULD_PASS_9L=3D"yes"
+ CLIENT_EXEC_9L=3D"${CLIENT_EXEC}"
+ CLIENT_CONF_9L=3D"= ${CLIENT_CONF_BASE_LWIP} --remote 127.0.0.1 1194 udp --proto udp"
+
+Note that all ovpnlwip test names need to= include a "_lwip" suffix: without it
+ping tests won't get activated. Also note t= hat the *tests* directory needs to
+have the lwipovpn executable or ovpnlwip tests will get skip= ped. The ovpnlwip
+pi= ng tests get the IP addresses to ping from the \*.ips files created by the<= /span>
+lwip_client_up.sh sc= ript --up script.
+
Stress-testing the --dev null test suite
-= ---------------------------------------

d= iff --git a/tests/lwip_client_up.sh b/tests/lwip_client_up.sh
new file mode 100755

index 0000000..a6b4d24
--- /dev/null

+++ b/tests/lwip_client_up.sh
<= span>@@ -0,0 +1,17 @@

+#!/bin/sh
+#=
+# Determine the OpenVPN PI= D from its pid file. This works reliably even when
+# the OpenVPN process is backgrounded for pa= rallel tests.
+MY_PPI= D=3D`cat $pid`
+
+# Add this client's = VPN IP and PID to a file. This enables
+# t_server_null_client.sh to kill this OpenVPN client af= ter fping tests have
= +# finished.
+echo &q= uot;$ifconfig_local,$MY_PPID" >> ./$test_name.lwip
+

+# Wait long enough to allow fping tests to finish. A= lso ensure that this
= +# OpenVPN client is killed even if t_server_null_client.sh failed to do it= .
+(sleep 15+echo "ERROR: t_server_n= ull_client.sh failed to kill OpenVPN client with PID $MY_PPID in test $test= _name. Killing it in lwip_client_up.sh."
+kill -15 $MY_PPID
+) &
diff --git a/tests/t_server= _null_client.sh b/tests/t_server_null_client.sh
index 2210e= 63..1745de5 100755
--- a/tests/t_server_null_client.sh
+++ b/tests/t_server_null_client.sh
@@ -1,5 +1,= 17 @@
#!/bin/sh

+should_run_test() {
+ test_name=3D"$1"
+

+ if echo "$test_name"|grep -q _lwip; th= en
+ if [ &quo= t;$has_lwipovpn" =3D "no" ]; then
+ return 1
+ fi
+ fi
+
+ return = 0
+}
+
launch_client() {<= /span>
test_name=3D$1
log=3D"${test= _name}.log"
@@ -13,10 +25,65 @@
&= quot;${client_exec}" \
$client_conf \<= br> --writepid "${pid}" \
- --setenv pid $pid \
+ --setenv pid "$pid" \=
+ --setenv te= st_name "$test_name" \
--log "${t_s= erver_null_logdir}/${log}" &
}
<= /span>
+ping_and_kill() {

+ if fping -q -c 5 $= 1; then
+ echo= "PASS: fping lwipovpn client $target"
+ else
+ echo "FAIL: fping lwipovpn client $target&qu= ot;
+
+ # This function runs multip= le times in parallel in subshells. That
+ # makes it hard to implement "fail the tes= t suite if any single fping
+ # test fails" using exit codes or variables given the = limitations of
+ = # "wait". Therefore we use a marker file here, which solves t= he
+ # problem= trivially.
+ = touch ./lwip_failed
+= fi
+ kill -15 = $2
+}
+
+ping_lwip_clients() {
+ if [ "$has_lwipovpn" =3D "yes&quo= t; ]; then
+ l= wip_client_count=3D$(echo "$lwip_test_names"|wc -w|tr -d " &= quot;)
+ else
+ lwip_client_coun= t=3D0
+ fi<= br>+
+ if [ $lwip_client_count -eq 0 ]; then
+ return 0<= br>+ fi
+
+ count=3D0
+ maxcount=3D10
+ while [ $count -le $maxcount ]; do
+ lwip_client_ips=3D$(cat ./*.lwip 2>/d= ev/null|wc -l)
+ = if [ $lwip_client_ips -lt $lwip_client_count ]; then
+ echo "Waiting for LWIP= clients to start up ($count/$maxcount)"
+ count=3D$(( count + 1))
+ sleep 1

+ else

+ echo "$lwip_client_ips/= $lwip_client_count LWIP clients up"
+ break
+ fi
+ done
+<= /span>
+ wait_pids=3D&quo= t;"
+ for lin= e in $(cat ./*.lwip 2>/dev/null); do
+ target_ip=3D$(echo $line|cut -d "," -= f 1)
+ client_= pid=3D$(echo $line|cut -d "," -f 2)
+ ping_and_kill $target_ip $client_pid &= ;
+ wait_pids= =3D"$wait_pids $!"
+ done
+
+ wait $wait_pids
+
+ test -e ./lwip_failed && ret= urn 1 || return 0
+}<= /span>
+
wa= it_for_results() {
tests_running=3D"yes"

@@ -77,7 +144,7 @@
server_m= ax_wait=3D15
while [ $count -lt $server_max_wait ]; do
servers_up=3D0
- server_count=3D$(echo $TEST_SERVER_LIST|wc -w)
+ server_count=3D$(echo "$= TEST_SERVER_LIST"|wc -w|tr -d " ")

<= br> # We need to trim single-quotes because some shells return qu= oted values
# and some don't. Using "set -o p= osix" which would resolve this problem is
@@ -85,8 +15= 2,8 @@
#
# While inactive server = configurations may get checked they won't increase
= # the active server count as the processes won't be running.- for i in `set|grep 'SER= VER_NAME_'|cut -d "=3D" -f 2|tr -d "[\']"`; do<= /span>
- server_pid=3D$= (cat $i.pid 2> /dev/null)
+ for i in $(set|grep 'SERVER_NAME_'|cut -d "=3D&qu= ot; -f 2|tr -d "[\']"); do
+ server_pid=3D$(cat "$i.pid" 2> /d= ev/null)
if [ -z "$server_pid" ] ; then<= /span>
continue
fi@@ -111,6 +178,19 @@
fi
done

+# C= heck for presence of the lwipovpn executable
+if test -r "$LWIPOVPN_PATH"; then=
+ has_lwipovpn=3D"y= es"
+else=
+ has_lwipovpn=3D"n= o"
+ echo &qu= ot;WARNING: lwipovpn executable is missing: lwip tests will be skipped"= ;
+fi
+

+# Remove existing LWIP client IP files. This is to avo= id pinging non-existent
+# IP addresses when tests are disabled.
+rm -f ./*.lwip
+rm -f ./lwip_failed
+
# Wait a while to let server processes= to settle down
sleep 1

= @@ -118,6 +198,7 @@
# is used later to determine when all = OpenVPN clients have exited and it is
# safe to check the = test results.
test_names=3D""
+lwip_test_names=3D""<= br> for SUF in $TEST_RUN_LIST
do
= eval test_name=3D\"\$TEST_NAME_$SUF\"
@@ -125,9= +206,20 @@
eval client_conf=3D\"\$CLIENT_CONF_$S= UF\"

test_names=3D"${test_= names} ${test_name}"
- (launch_client "${test_name}" "${client_exec}" = "${client_conf}")
+
+ if echo= "$test_name"|grep -q _lwip; then
+ lwip_test_names=3D"${lwip_test_names} = ${test_name}"
+ = fi
+
+ if should_run_test "$tes= t_name"; then

+ = (launch_client "${test_name}" "${client_exec}" &= quot;${client_conf}")
+ fi
done

+ping_lwip_clients
+retval=3D$?
+
+
# Wait until all OpenVPN clients have exited

(wait_for_results)

@@ -137,7 = +229,9 @@
eval test_name=3D\"\$TEST_NAME_$SUF\&qu= ot;
eval should_pass=3D\"\$SHOULD_PASS_$SUF\"= ;

- = get_client_test_result "${test_name}" "${should_pass}"= ;
+ if should_run_= test "$test_name"; then
+ get_client_test_result "${test_name}" "= ;${should_pass}"
+ fi
done

exit $ret= val
diff --git a/tests/t_server_null_default.rc b/tests/t_s= erver_null_default.rc
index cbf4877..e7bf5bc 100755<= br>--- a/tests/t_server_null_default.rc
+++ b/tests/t= _server_null_default.rc
@@ -20,6 +20,15 @@
= SERVER_KEY=3D"${sample_keys}/server.key"
TA=3D&= quot;${sample_keys}/ta.key"

+# This parameter can't be overridden in = t_server_null.rc because that gets
+# loaded too late. However, you can use
+#
+# LWIPOVPN_PATH=3D/some/path/to/lwipovpn make check=
+#
+# to run the tests using lwipovpn in a custo= m location
+#<= br>+LWIPOVPN_PATH=3D"${LWI= POVPN_PATH:-lwipovpn}"
+
# Used to detect if graceful kill of any server i= nstance failed during the test
# run
SERV= ER_KILL_FAIL_FILE=3D".t_server_null_server.kill_failed"@@ -28,7 +37,7 @@
MAX_CLIENTS=3D"10"
CLIENT_MATCH=3D"Test-Client"
SERVER= _EXEC=3D"${top_builddir}/src/openvpn/openvpn"
-SERVER_BASE_OPTS=3D"--daemon --local= 127.0.0.1 --dev tun --topology subnet --max-clients $MAX_CLIENTS --persist= -tun --verb 3"
+= SERVER_BASE_OPTS=3D"--daemon --local 127.0.0.1 --dev tun --topology su= bnet --max-clients $MAX_CLIENTS --persist-tun --verb 3 --duplicate-cn"=
SERVER_CIPHER_OPTS=3D""
SERVER= _CERT_OPTS=3D"--ca ${CA} --dh ${DH} --cert ${SERVER_CERT} --key ${SERV= ER_KEY} --tls-auth ${TA} 0"
SERVER_CONF_BASE=3D"= ${SERVER_BASE_OPTS} ${SERVER_CIPHER_OPTS} ${SERVER_CERT_OPTS}"<= br>@@ -49,23 +58,37 @@

# Test clie= nt configurations
CLIENT_EXEC=3D"${top_builddir}/src/= openvpn/openvpn"
-= CLIENT_BASE_OPTS=3D"--client --dev null --ifconfig-noexec --nobind --r= emote-cert-tls server --persist-tun --verb 3 --resolv-retry infinite --conn= ect-retry-max 3 --server-poll-timeout 5 --explicit-exit-notify 3 --script-s= ecurity 2 --up ${srcdir}/null_client_up.sh"
+CLIENT_BASE_OPTS=3D"--client --nobind --r= emote-cert-tls server --persist-tun --verb 3 --resolv-retry infinite --conn= ect-retry-max 3 --server-poll-timeout 5 --explicit-exit-notify 3 --script-s= ecurity 2"
+CLIE= NT_NULL_OPTS=3D"--dev null --ifconfig-noexec --up ${srcdir}/null_clien= t_up.sh"
+CLIENT= _LWIP_OPTS=3D"--dev null --dev-node unix:${LWIPOVPN_PATH} --up ${srcdi= r}/lwip_client_up.sh"
+
CLIENT_CIPHER_OPTS=3D""
= CLIENT_CERT_OPTS=3D"--ca ${CA} --cert ${CLIENT_CERT} --key ${CLIENT_K= EY} --tls-auth ${TA} 1"

-TEST_RUN_LIST=3D"1 2 3"
-CLIENT_CONF_BASE=3D"${CLIENT_BASE= _OPTS} ${CLIENT_CIPHER_OPTS} ${CLIENT_CERT_OPTS}"
+TEST_RUN_LIST=3D"1 1L 2 2L 3"<= /span>
+CLIENT_CONF_BASE=3D&= quot;${CLIENT_NULL_OPTS} ${CLIENT_BASE_OPTS} ${CLIENT_CIPHER_OPTS} ${CLIENT= _CERT_OPTS}"
+CL= IENT_CONF_BASE_LWIP=3D"${CLIENT_LWIP_OPTS} ${CLIENT_BASE_OPTS} ${CLIEN= T_CIPHER_OPTS} ${CLIENT_CERT_OPTS}"

= TEST_NAME_1=3D"t_server_null_client.sh-openvpn_current_udp"
SHOULD_PASS_1=3D"yes"
CLIENT_EXEC_1= =3D"${CLIENT_EXEC}"
CLIENT_CONF_1=3D"${CLIE= NT_CONF_BASE} --remote 127.0.0.1 1194 udp --proto udp"

+TEST_NAME_1L=3D&q= uot;t_server_null_client.sh-openvpn_current_udp_lwip"
+SHOULD_PASS_1L=3D"yes"
+CLIENT_EXEC_1L=3D"= ${CLIENT_EXEC}"
= +CLIENT_CONF_1L=3D"${CLIENT_CONF_BASE_LWIP} --remote 127.0.0.1 1194 ud= p --proto udp"
+=
TEST_NAME_2=3D"t_server_null_client.sh-openvpn_curre= nt_tcp"
SHOULD_PASS_2=3D"yes"
CLIENT_EXEC_2=3D"${CLIENT_EXEC}"

CLIENT_CONF= _2=3D"${CLIENT_CONF_BASE} --remote 127.0.0.1 1195 tcp --proto tcp"= ;

+= TEST_NAME_2L=3D"t_server_null_client.sh-openvpn_current_tcp_lwip"=
+SHOULD_PASS_2L=3D&q= uot;yes"
+CLIENT= _EXEC_2L=3D"${CLIENT_EXEC}"
+CLIENT_CONF_2L=3D"${CLIENT_CONF_BASE_LWIP} --remote = 127.0.0.1 1195 tcp --proto tcp"
+
TEST_NAME_3=3D"t_server_null_client= .sh-openvpn_current_udp_fail"
SHOULD_PASS_3=3D"n= o"
CLIENT_EXEC_3=3D"${CLIENT_EXEC}"<= br>

To view, visit change 811. To unsubscribe, or for h= elp writing mail filters, visit settings.

<= /div>
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie63f302402f469c3aa48ac146ca= 6b8c029f0d250
Gerrit-Change-Number: 811
Gerrit-PatchSet: 12
Gerrit-Owner: mattock <samuli@...515...>=
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: mattock <samuli@...515...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--ypwZKy2vWtU=--