Import Upstream version 1.1~pre15
This commit is contained in:
parent
87cef22421
commit
bc8ca65653
85 changed files with 1687 additions and 971 deletions
|
|
@ -4,9 +4,11 @@ TESTS = \
|
|||
executables.test \
|
||||
import-export.test \
|
||||
invite-join.test \
|
||||
invite-offline.test \
|
||||
invite-tinc-up.test \
|
||||
ns-ping.test \
|
||||
ping.test \
|
||||
scripts.test \
|
||||
sptps-basic.test \
|
||||
variables.test
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.in generated by automake 1.15 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.15.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -477,9 +477,11 @@ TESTS = \
|
|||
executables.test \
|
||||
import-export.test \
|
||||
invite-join.test \
|
||||
invite-offline.test \
|
||||
invite-tinc-up.test \
|
||||
ns-ping.test \
|
||||
ping.test \
|
||||
scripts.test \
|
||||
sptps-basic.test \
|
||||
variables.test
|
||||
|
||||
|
|
|
|||
|
|
@ -5,4 +5,6 @@
|
|||
# Just test whether the executables work
|
||||
$tincd --help
|
||||
$tinc --help
|
||||
$sptps_test --help
|
||||
if [ -e $sptps_test ]; then
|
||||
$sptps_test --help
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ EOF
|
|||
|
||||
# Generate an invitation and let another node join the VPN
|
||||
|
||||
sleep 1
|
||||
|
||||
$tinc $c1 invite bar | $tinc $c2 join
|
||||
|
||||
# Test equivalence of host config files
|
||||
|
|
|
|||
50
test/invite-offline.test
Executable file
50
test/invite-offline.test
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./testlib.sh
|
||||
|
||||
# Initialize one node
|
||||
|
||||
$tinc $c1 <<EOF
|
||||
init foo
|
||||
set DeviceType dummy
|
||||
set Mode switch
|
||||
set Broadcast no
|
||||
del Port
|
||||
set Address localhost
|
||||
set Port 32758
|
||||
EOF
|
||||
|
||||
# Generate an invitation offline and let another node join the VPN
|
||||
|
||||
invitation=`$tinc $c1 invite bar`
|
||||
|
||||
$tinc $c1 start $r1
|
||||
|
||||
$tinc $c2 join $invitation
|
||||
|
||||
# Test equivalence of host config files
|
||||
|
||||
cmp $d1/hosts/foo $d2/hosts/foo
|
||||
test "`grep ^Ed25519PublicKey $d1/hosts/bar`" = "`grep ^Ed25519PublicKey $d2/hosts/bar`"
|
||||
|
||||
# Test Mode, Broadcast and ConnectTo statements
|
||||
|
||||
test `$tinc $c2 get Mode` = switch
|
||||
test `$tinc $c2 get Broadcast` = no
|
||||
test `$tinc $c2 get ConnectTo` = foo
|
||||
|
||||
# Check whether the new node can join the VPN
|
||||
|
||||
$tinc $c2 << EOF
|
||||
set DeviceType dummy
|
||||
set Port 0
|
||||
start $r2
|
||||
EOF
|
||||
|
||||
sleep 1
|
||||
|
||||
test `$tinc $c1 dump reachable nodes | wc -l` = 2
|
||||
test `$tinc $c2 dump reachable nodes | wc -l` = 2
|
||||
|
||||
$tinc $c2 stop
|
||||
$tinc $c1 stop
|
||||
|
|
@ -8,7 +8,7 @@ $tinc $c1 <<EOF
|
|||
init foo
|
||||
set DeviceType dummy
|
||||
set Address localhost
|
||||
set Port 32751
|
||||
set Port 32756
|
||||
start $r1
|
||||
EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ $tinc $c1 <<EOF
|
|||
init foo
|
||||
set Mode switch
|
||||
set Interface ping.test1
|
||||
set Port 32573
|
||||
set Port 32577
|
||||
set Address localhost
|
||||
EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
pong.c -- ICMP echo reply generator
|
||||
Copyright (C) 2013 Guus Sliepen <guus@tinc-vpn.org>
|
||||
Copyright (C) 2013-2017 Guus Sliepen <guus@tinc-vpn.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "../src/system.h"
|
||||
|
||||
#include "../src/ethernet.h"
|
||||
|
||||
uint8_t mymac[6] = {6, 5, 5, 6, 5, 5};
|
||||
|
||||
static ssize_t do_arp(uint8_t *buf, ssize_t len, struct sockaddr_in *in) {
|
||||
|
|
@ -152,7 +154,7 @@ int main(int argc, char *argv[]) {
|
|||
#endif
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Multicast for address family %hx unsupported\n", ai->ai_family);
|
||||
fprintf(stderr, "Multicast for address family %x unsupported\n", ai->ai_family);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
112
test/scripts.test
Executable file
112
test/scripts.test
Executable file
|
|
@ -0,0 +1,112 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./testlib.sh
|
||||
|
||||
# Initialize server node
|
||||
|
||||
$tinc $c1 <<EOF
|
||||
init foo
|
||||
set DeviceType dummy
|
||||
set Port 32759
|
||||
set Address 127.0.0.1
|
||||
add Subnet 10.0.0.1
|
||||
add Subnet fec0::/64
|
||||
EOF
|
||||
|
||||
# Set up scripts
|
||||
|
||||
OUT=$d1/scripts.out
|
||||
rm -f $OUT
|
||||
|
||||
for script in tinc-up tinc-down host-up host-down subnet-up subnet-down hosts/foo-up hosts/foo-down hosts/bar-up hosts/bar-down invitation-created invitation-accepted; do
|
||||
cat >$d1/$script << EOF
|
||||
#!/bin/sh
|
||||
echo $script \$NETNAME,\$NAME,\$DEVICE,\$IFACE,\$NODE,\$REMOTEADDRESS,\$REMOTEPORT,\$SUBNET,\$WEIGHT,\$INVITATION_FILE,\$INVITATION_URL,\$DEBUG >>$OUT
|
||||
EOF
|
||||
chmod u+x $d1/$script
|
||||
done
|
||||
|
||||
# Start server node
|
||||
|
||||
$tinc -n netname $c1 start $r1
|
||||
|
||||
echo foo-started >>$OUT
|
||||
|
||||
# Invite client node
|
||||
|
||||
url=`$tinc -n netname2 $c1 invite bar`
|
||||
file=`cd $d1/invitations; ls | grep -v ed25519_key.priv`
|
||||
echo bar-invited >>$OUT
|
||||
$tinc -n netname3 $c2 join $url
|
||||
echo bar-joined >>$OUT
|
||||
|
||||
# Start and stop client node
|
||||
|
||||
$tinc $c2 << EOF
|
||||
set DeviceType dummy
|
||||
set Port 32760
|
||||
add Subnet 10.0.0.2
|
||||
add Subnet fec0::/64#5
|
||||
start $r2
|
||||
EOF
|
||||
|
||||
sleep 1
|
||||
|
||||
echo bar-started >>$OUT
|
||||
|
||||
$tinc $c1 debug 4
|
||||
$tinc $c2 stop
|
||||
|
||||
sleep 1
|
||||
|
||||
echo bar-stopped >>$OUT
|
||||
|
||||
$tinc $c1 debug 5
|
||||
$tinc $c2 start $r2
|
||||
|
||||
sleep 1
|
||||
|
||||
echo bar-started >>$OUT
|
||||
|
||||
# Stop server node
|
||||
|
||||
$tinc $c1 stop
|
||||
sleep 1
|
||||
$tinc $c2 stop
|
||||
|
||||
# Check if the script output is what is expected
|
||||
|
||||
cat >$OUT.expected << EOF
|
||||
tinc-up netname,foo,dummy,,,,,,,,,5
|
||||
subnet-up netname,foo,dummy,,foo,,,10.0.0.1,,,,5
|
||||
subnet-up netname,foo,dummy,,foo,,,fec0::/64,,,,5
|
||||
foo-started
|
||||
invitation-created netname2,foo,,,bar,,,,,$d1/invitations/$file,$url,
|
||||
bar-invited
|
||||
invitation-accepted netname,foo,dummy,,bar,127.0.0.1,,,,,,5
|
||||
bar-joined
|
||||
host-up netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
|
||||
hosts/bar-up netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
|
||||
subnet-up netname,foo,dummy,,bar,127.0.0.1,32760,10.0.0.2,,,,5
|
||||
subnet-up netname,foo,dummy,,bar,127.0.0.1,32760,fec0::/64,5,,,5
|
||||
bar-started
|
||||
host-down netname,foo,dummy,,bar,127.0.0.1,32760,,,,,4
|
||||
hosts/bar-down netname,foo,dummy,,bar,127.0.0.1,32760,,,,,4
|
||||
subnet-down netname,foo,dummy,,bar,127.0.0.1,32760,10.0.0.2,,,,4
|
||||
subnet-down netname,foo,dummy,,bar,127.0.0.1,32760,fec0::/64,5,,,4
|
||||
bar-stopped
|
||||
host-up netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
|
||||
hosts/bar-up netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
|
||||
subnet-up netname,foo,dummy,,bar,127.0.0.1,32760,10.0.0.2,,,,5
|
||||
subnet-up netname,foo,dummy,,bar,127.0.0.1,32760,fec0::/64,5,,,5
|
||||
bar-started
|
||||
host-down netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
|
||||
hosts/bar-down netname,foo,dummy,,bar,127.0.0.1,32760,,,,,5
|
||||
subnet-down netname,foo,dummy,,bar,127.0.0.1,32760,10.0.0.2,,,,5
|
||||
subnet-down netname,foo,dummy,,bar,127.0.0.1,32760,fec0::/64,5,,,5
|
||||
subnet-down netname,foo,dummy,,foo,,,10.0.0.1,,,,5
|
||||
subnet-down netname,foo,dummy,,foo,,,fec0::/64,,,,5
|
||||
tinc-down netname,foo,dummy,,,,,,,,,5
|
||||
EOF
|
||||
|
||||
cmp $OUT $OUT.expected
|
||||
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
. ./testlib.sh
|
||||
|
||||
# Skip this test if we did not compile sptps_test
|
||||
|
||||
test -e $sptps_test || exit 77
|
||||
|
||||
# Generate keys
|
||||
|
||||
mkdir -p $d1
|
||||
|
|
@ -11,18 +15,18 @@ $sptps_keypair $d1/client.priv $d1/client.pub
|
|||
|
||||
# Test transfer of a simple file.
|
||||
|
||||
(sleep 1; $sptps_test -q $d1/client.priv $d1/server.pub localhost 32750 <../README) &
|
||||
$sptps_test $d1/server.priv $d1/client.pub 32750 >$d1/out1
|
||||
(sleep 1; $sptps_test -4 -q $d1/client.priv $d1/server.pub localhost 32750 <../README) &
|
||||
$sptps_test -4 $d1/server.priv $d1/client.pub 32750 >$d1/out1
|
||||
cmp $d1/out1 ../README
|
||||
|
||||
$sptps_test -q $d1/server.priv $d1/client.pub 32750 <../NEWS &
|
||||
$sptps_test -4 -q $d1/server.priv $d1/client.pub 32750 <../NEWS &
|
||||
sleep 1
|
||||
$sptps_test $d1/client.priv $d1/server.pub localhost 32750 > $d1/out2
|
||||
$sptps_test -4 $d1/client.priv $d1/server.pub localhost 32750 > $d1/out2
|
||||
cmp $d1/out2 ../NEWS
|
||||
|
||||
# Datagram mode
|
||||
|
||||
$sptps_test -dq $d1/server.priv $d1/client.pub 32750 <../COPYING &
|
||||
$sptps_test -4 -dq $d1/server.priv $d1/client.pub 32750 <../COPYING &
|
||||
sleep 1
|
||||
sleep 1 | $sptps_test -dq $d1/client.priv $d1/server.pub localhost 32750 >$d1/out3
|
||||
sleep 1 | $sptps_test -4 -dq $d1/client.priv $d1/server.pub localhost 32750 >$d1/out3
|
||||
cmp $d1/out3 ../COPYING
|
||||
|
|
|
|||
|
|
@ -9,18 +9,10 @@ sptps_keypair=../src/sptps_keypair
|
|||
|
||||
# Test directories
|
||||
|
||||
case "$_" in
|
||||
/*)
|
||||
d1=$_.1
|
||||
d2=$_.2
|
||||
d3=$_.3
|
||||
;;
|
||||
*)
|
||||
d1=$PWD/$_.1
|
||||
d2=$PWD/$_.2
|
||||
d3=$PWD/$_.3
|
||||
;;
|
||||
esac
|
||||
scriptname=`basename $0`
|
||||
d1=$PWD/$scriptname.1
|
||||
d2=$PWD/$scriptname.2
|
||||
d3=$PWD/$scriptname.3
|
||||
|
||||
# Default arguments for both tinc and tincd
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue