diff --git a/scripts/dtls13.test b/scripts/dtls13.test index 30bcd079a..2d6f58714 100755 --- a/scripts/dtls13.test +++ b/scripts/dtls13.test @@ -24,6 +24,7 @@ trap cleanup err exit WOLFSSL_ROOT=${WOLFSSL_ROOT:-$(pwd)} UDP_PROXY_BIN=${UDP_PROXY_BIN:-"udp_proxy"} +DTLS_VERSION=${DTLS_VERSION:-"-v4"} PROXY_PORT=1234 SERVER_PORT=4321 KEY_UPDATE_SIZE=35 @@ -37,13 +38,13 @@ prepend() { # Usage: cmd 2>&1 | prepend "sometext " } run_test() { # usage: run_test "" "" "" - stdbuf -oL -eL $WOLFSSL_ROOT/examples/server/server -u -p$SERVER_PORT $2 2>&1 | prepend "[server] " & + stdbuf -oL -eL $WOLFSSL_ROOT/examples/server/server -u -p$SERVER_PORT $DTLS_VERSION $2 2>&1 | prepend "[server] " & SERVER_PID=$! stdbuf -oL -eL $UDP_PROXY_BIN -p $PROXY_PORT -s 127.0.0.1:$SERVER_PORT -u $1 2>&1 | prepend "[udp-proxy] " & UDP_PROXY_PID=$(($! - 1)) echo "UDP-proxy: $UDP_PROXY_PID" sleep 0.2 - timeout -s KILL 5m stdbuf -oL -eL $WOLFSSL_ROOT/examples/client/client -u -p$PROXY_PORT $3 2>&1 | prepend "[client] " + timeout -s KILL 5m stdbuf -oL -eL $WOLFSSL_ROOT/examples/client/client -u -p$PROXY_PORT $DTLS_VERSION $3 2>&1 | prepend "[client] " if [ $? != 0 ]; then echo "Test failed" ((NUM_TESTS_FAILED++)) @@ -58,20 +59,20 @@ run_test() { # usage: run_test "" "" " test_dropping_packets () { for i in $(seq 3 11);do echo -e "\ndropping ${i}th packet\n" - run_test "-d $i" "-v4 -Ta" "-v4" + run_test "-d $i" "-Ta" "" done # dropping last ack would be client error as wolfssl_read doesn't support WANT_WRITE as returned error for i in $(seq 0 10);do echo -e "\nTesting WANT_WRITE: dropping packet $i\n" - run_test "-f $i" "-v4 -Ta -6" "-v4 -6" + run_test "-f $i" "-Ta -6" "-6" done } # this test is based on detecting newSessionTicket message by its size. This is rather fragile. test_dropping_new_session_ticket() { # usage: test_dropping_new_session_ticket echo -e "\ndropping new session ticket packet of size $1\n" - run_test "-F $1" "-v4 -w" "-v4 -w --waitTicket" + run_test "-F $1" "-w" "-w --waitTicket" } test_permutations () { @@ -86,7 +87,7 @@ EOF echo -e "\nTesting $SIDE permutations order $i...\n" UDP_LOGFILE=/tmp/udp-$SIDE-$i rm -f $UDP_LOGFILE - run_test "-r $i -S $SIDE -l $UDP_LOGFILE" "-v4 -Ta -w" "-v4 -w" + run_test "-r $i -S $SIDE -l $UDP_LOGFILE" "-Ta -w" "-w" echo "...produced $(grep -P 'client:|server:' $UDP_LOGFILE | wc -l) messages" done echo "All $SIDE msg permutations succeeded" @@ -108,13 +109,13 @@ EOF echo -e "\nTesting delay $DELAY...\n" UDP_LOGFILE=/tmp/udp-delay-$DELAY rm -f $UDP_LOGFILE - run_test "-l $UDP_LOGFILE -t $DELAY" "-v4 -Ta -w" "-v4 -w" + run_test "-l $UDP_LOGFILE -t $DELAY" "-Ta -w" "-w" echo "...produced $(grep -P 'client:|server:' $UDP_LOGFILE | wc -l) messages" done } echo "Starting capture" -tcpdump -i lo -n port ${SERVER_PORT} -w ./dtls.pcap -U & +tcpdump -i lo -n port ${SERVER_PORT} -w ./dtls${DTLS_VERSION}.pcap -U & TCPDUMP_PID=$! test_dropping_packets