upstream: 1.18
This commit is contained in:
parent
8e468ffc54
commit
cf5509bd45
85 changed files with 7208 additions and 24731 deletions
|
|
@ -15,8 +15,6 @@ TESTS = \
|
|||
|
||||
dist_check_SCRIPTS = $(TESTS)
|
||||
|
||||
EXTRA_DIST = testlib.sh
|
||||
|
||||
AM_CFLAGS = -iquote.
|
||||
|
||||
check_PROGRAMS = \
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.16.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -107,7 +107,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(dist_check_SCRIPTS) \
|
|||
$(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_FILES = testlib.sh
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am_splice_OBJECTS = splice.$(OBJEXT)
|
||||
splice_OBJECTS = $(am_splice_OBJECTS)
|
||||
|
|
@ -349,6 +349,7 @@ am__set_TESTS_bases = \
|
|||
bases='$(TEST_LOGS)'; \
|
||||
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
|
||||
bases=`echo $$bases`
|
||||
AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)'
|
||||
RECHECK_LOGS = $(TEST_LOGS)
|
||||
AM_RECURSIVE_TARGETS = check recheck
|
||||
TEST_SUITE_LOG = test-suite.log
|
||||
|
|
@ -369,8 +370,8 @@ am__set_b = \
|
|||
*) \
|
||||
b='$*';; \
|
||||
esac
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
|
||||
$(top_srcdir)/test-driver
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/testlib.sh.in \
|
||||
$(top_srcdir)/depcomp $(top_srcdir)/test-driver
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
|
|
@ -498,7 +499,6 @@ TESTS = \
|
|||
variables.test
|
||||
|
||||
dist_check_SCRIPTS = $(TESTS)
|
||||
EXTRA_DIST = testlib.sh
|
||||
AM_CFLAGS = -iquote.
|
||||
splice_SOURCES = splice.c
|
||||
all: all-am
|
||||
|
|
@ -534,6 +534,8 @@ $(top_srcdir)/configure: $(am__configure_deps)
|
|||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
testlib.sh: $(top_builddir)/config.status $(srcdir)/testlib.sh.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
|
||||
clean-checkPROGRAMS:
|
||||
-test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
|
||||
|
|
@ -731,7 +733,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
|
|||
test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
|
||||
fi; \
|
||||
echo "$${col}$$br$${std}"; \
|
||||
echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
|
||||
echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \
|
||||
echo "$${col}$$br$${std}"; \
|
||||
create_testsuite_report --maybe-color; \
|
||||
echo "$$col$$br$$std"; \
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ read pid rest <$d1/pid
|
|||
(sleep 0.1; kill \$pid) &
|
||||
EOF
|
||||
|
||||
cat >$d1/tinc-up.cmd <<EOF
|
||||
start /min ../$tinc $c1 stop
|
||||
EOF
|
||||
|
||||
# Test tincd command line options that should work
|
||||
|
||||
$tincd $c1 $r1 -D
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ EOF
|
|||
|
||||
# Generate an invitation offline and let another node join the VPN
|
||||
|
||||
invitation=`$tinc $c1 invite bar`
|
||||
invitation=`$tinc $c1 invite bar | sed 's/\r//'`
|
||||
|
||||
$tinc $c1 start $r1
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,17 @@ echo Route = 1.2.3.4 1234:: >>\$INVITATION_FILE
|
|||
$tinc $c1 export >>\$INVITATION_FILE
|
||||
EOF
|
||||
|
||||
cat >$d1/invitation-created.cmd <<EOF
|
||||
echo Name = %NODE% >%INVITATION_FILE%
|
||||
echo Ifconfig = 93.184.216.34/24 >>%INVITATION_FILE%
|
||||
echo Route = 2606:2800:220:1::/64 2606:2800:220:1:248:1893:25c8:1946 >>%INVITATION_FILE%
|
||||
echo Route = 1.2.3.4 1234:: >>%INVITATION_FILE%
|
||||
$tinc $c1 export >>%INVITATION_FILE%
|
||||
EOF
|
||||
|
||||
chmod u+x $d1/invitation-created
|
||||
|
||||
$tinc $c1 invite bar | $tinc $c2 --batch join
|
||||
$tinc $c1 invite bar | tail -1 | $tinc $c2 --batch join
|
||||
|
||||
# Test equivalence of host config files
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Skip this test if the legacy protocol is disabled
|
||||
if grep -q "define DISABLE_LEGACY 1" "${0%/*}/../config.h"; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
. "${0%/*}/testlib.sh"
|
||||
|
||||
# Initialize two nodes
|
||||
|
|
|
|||
|
|
@ -11,10 +11,11 @@ ip netns list || exit 77
|
|||
|
||||
$tinc $c1 <<EOF
|
||||
init foo
|
||||
set Mode switch
|
||||
set Subnet 192.168.1.1
|
||||
set Interface ping.test1
|
||||
set Port 32577
|
||||
set Address localhost
|
||||
set AutoConnect no
|
||||
EOF
|
||||
|
||||
cat >$d1/tinc-up <<EOF
|
||||
|
|
@ -27,9 +28,10 @@ EOF
|
|||
|
||||
$tinc $c2 <<EOF
|
||||
init bar
|
||||
set Mode switch
|
||||
set Subnet 192.168.1.2
|
||||
set Interface ping.test2
|
||||
set Port 32574
|
||||
set AutoConnect no
|
||||
EOF
|
||||
|
||||
cat >$d2/tinc-up <<EOF
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
. "${0%/*}/testlib.sh"
|
||||
|
||||
echo Initializing node...
|
||||
|
||||
# Initialize server node
|
||||
|
||||
$tinc $c1 <<EOF
|
||||
|
|
@ -15,6 +17,8 @@ EOF
|
|||
|
||||
# Set up scripts
|
||||
|
||||
echo Setting up scripts...
|
||||
|
||||
OUT=$d1/scripts.out
|
||||
rm -f $OUT
|
||||
|
||||
|
|
@ -24,24 +28,37 @@ cat >$d1/$script << EOF
|
|||
echo $script \$NETNAME,\$NAME,\$DEVICE,\$IFACE,\$NODE,\$REMOTEADDRESS,\$REMOTEPORT,\$SUBNET,\$WEIGHT,\$INVITATION_FILE,\$INVITATION_URL,\$DEBUG >>$OUT
|
||||
EOF
|
||||
chmod u+x $d1/$script
|
||||
|
||||
cat >$d1/$script.cmd << EOF
|
||||
echo $script %NETNAME%,%NAME%,%DEVICE%,%IFACE%,%NODE%,%REMOTEADDRESS%,%REMOTEPORT%,%SUBNET%,%WEIGHT%,%INVITATION_FILE%,%INVITATION_URL%,%DEBUG% >>$OUT
|
||||
EOF
|
||||
done
|
||||
|
||||
# Start server node
|
||||
|
||||
$tinc -n netname $c1 start $r1
|
||||
echo Starting server node...
|
||||
|
||||
$tinc $c1 -n netname start $r1
|
||||
|
||||
echo foo-started >>$OUT
|
||||
|
||||
# Invite client node
|
||||
|
||||
url=`$tinc -n netname2 $c1 invite bar`
|
||||
echo Inviting client node...
|
||||
|
||||
url=`$tinc $c1 -n netname2 invite bar | sed 's/\r//'`
|
||||
file=`cd $d1/invitations; ls | grep -v ed25519_key.priv`
|
||||
echo bar-invited >>$OUT
|
||||
$tinc -n netname3 $c2 join $url
|
||||
|
||||
echo Joining client node...
|
||||
|
||||
$tinc $c2 -n netname3 join $url
|
||||
echo bar-joined >>$OUT
|
||||
|
||||
# Start and stop client node
|
||||
|
||||
echo Starting client node...
|
||||
|
||||
$tinc $c2 << EOF
|
||||
set DeviceType dummy
|
||||
set Port 32760
|
||||
|
|
@ -109,4 +126,5 @@ subnet-down netname,foo,dummy,,foo,,,fec0::/64,,,,5
|
|||
tinc-down netname,foo,dummy,,,,,,,,,5
|
||||
EOF
|
||||
|
||||
sed -i 's/\r//' $OUT
|
||||
cmp $OUT $OUT.expected
|
||||
|
|
|
|||
|
|
@ -17,16 +17,26 @@
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include "../src/system.h"
|
||||
|
||||
#ifdef HAVE_MINGW
|
||||
extern const char *winerror(int);
|
||||
static const char *winerror(int err) {
|
||||
static char buf[1024], *ptr;
|
||||
|
||||
ptr = buf + snprintf(buf, sizeof(buf), "(%d) ", err);
|
||||
|
||||
if(!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), ptr, sizeof(buf) - (ptr - buf), NULL)) {
|
||||
strncpy(buf, "(unable to format errormessage)", sizeof(buf));
|
||||
};
|
||||
|
||||
if((ptr = strchr(buf, '\r'))) {
|
||||
*ptr = '\0';
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
#define strerror(x) ((x)>0?strerror(x):winerror(GetLastError()))
|
||||
#define sockerrno WSAGetLastError()
|
||||
#define sockstrerror(x) winerror(x)
|
||||
|
|
|
|||
|
|
@ -2,23 +2,28 @@
|
|||
|
||||
# Paths to executables
|
||||
|
||||
tincd=../src/tincd
|
||||
tinc=../src/tinc
|
||||
sptps_test=../src/sptps_test
|
||||
sptps_keypair=../src/sptps_keypair
|
||||
tincd=../src/tincd@EXEEXT@
|
||||
tinc=../src/tinc@EXEEXT@
|
||||
sptps_test=../src/sptps_test@EXEEXT@
|
||||
sptps_keypair=../src/sptps_keypair@EXEEXT@
|
||||
|
||||
# Test directories
|
||||
|
||||
scriptname=`basename $0`
|
||||
d1=$PWD/$scriptname.1
|
||||
d2=$PWD/$scriptname.2
|
||||
d3=$PWD/$scriptname.3
|
||||
|
||||
n1=$scriptname.1
|
||||
n2=$scriptname.2
|
||||
n3=$scriptname.3
|
||||
|
||||
d1=$PWD/$n1
|
||||
d2=$PWD/$n2
|
||||
d3=$PWD/$n3
|
||||
|
||||
# Default arguments for both tinc and tincd
|
||||
|
||||
c1="--config=$d1 --pidfile=$d1/pid"
|
||||
c2="--config=$d2 --pidfile=$d2/pid"
|
||||
c3="--config=$d3 --pidfile=$d3/pid"
|
||||
c1="-n $n1 --config=$d1 --pidfile=$d1/pid"
|
||||
c2="-n $n2 --config=$d2 --pidfile=$d2/pid"
|
||||
c3="-n $n3 --config=$d3 --pidfile=$d3/pid"
|
||||
|
||||
# Arguments when running tincd
|
||||
|
||||
|
|
@ -5,18 +5,18 @@
|
|||
# Initialize one node
|
||||
|
||||
$tinc $c1 init foo
|
||||
test "`$tinc $c1 get Name`" = "foo"
|
||||
test "`$tinc $c1 get Name | sed 's/\r//'`" = "foo"
|
||||
|
||||
# Test case sensitivity
|
||||
|
||||
$tinc $c1 set Mode switch
|
||||
test "`$tinc $c1 get Mode`" = "switch"
|
||||
test "`$tinc $c1 get mode`" = "switch"
|
||||
test "`$tinc $c1 get Mode | sed 's/\r//'`" = "switch"
|
||||
test "`$tinc $c1 get mode | sed 's/\r//'`" = "switch"
|
||||
$tinc $c1 set mode router
|
||||
test "`$tinc $c1 get Mode`" = "router"
|
||||
test "`$tinc $c1 get mode`" = "router"
|
||||
test "`$tinc $c1 get Mode | sed 's/\r//'`" = "router"
|
||||
test "`$tinc $c1 get mode | sed 's/\r//'`" = "router"
|
||||
$tinc $c1 set Mode Switch
|
||||
test "`$tinc $c1 get Mode`" = "Switch"
|
||||
test "`$tinc $c1 get Mode | sed 's/\r//'`" = "Switch"
|
||||
|
||||
# Test deletion
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ test -z "`$tinc $c1 get Mode`"
|
|||
|
||||
$tinc $c1 add Mode switch
|
||||
$tinc $c1 add Mode hub
|
||||
test "`$tinc $c1 get Mode`" = "hub"
|
||||
test "`$tinc $c1 get Mode | sed 's/\r//'`" = "hub"
|
||||
|
||||
# Test addition/deletion of multivalued variables
|
||||
|
||||
|
|
@ -36,11 +36,11 @@ $tinc $c1 add Subnet 1
|
|||
$tinc $c1 add Subnet 2
|
||||
$tinc $c1 add Subnet 2
|
||||
$tinc $c1 add Subnet 3
|
||||
test "`$tinc $c1 get Subnet`" = "1
|
||||
test "`$tinc $c1 get Subnet | sed 's/\r//'`" = "1
|
||||
2
|
||||
3"
|
||||
$tinc $c1 del Subnet 2
|
||||
test "`$tinc $c1 get Subnet`" = "1
|
||||
test "`$tinc $c1 get Subnet | sed 's/\r//'`" = "1
|
||||
3"
|
||||
$tinc $c1 del Subnet
|
||||
test -z "`$tinc $c1 get Subnet`"
|
||||
|
|
@ -56,17 +56,17 @@ touch $d1/hosts/bar
|
|||
|
||||
$tinc $c1 add bar.PMTU 1
|
||||
$tinc $c1 add bar.PMTU 2
|
||||
test "`$tinc $c1 get bar.PMTU`" = "2"
|
||||
test "`$tinc $c1 get bar.PMTU | sed 's/\r//'`" = "2"
|
||||
|
||||
$tinc $c1 add bar.Subnet 1
|
||||
$tinc $c1 add bar.Subnet 2
|
||||
$tinc $c1 add bar.Subnet 2
|
||||
$tinc $c1 add bar.Subnet 3
|
||||
test "`$tinc $c1 get bar.Subnet`" = "1
|
||||
test "`$tinc $c1 get bar.Subnet | sed 's/\r//'`" = "1
|
||||
2
|
||||
3"
|
||||
$tinc $c1 del bar.Subnet 2
|
||||
test "`$tinc $c1 get bar.Subnet`" = "1
|
||||
test "`$tinc $c1 get bar.Subnet | sed 's/\r//'`" = "1
|
||||
3"
|
||||
$tinc $c1 del bar.Subnet
|
||||
test -z "`$tinc $c1 get bar.Subnet`"
|
||||
|
|
@ -81,6 +81,6 @@ $tinc $c1 set qu-ux.Subnet 1 && exit 1 || true
|
|||
|
||||
$tinc $c1 set PrivateKey 12345 && exit 1 || true
|
||||
$tinc $c1 --force set PrivateKey 12345
|
||||
test "`$tinc $c1 get PrivateKey`" = "12345"
|
||||
test "`$tinc $c1 get PrivateKey | sed 's/\r//'`" = "12345"
|
||||
$tinc $c1 del PrivateKey
|
||||
test -z "`$tinc $c1 get PrivateKey`"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue