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