1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0-or-later 3# Copyright (c) 2020 Oracle and/or its affiliates. All Rights Reserved. 4 5TST_NEEDS_CMDS="tc" 6TST_SETUP=setup 7TST_CLEANUP=cleanup 8TST_TESTFUNC=test 9TST_CNT=3 10 11. wireguard_lib.sh 12 13setup() 14{ 15 if tst_net_use_netns && [ "$VIRT_PERF_THRESHOLD" -lt 700 ]; then 16 tst_res TINFO "Adjust threshold for veth (no encap/encrypt)" 17 VIRT_PERF_THRESHOLD=700 18 fi 19 20 local netem_opt="reorder 30% 50% delay 1" 21 tst_res TINFO "Use netem $netem_opt" 22 ROD tc qdisc add dev $(tst_iface) root netem $netem_opt 23 wireguard_lib_setup 24} 25 26cleanup() 27{ 28 tc qdisc del dev $(tst_iface) root netem >/dev/null 2>&1 29 wireguard_lib_cleanup 30} 31 32test1() 33{ 34 tst_res TINFO "Using correct wireguard configuration" 35 virt_netperf_msg_sizes 36 wireguard_lib_cleanup 37} 38 39test2() 40{ 41 tst_res TINFO "Invalid configuration with allowed IPs" 42 wireguard_lib_setup invalid_allowed_ips 43 virt_minimize_timeout 44 virt_compare_netperf "fail" 45 wireguard_lib_cleanup 46} 47 48test3() 49{ 50 tst_res TINFO "Invalid configuration with public keys" 51 wireguard_lib_setup invalid_pub_keys 52 virt_minimize_timeout 53 virt_compare_netperf "fail" 54} 55 56tst_run 57