1f08c3bdfSopenharmony_ci#!/bin/sh 2f08c3bdfSopenharmony_ci# SPDX-License-Identifier: GPL-2.0-or-later 3f08c3bdfSopenharmony_ci# Copyright (c) 2022 Petr Vorel <pvorel@suse.cz> 4f08c3bdfSopenharmony_ci# Copyright (c) 2020 Oracle and/or its affiliates. All Rights Reserved. 5f08c3bdfSopenharmony_ci 6f08c3bdfSopenharmony_ciTST_CLEANUP=cleanup 7f08c3bdfSopenharmony_ciTST_TESTFUNC=test1 8f08c3bdfSopenharmony_ciTST_SETUP=wireguard_lib_setup 9f08c3bdfSopenharmony_ci 10f08c3bdfSopenharmony_ciIPSEC_MODE="tunnel" 11f08c3bdfSopenharmony_ciIPSEC_PROTO="esp_aead" 12f08c3bdfSopenharmony_ciAEALGO="rfc4106_256" 13f08c3bdfSopenharmony_ciEALGO="aes" 14f08c3bdfSopenharmony_ciAALGO="sha256" 15f08c3bdfSopenharmony_ci 16f08c3bdfSopenharmony_cicleanup() 17f08c3bdfSopenharmony_ci{ 18f08c3bdfSopenharmony_ci wireguard_lib_cleanup 19f08c3bdfSopenharmony_ci tst_ipsec_cleanup 20f08c3bdfSopenharmony_ci} 21f08c3bdfSopenharmony_ci 22f08c3bdfSopenharmony_citest1() 23f08c3bdfSopenharmony_ci{ 24f08c3bdfSopenharmony_ci local wgaddr 25f08c3bdfSopenharmony_ci local clients_num="$TST_NETLOAD_CLN_NUMBER" 26f08c3bdfSopenharmony_ci 27f08c3bdfSopenharmony_ci # Enforce multi-threading test, at least with 10 TCP clients 28f08c3bdfSopenharmony_ci [ $clients_num -lt 10 ] && clients_num=10 29f08c3bdfSopenharmony_ci 30f08c3bdfSopenharmony_ci tst_res TINFO "test wireguard" 31f08c3bdfSopenharmony_ci 32f08c3bdfSopenharmony_ci [ -n "$TST_IPV6" ] && wgaddr="$ip6_virt_remote" || wgaddr="$ip_virt_remote" 33f08c3bdfSopenharmony_ci tst_netload -H $wgaddr -a $clients_num -D ltp_v0 34f08c3bdfSopenharmony_ci local time_wg=$(cat tst_netload.res) 35f08c3bdfSopenharmony_ci wireguard_lib_cleanup 36f08c3bdfSopenharmony_ci 37f08c3bdfSopenharmony_ci tst_res TINFO "test IPSec $IPSEC_MODE/$IPSEC_PROTO $EALGO" 38f08c3bdfSopenharmony_ci tst_ipsec_setup_vti 39f08c3bdfSopenharmony_ci tst_netload -H $ip_rmt_tun -a $clients_num -D $tst_vti 40f08c3bdfSopenharmony_ci local time_ipsec=$(cat tst_netload.res) 41f08c3bdfSopenharmony_ci tst_ipsec_cleanup 42f08c3bdfSopenharmony_ci 43f08c3bdfSopenharmony_ci tst_netload_compare $time_ipsec $time_wg -100 44f08c3bdfSopenharmony_ci} 45f08c3bdfSopenharmony_ci 46f08c3bdfSopenharmony_ci. ipsec_lib.sh 47f08c3bdfSopenharmony_ci. wireguard_lib.sh 48f08c3bdfSopenharmony_citst_run 49