diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-07-01 23:36:59 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-07-01 23:40:06 +0200 |
commit | 6f19ed45fe39c9b351cff1fc6b963e2e7c128417 (patch) | |
tree | b010f8b6a12ebbf790c90c3f3fc65bf1de6fe93c /contrib/stress-testing | |
parent | wg.8: wording tweaks (diff) | |
download | wireguard-monolithic-historical-6f19ed45fe39c9b351cff1fc6b963e2e7c128417.tar.xz wireguard-monolithic-historical-6f19ed45fe39c9b351cff1fc6b963e2e7c128417.zip |
contrib: remove extraneous cruft
We don't want people packaging these or even using these scripts, which
are only useful for limited development circumstances, so get rid of
them. More widespread development testing techniques still exist in
src/debug.mk and src/netns.sh
Diffstat (limited to 'contrib/stress-testing')
-rw-r--r-- | contrib/stress-testing/badpacket.c | 27 | ||||
-rw-r--r-- | contrib/stress-testing/peg.c | 50 | ||||
-rwxr-xr-x | contrib/stress-testing/self-send.sh | 48 | ||||
-rwxr-xr-x | contrib/stress-testing/threewayiperf.sh | 30 |
4 files changed, 0 insertions, 155 deletions
diff --git a/contrib/stress-testing/badpacket.c b/contrib/stress-testing/badpacket.c deleted file mode 100644 index eee61fc..0000000 --- a/contrib/stress-testing/badpacket.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <stdlib.h> -#include <unistd.h> -#include <arpa/inet.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <net/if.h> -#include <netinet/in.h> -#include <linux/limits.h> - -int main(int argc, char *argv[]) -{ - static const unsigned char handshake1[143] = { 1, 0 }; - int fd = socket(AF_INET, SOCK_DGRAM, 0); - struct sockaddr_in addr = { - .sin_family = AF_INET, - .sin_port = htons(atoi(argv[2])), - .sin_addr = inet_addr(argv[1]) - }; - connect(fd, (struct sockaddr *)&addr, sizeof(addr)); - - for (;;) - send(fd, handshake1, sizeof(handshake1), 0); - - close(fd); - - return 0; -} diff --git a/contrib/stress-testing/peg.c b/contrib/stress-testing/peg.c deleted file mode 100644 index 6b539fa..0000000 --- a/contrib/stress-testing/peg.c +++ /dev/null @@ -1,50 +0,0 @@ -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <net/if.h> -#include <netinet/in.h> -#include <linux/limits.h> -#include <time.h> -#include <stdio.h> -#include <string.h> - -static unsigned long long interface_tx_bytes(const char *interface) -{ - char buf[PATH_MAX]; - FILE *f; - unsigned long long ret; - snprintf(buf, PATH_MAX - 1, "/sys/class/net/%s/statistics/tx_bytes", interface); - f = fopen(buf, "r"); - fscanf(f, "%llu", &ret); - fclose(f); - return ret; -} - -int main(int argc, char *argv[]) -{ - char buf[1500] = { 0 }; - unsigned long long before, after, i; - struct timespec begin, end; - double elapsed; - struct ifreq req; - int fd = socket(AF_INET, SOCK_DGRAM, 0); - struct sockaddr_in addr = { - .sin_family = AF_INET, - .sin_port = htons(7271), - .sin_addr = inet_addr(argv[3]) - }; - strcpy(req.ifr_name, argv[1]); - ioctl(fd, SIOCGIFMTU, &req); - - connect(fd, (struct sockaddr *)&addr, sizeof(addr)); - - before = interface_tx_bytes(argv[2]); - clock_gettime(CLOCK_MONOTONIC, &begin); - for (i = 0; i < 10000000; ++i) - send(fd, buf, req.ifr_mtu - 28, 0); - clock_gettime(CLOCK_MONOTONIC, &end); - after = interface_tx_bytes(argv[2]); - elapsed = end.tv_sec - begin.tv_sec + (end.tv_nsec - begin.tv_nsec) / 1000000000.0; - - printf("%.4f mbps\n", ((after - before) * 8) / elapsed / 1000000.0); - return 0; -} diff --git a/contrib/stress-testing/self-send.sh b/contrib/stress-testing/self-send.sh deleted file mode 100755 index eb7947b..0000000 --- a/contrib/stress-testing/self-send.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -set -e - -PRIVATE_KEYS=("") -PUBLIC_KEYS=("") - -resetwg() { - for i in {1..64}; do - ip link delete dev wg${i} 2>/dev/null >/dev/null || true - done -} - -for i in {1..64}; do - next_key="$(wg genkey)" - PRIVATE_KEYS+=("$next_key") - PUBLIC_KEYS+=($(wg pubkey <<<"$next_key")) -done - -resetwg -trap resetwg INT TERM EXIT - -for i in {1..64}; do - { echo "[Interface]" - echo "ListenPort = $(( $i + 31222 ))" - echo "PrivateKey = ${PRIVATE_KEYS[$i]}" - - for j in {1..64}; do - [[ $i == $j ]] && continue - echo "[Peer]" - echo "PublicKey = ${PUBLIC_KEYS[$j]}" - echo "AllowedIPs = 192.168.8.${j}/32" - echo "Endpoint = 127.0.0.1:$(( $j + 31222 ))" - done - } > "/tmp/deviceload.conf" - - ip link add dev wg${i} type wireguard - wg setconf wg${i} "/tmp/deviceload.conf" - ip link set up dev wg${i} - rm "/tmp/deviceload.conf" -done - -ip address add dev wg1 192.168.8.1/24 - -while true; do - for i in {2..64}; do - echo hello | ncat -u 192.168.8.${i} 1234 - done -done diff --git a/contrib/stress-testing/threewayiperf.sh b/contrib/stress-testing/threewayiperf.sh deleted file mode 100755 index 932d666..0000000 --- a/contrib/stress-testing/threewayiperf.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -set -e - -if [[ $(hostname) == "thinkpad" ]]; then - make -C "$(dirname "$0")/../../src" remote-run - for i in 128 129 130; do - scp "$0" root@172.16.48.${i}: - done - for i in 128 129 130; do - konsole --new-tab -e ssh -t root@172.16.48.${i} "./$(basename "$0")" - done - exit -fi - -# perf top -U --dsos '[wireguard]' - -tmux new-session -s bigtest -d -tmux new-window -n "server 6000" -t bigtest "iperf3 -p 6000 -s" -tmux new-window -n "server 6001" -t bigtest "iperf3 -p 6001 -s" -sleep 5 -me=$(ip -o -4 address show dev wg0 | sed 's/.*inet \([^ ]*\)\/.*/\1/' | cut -d . -f 4) -for i in 1 2 3; do - [[ $i == $me ]] && continue - [[ $me == "1" ]] && port=6000 - [[ $me == "3" ]] && port=6001 - [[ $me == "2" && $i == "1" ]] && port=6000 - [[ $me == "2" && $i == "3" ]] && port=6001 - tmux new-window -n "client 192.168.2.${i}" -t bigtest "iperf3 -n 300000G -i 1 -p $port -c 192.168.2.${i}" -done -tmux attach -t bigtest |