#!/bin/sh # shellcheck disable=SC1090 . "$TESTLIB_PATH" require_root "$0" "$@" test -e /dev/net/tun || exit "$EXIT_SKIP_TEST" ip netns list || exit "$EXIT_SKIP_TEST" command -v socat || exit "$EXIT_SKIP_TEST" ip_foo=192.168.1.1 ip_bar=192.168.1.2 port_foo=30100 recv_port_foo=30101 mask=24 echo '[STEP] Determining supported compression levels' features=$(tincd foo --version) bogus_levels="-1 13" levels=0 add_levels() { algo=$1 shift if echo "$features" | grep "comp_$algo"; then levels="$levels $*" else bogus_levels="$bogus_levels $*" fi } add_levels zlib 1 2 3 4 5 6 7 8 9 add_levels lzo 10 11 add_levels lz4 12 echo "Supported compression levels: $levels" echo "Unsupported compression levels: $bogus_levels" echo [STEP] Create network namespaces ip netns add foo ip netns add bar tmp_file=$(mktemp) cleanup_hook() { ip netns del foo ip netns del bar rm -f "$tmp_file" } echo [STEP] Initialize two nodes tinc foo <&1) if ! echo "$output" | grep -q 'Bogus compression level'; then bail 'expected message about the wrong compression level' fi done