CA_CERT="${top_srcdir}/sample/sample-keys/ca.crt"
CLIENT_KEY="${top_srcdir}/sample/sample-keys/client.key"
CLIENT_CERT="${top_srcdir}/sample/sample-keys/client.crt"
+
+# Load EXPECT_IFCONFIG* parameters from cache
+if [ -r "${top_srcdir}/t_client_ips.rc" ]; then
+ . "${top_srcdir}/t_client_ips.rc"
+else
+ echo "NOTICE: missing t_client_ips.rc will be auto-generated"
+fi
+
#
# remote host (used as macro below)
#
#
RUN_TITLE_1="testing tun/udp/ipv4+ipv6"
OPENVPN_CONF_1="$OPENVPN_BASE_P2MP --dev tun --proto udp --remote $REMOTE --port 51194"
-EXPECT_IFCONFIG4_1="10.100.50.6"
-EXPECT_IFCONFIG6_1="2001:db8:a050::1:0"
PING4_HOSTS_1="10.100.50.1 10.100.0.1"
PING6_HOSTS_1="2001:db8::1 2001:db8:a050::1"
#
RUN_TITLE_2="testing tun/tcp/ipv4+ipv6"
OPENVPN_CONF_2="$OPENVPN_BASE_P2MP --dev tun --proto tcp --remote $REMOTE --port 51194"
-EXPECT_IFCONFIG4_2="10.100.51.6"
-EXPECT_IFCONFIG6_2="2001:db8:a051::1:0"
PING4_HOSTS_2="10.100.51.1 10.100.0.1"
PING6_HOSTS_2="2001:db8::1 2001:db8:a051::1"
eval ping4_hosts=\"\$PING4_HOSTS_$SUF\"
eval ping6_hosts=\"\$PING6_HOSTS_$SUF\"
+ # If EXCEPT_IFCONFIG* variables for this test are missing, run an --up
+ # script to generate them dynamically.
+ if [ -z "$expect_ifconfig4" ] || [ -z "$expect_ifconfig6" ]; then
+ up="--setenv TESTNUM $SUF --setenv TOP_BUILDDIR ${top_builddir} --script-security 2 --up ${top_builddir}/tests/update_t_client_ips.sh"
+ fi
+
echo -e "\n### test run $SUF: '$test_run_title' ###\n"
fail_count=0
fi
pidfile="${top_builddir}/tests/$LOGDIR/openvpn-$SUF.pid"
- openvpn_conf="$openvpn_conf --writepid $pidfile"
+ openvpn_conf="$openvpn_conf --writepid $pidfile $up"
echo " run openvpn $openvpn_conf"
echo "# src/openvpn/openvpn $openvpn_conf" >$LOGDIR/$SUF:openvpn.log
umask 022
--- /dev/null
+#!/bin/sh
+#
+# This --up script caches the IPs handed out by the test VPN server to a file
+# for later use.
+
+echo "EXPECT_IFCONFIG4_$TESTNUM=$ifconfig_local" >> $TOP_BUILDDIR/t_client_ips.rc
+echo "EXPECT_IFCONFIG6_$TESTNUM=$ifconfig_ipv6_local" >> $TOP_BUILDDIR/t_client_ips.rc