chiark / gitweb /
Ian Jackson [Thu, 24 Oct 2019 16:48:31 +0000 (17:48 +0100)]
Makefile.in: clean: Remove __pycache__ too
Python3 genrates this.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 24 Oct 2019 18:03:59 +0000 (19:03 +0100)]
make-secnet-sites: Switch to `ipaddress' from `ipaddr'
ipaddress is available in python3 and ipaddr is not.
Code changes:
- Change the imports and references to the module name
- IPNetwork & IPAddress functions => ip_address & ip_network
- There is no IPNetwork superclass so don't mention it in docstrings
- collapse_address_list => collapse_addresses
- There is no version parameter to ip_address; we have to
switch on v ourselves and call IPv6Address or IPv4Address
Administrivia:
- Update debian/control and INSTALL.
- Remove references to ipaddr's licence. ipaddress is under
the same licence as python so does not need special mention.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 24 Oct 2019 16:18:37 +0000 (17:18 +0100)]
make-secnet-sites: Apply list() to keys in delempty
It is not permitted (in Python3) to modify a dictionary like this,
while iterating over keys(). We have to make a list of the keys,
copying them.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 18 Oct 2019 23:40:17 +0000 (00:40 +0100)]
make-secnet-sites etc.: Use unicode
We are going to want to switch to ipaddress from ipaddr, since
ipaddress is available in python3. But ipaddress insists on unicode
strings, even in python2. ipaddr doesn't mind them.
So make everything be unicode. In particular: all of our literals and
all of our io streams. We wrap up io.open(), which is a compatibility
thing from python-future.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 18 Oct 2019 20:34:13 +0000 (21:34 +0100)]
ipaddrset: Define __bool__ and make __nonzero__ an alias
Python3 calls __bool_. Python2 calls __nonzero__.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 18 Oct 2019 20:32:47 +0000 (21:32 +0100)]
make-secnet-sites: Set .type in the `level' base class
We have one instance of directly this, the root node. If it has an
error, the lack of the .type would cause a stack trace while trying to
print the error message.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 24 Oct 2019 18:00:42 +0000 (19:00 +0100)]
make-secnet-sites: Replace string.atol with int()
string.atol retured a long, I assume. In python2, longs and ints are
distinct. We could use long() here. But that is not available in
python3. Instead, write the python3 version already: just int. We
can get an `int' that always produces longs from the python-future
module.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 18 Oct 2019 20:31:13 +0000 (21:31 +0100)]
make-secnet-sites: Fix calls to string.split and sring.join
These go away in python3. They want us to use this daft objecty
syntax instead.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 18 Oct 2019 20:22:51 +0000 (21:22 +0100)]
make-secnet-sites: Abolish use of .has_key
This is deprecated and goes away in python3. They want us to use this
`in' syntax instead.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 18 Oct 2019 20:29:18 +0000 (21:29 +0100)]
make-secnet-sites: Fix python path manipulation
This makes it possible to set PYTHONPATH to prefer the in-tree
modules.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 16 Oct 2019 20:16:38 +0000 (21:16 +0100)]
make-secnet-sites: Put parens around print() statements
This is part of the transition to python3.
In actual fact these are all error messages and should go to stderr
but I'm ot fixing that right now.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 16 Oct 2019 17:28:29 +0000 (18:28 +0100)]
make-secnet-sites: Move option parser to the front of the file
This means that we will be able to use information from the option
parser when creating our classes etc. This will be useful as we are
going to support multiple output file versions etc.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 16 Oct 2019 17:26:03 +0000 (18:26 +0100)]
make-secnet-sites: Move input file reading further down the file
This separates it from the option parser, which I want to move and
rewrite.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
make-secnet-sites: Introduce a notion of listish types.
A property of such a listish type can be assigned multiple times, and
the values accumulate, and get reported as a list in the output
configuration.
Currently none are defined, so you can't see what this does.
Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
make-secnet-sites: Introduce a superclass for the config types.
Somewhere to put common behaviour. Not that there is any yet, so
there's no functional change.
Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Ian Jackson [Sun, 20 Oct 2019 18:40:03 +0000 (19:40 +0100)]
mtest/t-userv: Check for dangerous parsing of late options
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 18:01:45 +0000 (19:01 +0100)]
mtest/t-userv: Break out `good'
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 24 Oct 2019 17:46:23 +0000 (18:46 +0100)]
tests: Dump logfile(s) of failing test(s)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 13:54:38 +0000 (14:54 +0100)]
tests: Print subdir in summary output too
Now we have multiple subdirs the output might be interleaved.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 13:54:24 +0000 (14:54 +0100)]
tests: Provide `recheck' to rerun fast tests
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 13:01:27 +0000 (14:01 +0100)]
mtest: Tidy up output from Makefile
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:58:28 +0000 (13:58 +0100)]
mtest: Break out diff-output
No functional change
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:59:32 +0000 (13:59 +0100)]
mtest: Provide run-mss
No caller yet
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:27:20 +0000 (13:27 +0100)]
mtest/t-userv: Check the expected output
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 24 Oct 2019 16:47:16 +0000 (17:47 +0100)]
mtest: Set PYTHONBYTECODEBASE here too
This prevents ad-hoc manual runs from genrating unwanted cache files.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:59:43 +0000 (13:59 +0100)]
mtest: Set PYTHONHASHSEED
This will allow us to avoid test output being reordered due to hash
instability.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:19:09 +0000 (13:19 +0100)]
mtest: Wire up into toplevel Makefile
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:15:04 +0000 (13:15 +0100)]
mtest: Provide a makefile to run the tests
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 24 Oct 2019 16:43:19 +0000 (17:43 +0100)]
test-common: Set PYTHONBYTECODEBASE to /dev/null
Python is not entirely reliable at figuring out when its .pyc files
are out of date, especially if you do something like
git-rebase -i --exec 'make check-mtest' <commitish>
So squash the bytecode cache entirely.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:08:31 +0000 (13:08 +0100)]
test-common: Rename SECNET_TEST_BUILDDIR variable
No longer just stest.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:08:02 +0000 (13:08 +0100)]
test-common.make: Add missing dependencies on makefiles
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:07:49 +0000 (13:07 +0100)]
test-common.make: Fix hardcoded stest references
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:04:29 +0000 (13:04 +0100)]
build system: Break out test-common.make
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 12:04:03 +0000 (13:04 +0100)]
build system: make clean calls clean in stest
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 11:55:15 +0000 (12:55 +0100)]
stest: Add missing test-common.tcl to DEPS
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 11:54:48 +0000 (12:54 +0100)]
stest: Break out DEPS
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 11:20:25 +0000 (12:20 +0100)]
mtest: Honour MTEST_PYTHON
To allow running with different python versions.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 11:08:48 +0000 (12:08 +0100)]
mtest: Break out mss-run-userv
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 11:05:25 +0000 (12:05 +0100)]
mtest: First test case
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 11:02:21 +0000 (12:02 +0100)]
test-common: Handle mtest correctly too
The default value for tmp nees to be right for mtest/ too.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 10:58:07 +0000 (11:58 +0100)]
tests: Break out prefix_some_path
This incidentally fixes a bug: previously, we wrote PRELOAD rather
than LD_PRELOAD in one place, which meant that existing LD_PRELOADs
would be overwritten. Now they no longer are.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 10:54:21 +0000 (11:54 +0100)]
tests: Break out test-common.tcl
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 20 Oct 2019 10:50:52 +0000 (11:50 +0100)]
mtest: Test files for make-secnet-sites userv mode
No test execution machinery yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 22:19:58 +0000 (23:19 +0100)]
stest: Use proper builddir subdir as default tmp
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 22:14:21 +0000 (23:14 +0100)]
.gitignore: ignore config.stamp.in too
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 22:13:55 +0000 (23:13 +0100)]
stest: Use topbuilddir (now in common.make)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 22:13:35 +0000 (23:13 +0100)]
stest: Use common.make and therefore our standard CFLAGS
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 22:13:01 +0000 (23:13 +0100)]
stest/udp-preload: Fix some compiler warnings
These come up with our standard CFLAGS which we are erroneously not
using.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 22:03:40 +0000 (23:03 +0100)]
build system: stest: Fix out-of-tree builds
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 22:03:19 +0000 (23:03 +0100)]
build system: test-example: Fix out-of-tree builds
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 22:00:28 +0000 (23:00 +0100)]
build system: Move srcdir setting out of common.make.in
This varies according to the cwd. So for common.make.in it is always
the top-level.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 21:17:37 +0000 (22:17 +0100)]
build system: Process test-example with autoconf
This makes configure make the directory during out-of-tree builds.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 21:10:49 +0000 (22:10 +0100)]
stest: Rename from `test'
We want other tests too.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 21:05:40 +0000 (22:05 +0100)]
build system: Rename stamp-h to config.stamp
This makes more sense and gets it out of the way of "st..." tab
completion which we are going to want in a momen.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 18 Oct 2019 18:22:36 +0000 (19:22 +0100)]
ipaddrset-test: Fix network with host bits
2001:23:24:: has 3x16 bits set, ie /48. This was always wrong.
We need to fix this now because we are going to switch to ipaddress
from ipaddr, which actually checks this.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 13 Oct 2019 10:05:33 +0000 (11:05 +0100)]
test: Add a missing dependency on the sites file
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 23:29:42 +0000 (00:29 +0100)]
test: Rerun tests only when deps changed
By touching the stamp file.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 23:25:40 +0000 (00:25 +0100)]
test: New t-dyni-kex
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 23:24:00 +0000 (00:24 +0100)]
test: Beak out proc test-kex
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 23:20:42 +0000 (00:20 +0100)]
test: Slurp test-example/sites.conf and paste it in
This will enable us to edit this common config.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 23:14:31 +0000 (00:14 +0100)]
test: udp-preload: Drop redundant headers
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 23:10:03 +0000 (00:10 +0100)]
test: udp-preload: Fix copyright dates and error message
Also upgrade the licence to GPLv3+ like the rest of secnet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 21:45:11 +0000 (22:45 +0100)]
test: Fix build dependencies so `make check' works in sbuild again
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 21:58:03 +0000 (22:58 +0100)]
test: Disconnect -j for check parallelism
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 21:45:11 +0000 (22:45 +0100)]
test: Wire into "make check"
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 21:40:51 +0000 (22:40 +0100)]
test: Use test/d-* instead of test/tmp for everything
Now it is actually ok to run multiple tests in parallel.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 21:34:23 +0000 (22:34 +0100)]
test: Makefile rune for `check'
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 21:14:04 +0000 (22:14 +0100)]
test: Move sockets in a subdirectory
They need to be not world-accessible and this is the easiest way.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 21:12:37 +0000 (22:12 +0100)]
test: Specify the LD_PRELOAD etc.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 21:03:17 +0000 (22:03 +0100)]
test: Split "invoke" up
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 20:54:25 +0000 (21:54 +0100)]
test: udp-preload: Use $(CC) for link, provide clean target
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 20:50:34 +0000 (21:50 +0100)]
test: udp-preload: Build system
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 20:46:45 +0000 (21:46 +0100)]
Makefiles: Break some settings out into common.make
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 20:37:31 +0000 (21:37 +0100)]
test: udp-preload: Provide recvfrom
Now we can do a key exchange!
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 20:29:37 +0000 (21:29 +0100)]
test: udp-preload: Fix inet_ntop calling convention
inet_ntop has a weird error return protocol. And our code for calling
it never worked properly because we didn't strip the leading directory
names from the bound socket name.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 19:40:55 +0000 (20:40 +0100)]
test: Proxy udp packets
We must change the config to specify localhost addrs explicitly,
because we don't implement any special logic for IN[6]ADDR_ANY.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 19:40:06 +0000 (20:40 +0100)]
test: udp-preload: Cope with -ve fds
Eg, Tcl passes -1 to close (!)
#0 0x00007f62949883ca in close (fd=-1) at udp-preload.c:207
#1 0x00007f6294719362 in Tcl_FinalizeNotifier () from /usr/lib/x86_64-linux-gnu/libtcl8.6.so
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 12:30:59 +0000 (13:30 +0100)]
test: Run secnet under strace
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 12:29:54 +0000 (13:29 +0100)]
test: udp-preload: Provide sendto
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 12:29:26 +0000 (13:29 +0100)]
test: udp-preload: Prepare for wrapping fns that don't return int
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 12:23:27 +0000 (13:23 +0100)]
test: udp-preload: Introduce sun_prep
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 12:22:45 +0000 (13:22 +0100)]
test: Consolidate program name in argl
This avoids pratting about with the weird way execl takes its
arguments. No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 12:09:37 +0000 (13:09 +0100)]
test: udp-preload: Provide close
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 12:07:09 +0000 (13:07 +0100)]
test: udp-preload: Provide getsockname
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 11:42:47 +0000 (12:42 +0100)]
test: udp-preload: Provide setsockopt
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 11:41:37 +0000 (12:41 +0100)]
iaddr_to_string: Do not falsely claim bad addrs are scoped IPv6
In particular, if the AF is neither INET nor INET6, adns_addr2text
quite rightly fails with EAFNOSUPPORT.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 11:32:58 +0000 (12:32 +0100)]
test: udp-preload: Remove now-obsolete `bound'
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 11:31:14 +0000 (12:31 +0100)]
test: udp-preload: Fix binding, unlink
Avoids EADDRINUSE from the real bind(2).
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 11:29:38 +0000 (12:29 +0100)]
test: udp-preload: Fix binding
inet_ntop needs just the addr field. How "convenient".
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 12 Oct 2019 11:12:45 +0000 (12:12 +0100)]
test: udp-preload: More actual implementation
Now needs to be invoked like this
UDP_PRELOAD_DIR=test/tmp LD_PRELOAD=test/udp-preload.so test/invoke
It binds to test/tmp/...
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 23:57:27 +0000 (00:57 +0100)]
test: udp-preload: Beginning of actual implementation
gcc -Wall -D_REENTRANT -fPIC -c udp-preload.c && \
ld -shared -soname foo.so.1 udp-preload.o -o udp-preload.so -ldl -lc
produces a library with which
LD_PRELOAD=test/udp-preload.so test/invoke
produces various complaints like
udp (test/tmp/outside.conf:19): setsockopt(,IPV6_V6ONLY,&1,): Operation not supported
udp (test/tmp/inside.conf:19): socket [::]:16913 experiencing some trouble transmitting IPv6 (to [::1]:16900): Bad file descriptor
This is progress.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 23:30:02 +0000 (00:30 +0100)]
test: udp-preload: Proof of concept wrapping (2)
gcc -D_REENTRANT -fPIC -c udp-preload.c && \
ld -shared -soname foo.so.1 udp-preload.o -o udp-preload.so -ldl -lc
produces a library with which
LD_PRELOAD=test/udp-preload.so test/invoke
still works.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 23:28:16 +0000 (00:28 +0100)]
test: udp-preload: Proof of concept wrapping
gcc -D_REENTRANT -fPIC -c udp-preload.c -ldl -lc && \
ld -shared -soname foo.so.1 udp-preload.o -o udp-preload.so
produces a library which makes secnet go
secnet fatal error: Failed to initialise ADNS: Message too long
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 23:01:12 +0000 (00:01 +0100)]
test: udp-preload: Import libauthbind.c
This is from authbind 2.1.2
64b7841344fcc3cc. It is GPLv2+ and
my own copyright so no licence problem. I'm going to hack it up into
what is needed here.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 22:56:33 +0000 (23:56 +0100)]
test: Use dedicated tmp directory in variable
We are going to want to run multiple tests at once, so we'll need
this.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 20:45:09 +0000 (21:45 +0100)]
test: if things aren't working time out rather than waiting forever
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 20:43:54 +0000 (21:43 +0100)]
test: expect initial ping packet to come back on inside, for now
We are pinging the remote secnet, which responds without sending the
packet to its host (ie, "outside.r" in our terms).
We can improve this later if we care.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 20:41:18 +0000 (21:41 +0100)]
test: send an initial ping packet
The hex data came from
ping -I secnet-test-i 172.18.232.1
tcpdump -wt -isecnet-test-i
tcpdump -rt -x
We send it twice because the first causes a key exchange and then gets
lost.
The result is that the script crashes with
inside rx'd!
This is because we are pinging the remote secnet, which responds
without sending the packet to its host (ie, "outside.r" in our terms).
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 20:33:01 +0000 (21:33 +0100)]
test: use chiark-tcl-hbytes rather than ad-hoc \x quoting
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 11 Oct 2019 20:31:44 +0000 (21:31 +0100)]
test: Fix fd plumbing
In a background process, stdin defaults to /dev/null, so we need to do
a little dance. <&0 looks like it ought to work according to the bash
manual and does indeed work in bash, but not in dash. This
construction seems to work in both.
Tested with:
date | sh -exc 'cat <&0 >t &'
SuS says:
If job control is disabled (see set, -m), the standard input for an
asynchronous list, before any explicit redirections are performed,
shall be considered to be assigned to a file that has the same
properties as /dev/null. This shall not happen if job control is
enabled. In all cases, explicit redirection of standard input shall
override this activity.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>