wireguard01.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. TST_NEEDS_CMDS="tc"
  5. TST_SETUP=setup
  6. TST_CLEANUP=cleanup
  7. TST_TESTFUNC=test
  8. TST_CNT=3
  9. . wireguard_lib.sh
  10. setup()
  11. {
  12. if [ -n "$LTP_NETNS" -a "$VIRT_PERF_THRESHOLD" -lt 700 ]; then
  13. tst_res TINFO "Adjust threshold for veth (no encap/encrypt)"
  14. VIRT_PERF_THRESHOLD=700
  15. fi
  16. local netem_opt="reorder 30% 50% delay 1"
  17. tst_res TINFO "Use netem $netem_opt"
  18. ROD tc qdisc add dev $(tst_iface) root netem $netem_opt
  19. wireguard_lib_setup
  20. }
  21. cleanup()
  22. {
  23. tc qdisc del dev $(tst_iface) root netem >/dev/null 2>&1
  24. wireguard_lib_cleanup
  25. }
  26. test1()
  27. {
  28. tst_res TINFO "Using correct wireguard configuration"
  29. virt_netperf_msg_sizes
  30. wireguard_lib_cleanup
  31. }
  32. test2()
  33. {
  34. tst_res TINFO "Invalid configuration with allowed IPs"
  35. wireguard_lib_setup invalid_allowed_ips
  36. virt_minimize_timeout
  37. virt_compare_netperf "fail"
  38. wireguard_lib_cleanup
  39. }
  40. test3()
  41. {
  42. tst_res TINFO "Invalid configuration with public keys"
  43. wireguard_lib_setup invalid_pub_keys
  44. virt_minimize_timeout
  45. virt_compare_netperf "fail"
  46. }
  47. tst_run