From aa8ab8ed30776502af7b75a21d8e7c8701ba7615 Mon Sep 17 00:00:00 2001 From: Daniel Lenski Date: Mon, 19 Feb 2024 17:36:12 -0800 Subject: [PATCH] Expand no-ipv6-ocv3 test As added in c1a6f2b04a15ea0fecd51d0e7d38b3185268af67, this test verifies that ocserv will NOT send IPv6 routes to OpenConnect v3 clients, which can't handle them correctly. Additionally, we can also verify that ocserv DOES send IPv6 routes to totally unknown clients, which is the intended outcome resulting from 8b8a1a7b53aecc5ea1076c3288b817c8c9b04fde. Signed-off-by: Daniel Lenski --- tests/no-ipv6-ocv3 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/no-ipv6-ocv3 b/tests/no-ipv6-ocv3 index 5e51773e..a7b81f87 100755 --- a/tests/no-ipv6-ocv3 +++ b/tests/no-ipv6-ocv3 @@ -39,9 +39,6 @@ if test "$(id -u)" != "0";then exit 77 fi - -echo "Testing that ocserv doesn't assign IPv6 address on unknown clients... " - function finish { set +e echo " * Cleaning up..." @@ -67,6 +64,8 @@ fi ${CMDNS2} ${SERV} -p ${PIDFILE} -f -c ${CONFIG} ${DEBUG} & PID=$! wait_server $PID +echo "Testing that ocserv doesn't assign IPv6 address on (ancient) OpenConnect v3 clients... " + echo -n "Connecting to setup interface... " echo "test" | ${CMDNS1} timeout 15s $OPENCONNECT -v $ADDRESS:$PORT --useragent="Open AnyConnect VPN Agent v3" --passwd-on-stdin -u test --servercert=pin-sha256:xp3scfzy3rOQsv9NcOve/8YVVv+pHr4qNCXEXrNl5s8= -s /bin/true >${TMPFILE} 2>&1 @@ -75,7 +74,19 @@ echo ok cat ${TMPFILE}|grep X-CSTP-Split-Include|grep 'fd63:' >/dev/null if test $? = 0;then cat ${TMPFILE}|grep X-CSTP-Split - echo "Found route that shouldn't be there" + echo "Found IPv6 route that shouldn't be there" + exit 1 +fi + +echo "Testing that ocserv DOES assign IPv6 address on totally unknown clients... " + +echo -n "Connecting to setup interface... " +echo "test" | ${CMDNS1} timeout 15s $OPENCONNECT -v $ADDRESS:$PORT --useragent="/* An unknown user agent */" --passwd-on-stdin -u test --servercert=pin-sha256:xp3scfzy3rOQsv9NcOve/8YVVv+pHr4qNCXEXrNl5s8= -s /bin/true >${TMPFILE} 2>&1 + +cat ${TMPFILE}|grep X-CSTP-Split-Include|grep 'fd63:' >/dev/null +if test $? != 0;then + cat ${TMPFILE}|grep X-CSTP-Split + echo "Did not find IPv6 which SHOULD be there" exit 1 fi