chiark / gitweb /
secnet.git
4 years agopython: Provide feature for argparse --[no-]foo options
Ian Jackson [Mon, 4 Nov 2019 15:08:13 +0000 (15:08 +0000)]
python: Provide feature for argparse --[no-]foo options

This is surprisingly awkward.  StackExchange has one.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoMakefile.in: break out PYMODULES
Ian Jackson [Mon, 4 Nov 2019 15:01:22 +0000 (15:01 +0000)]
Makefile.in: break out PYMODULES

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: output_data: Change recursive variables
Ian Jackson [Sun, 3 Nov 2019 16:58:17 +0000 (16:58 +0000)]
make-secnet-sites: output_data: Change recursive variables

Pass a tuple path, of the objects. rather than the string so far and
an indent value.

This will make it easier to more complex things here.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: output_vpnflat: Change recursive variables
Ian Jackson [Sun, 3 Nov 2019 12:52:31 +0000 (12:52 +0000)]
make-secnet-sites: output_vpnflat: Change recursive variables

Pass a tuple path, of the objects. rather than the string so far and
an indent value.

This will make it easier to more complex things here.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agotests: Rename locations to `in' and `out'
Ian Jackson [Sun, 3 Nov 2019 12:51:05 +0000 (12:51 +0000)]
tests: Rename locations to `in' and `out'

It is better for testing for the location names not to be equal to the
site names.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: Fix argument parsing with options
Ian Jackson [Thu, 7 Nov 2019 00:01:44 +0000 (00:01 +0000)]
make-secnet-sites: Fix argument parsing with options

In "make-secnet-sites: Use argparse rather than ad-hoc parser",
we missed a reference to sys.argv.  The effect is that if
make-secnet-sites run in sites file output mode, and provided
with options, the output is written to the wrong place.

The only syntax that worked in 0.4.5 and broke in 0.5.0 is
make-secnet-sites -P.  So here we fix that regression.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoMakefile.in: release checklist: use -j8 for sbuild
Ian Jackson [Thu, 24 Oct 2019 18:23:07 +0000 (19:23 +0100)]
Makefile.in: release checklist: use -j8 for sbuild

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agochangelog: Start 0.5.1~
Ian Jackson [Thu, 24 Oct 2019 18:22:58 +0000 (19:22 +0100)]
changelog: Start 0.5.1~

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agochangelog: finalise 0.5.0 v0.5.0
Ian Jackson [Thu, 24 Oct 2019 18:12:01 +0000 (19:12 +0100)]
changelog: finalise 0.5.0

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agochangelog: Document NAK logging changes
Ian Jackson [Thu, 24 Oct 2019 17:33:07 +0000 (18:33 +0100)]
changelog: Document NAK logging changes

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite: Provide NAK reasons mentioning names and unpick failure
Ian Jackson [Sat, 21 Sep 2019 15:41:12 +0000 (16:41 +0100)]
site: Provide NAK reasons mentioning names and unpick failure

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoutil: priomsg: Provide and use priomsg_update_fixed
Ian Jackson [Sat, 21 Sep 2019 15:40:15 +0000 (16:40 +0100)]
util: priomsg: Provide and use priomsg_update_fixed

We are going to want to reuse this.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite: Record whynot in default (end of comm_notify) case
Ian Jackson [Sat, 21 Sep 2019 15:13:29 +0000 (16:13 +0100)]
site: Record whynot in default (end of comm_notify) case

send_nak will print the type and the two indices, so we don't.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite: named_for_us: Reorganise into "if"s
Ian Jackson [Sat, 21 Sep 2019 15:29:33 +0000 (16:29 +0100)]
site: named_for_us: Reorganise into "if"s

This gives us somewhere to put our whynot updates.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite: named_for_us: Introduce NAME_MATCHES
Ian Jackson [Sat, 21 Sep 2019 15:17:56 +0000 (16:17 +0100)]
site: named_for_us: Introduce NAME_MATCHES

This will make the next changes much smaller.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite: Pass whynot through to named_for_us
Ian Jackson [Sat, 21 Sep 2019 15:10:59 +0000 (16:10 +0100)]
site: Pass whynot through to named_for_us

We only pass this as non-0 when, if named_for_us rejects, we actually
return false from comm_notify.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoudp: Use commcommon->why_unwanted
Ian Jackson [Sat, 21 Sep 2019 14:21:09 +0000 (15:21 +0100)]
udp: Use commcommon->why_unwanted

This is the one call site of comm_notify.  (If we had had any comm
that wasn't based on udp.c, that would have needed updating too.)

No overall functional change: nothing ever sets this yet, so we always
use the default message.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoutil: Reorder information in NAK log messages
Ian Jackson [Sat, 21 Sep 2019 15:46:34 +0000 (16:46 +0100)]
util: Reorder information in NAK log messages

In particular, put the supplied reason string last so that it will be
unambiguous.  And putting the message type first seems more natural.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agocomm: Introduce commcommon->why_unwanted
Ian Jackson [Sat, 21 Sep 2019 14:15:39 +0000 (15:15 +0100)]
comm: Introduce commcommon->why_unwanted

This will "accumulate" a message.  It will give the information about
why the closest approach to wanting this message ultimately rejected
it.

No overall functional change with current code: nothing ever either
updates this yet, or uses it.  Users will come next.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agocomm: comm_notify takes the cc, not just the notify_list
Ian Jackson [Sat, 21 Sep 2019 14:14:03 +0000 (15:14 +0100)]
comm: comm_notify takes the cc, not just the notify_list

We're going to want this in a moment.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoutil: priomsg: Allow passing priomsg_update_p a null pm
Ian Jackson [Sat, 21 Sep 2019 15:12:31 +0000 (16:12 +0100)]
util: priomsg: Allow passing priomsg_update_p a null pm

This makes it more convenient for callers who may not have anything to
update.

No functional change with any existing caller, of why there aren't any
anyway.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoutil: priomsg: New facility
Ian Jackson [Sat, 21 Sep 2019 13:59:18 +0000 (14:59 +0100)]
util: priomsg: New facility

No callers yet.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoutil: truncmsg: New way of manipulating buffers
Ian Jackson [Sat, 21 Sep 2019 12:19:37 +0000 (13:19 +0100)]
util: truncmsg: New way of manipulating buffers

No callers yet.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agobuffer: Abolish unused `flags'
Ian Jackson [Sat, 21 Sep 2019 11:54:59 +0000 (12:54 +0100)]
buffer: Abolish unused `flags'

This variable is never examined.

This has the comment `How paranoid should we be?' but in fact the
paranoia level (such as it is) is set by which entrypoint we call.  It
would not be appropriate to make this a buffer property anyway.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agochangelog: Document changes since 0.4.5
Ian Jackson [Thu, 24 Oct 2019 17:21:15 +0000 (18:21 +0100)]
changelog: Document changes since 0.4.5

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: Taint the `group' parameter
Ian Jackson [Thu, 24 Oct 2019 14:39:08 +0000 (15:39 +0100)]
make-secnet-sites: Taint the `group' parameter

This comes from the untrusted caller.  It should be tainted before we
use it as a filename.  (Actually in practice it's checked against the
`location' from the header, so this doesn't actually fix a
vulnerability.)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: allow Tainted construction to specify file/line
Ian Jackson [Thu, 24 Oct 2019 14:35:39 +0000 (15:35 +0100)]
make-secnet-sites: allow Tainted construction to specify file/line

Unfortunately these default values are evaluated to constants at the
time of class definition, so we need some circumlocution.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: Do not write out unchecked output in sites
Ian Jackson [Thu, 24 Oct 2019 14:24:42 +0000 (15:24 +0100)]
make-secnet-sites: Do not write out unchecked output in sites

In principle our downstreams should be able to cope with this.  But
maybe they haven't had the fixes, and dumping strange stuff into the
output file seems unfriendly.

So reimplement copyout as a function which reassembles the output line
from pieces, and checks that each Tainted word it is writing out has
been verified by someone to be OK.

As a side effect we normalise the whitespace including indentation.

We rename the input line variable in pline from `i' to `il', since it
contains possibly dangerous content.  This makes sure we caught all of
the places it is used.

With these changes, it is necessary to add a couple of explicit calls
to Tainted methods for otherwise-unused parameters, notably the group
name in location() definitions in user-provided site fragments, and
the (optional) email address in an ssh1 rsa key.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: Introduce copyout() in pline()
Ian Jackson [Thu, 24 Oct 2019 14:10:55 +0000 (15:10 +0100)]
make-secnet-sites: Introduce copyout() in pline()

These are all the places where we simply copy the input line to our
output.  We are going to do something more complicated in a moment, so
centralising this is useful.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: Check input file word syntax
Ian Jackson [Thu, 24 Oct 2019 14:10:29 +0000 (15:10 +0100)]
make-secnet-sites: Check input file word syntax

make-secnet sites sometimes reads untrusted input.  And we copy it to
various output files, including secnet configuration files which have
a different lexical syntax and are particularly vulnerable to a
syntax stuffing/inadequate escaping attack.

In principle we could quote everything appropriately on output but a
actually we probably just want to check it since the syntax of all
these directives and their parameters is quite restricted.

In order to ensure that we catch everything, and that if we missed a
location we get a crash rather than a security vulnerability, we take
the following approach:

Each untrusted input word is wrapped up in a new Tainted object.  The
Tainted object has a number of methods for checking and returning
values which are suitable for various purposes.  But attempts to
simply print it (eg to an output file) are made to fail.

The Tainted object keeps track internally of whether it has been
checked.  This is going to be important in a moment.

Naive call sites use straightforward methods on w[N] to get checked
values for storage in their own data structures.

Knowledgeable use sites may call .raw() to get the unchecked value,
and .raw_mark_ok() if they know that the value is good (or are about
to do something which will definitely crash if not, so that a bad
value cannot escape).

Obviously storing the results of .raw() in a call site's data
structure would escape the taint checking.  So we don't do that unless
we have done the check ourselves.

Within the Tainted implication we really wanted an error monad.  Using
python exceptions for this looked like it was going to be too
abstruse.  So we open-code the monad with a conventional `ok' local
variable.  Each entrypoint returns using ._rtn() which can
double-check that no error has been lost.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: Crash if complain() is called too late
Ian Jackson [Thu, 24 Oct 2019 14:04:19 +0000 (15:04 +0100)]
make-secnet-sites: Crash if complain() is called too late

Every call to complain() is supposed to occurs before the code in the
main program which checks `complaints'.  But maybe there is an
erroneous late call, or one may be introduced.  In this case it is
important to crash, because otherwise bad data might end up being
written into our output.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: Introduce a couple of local variables
Ian Jackson [Thu, 24 Oct 2019 13:58:27 +0000 (14:58 +0100)]
make-secnet-sites: Introduce a couple of local variables

We are going to want these in a moment to avoid repeatedly referring
to the same w[] element.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: Use argparse rather than ad-hoc parser
Ian Jackson [Sun, 20 Oct 2019 17:57:27 +0000 (18:57 +0100)]
make-secnet-sites: Use argparse rather than ad-hoc parser

This is much less ridiculous now.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomtest/t-basic: New test, with expected output
Ian Jackson [Sun, 20 Oct 2019 13:01:15 +0000 (14:01 +0100)]
mtest/t-basic: New test, with expected output

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agomake-secnet-sites: Switch to python3
Ian Jackson [Thu, 24 Oct 2019 18:05:42 +0000 (19:05 +0100)]
make-secnet-sites: Switch to python3

ipaddress is in the python3 stdlib.  python-future is not needed
either as it is aliases for things from the python3 stdlib.

We have to explicitly add python3 to Build-Depends now; it was
previously pulled in implicitly.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoMakefile.in: clean: Remove __pycache__ too
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>
4 years agomake-secnet-sites: Switch to `ipaddress' from `ipaddr'
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>
4 years agomake-secnet-sites: Apply list() to keys in delempty
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>
4 years agomake-secnet-sites etc.: Use unicode
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>
4 years agoipaddrset: Define __bool__ and make __nonzero__ an alias
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>
4 years agomake-secnet-sites: Set .type in the `level' base class
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>
4 years agomake-secnet-sites: Replace string.atol with int()
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>
4 years agomake-secnet-sites: Fix calls to string.split and sring.join
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>
4 years agomake-secnet-sites: Abolish use of .has_key
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>
4 years agomake-secnet-sites: Fix python path manipulation
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>
4 years agomake-secnet-sites: Put parens around print() statements
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>
4 years agomake-secnet-sites: Move option parser to the front of the file
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>
4 years agomake-secnet-sites: Move input file reading further down the file
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>
4 years agomake-secnet-sites: Introduce a notion of listish types.
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>
4 years agomake-secnet-sites: Introduce a superclass for the config types.
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>
4 years agomtest/t-userv: Check for dangerous parsing of late options
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>
4 years agomtest/t-userv: Break out `good'
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>
4 years agotests: Dump logfile(s) of failing test(s)
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>
4 years agotests: Print subdir in summary output too
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>
4 years agotests: Provide `recheck' to rerun fast tests
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>
4 years agomtest: Tidy up output from Makefile
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>
4 years agomtest: Break out diff-output
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>
4 years agomtest: Provide run-mss
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>
4 years agomtest/t-userv: Check the expected output
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>
4 years agomtest: Set PYTHONBYTECODEBASE here too
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>
4 years agomtest: Set PYTHONHASHSEED
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>
4 years agomtest: Wire up into toplevel Makefile
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>
4 years agomtest: Provide a makefile to run the tests
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>
4 years agotest-common: Set PYTHONBYTECODEBASE to /dev/null
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>
4 years agotest-common: Rename SECNET_TEST_BUILDDIR variable
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>
4 years agotest-common.make: Add missing dependencies on makefiles
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>
4 years agotest-common.make: Fix hardcoded stest references
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>
4 years agobuild system: Break out test-common.make
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>
4 years agobuild system: make clean calls clean in stest
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>
4 years agostest: Add missing test-common.tcl to DEPS
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>
4 years agostest: Break out DEPS
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>
4 years agomtest: Honour MTEST_PYTHON
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>
4 years agomtest: Break out mss-run-userv
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>
4 years agomtest: First test case
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>
4 years agotest-common: Handle mtest correctly too
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>
4 years agotests: Break out prefix_some_path
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>
4 years agotests: Break out test-common.tcl
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>
4 years agomtest: Test files for make-secnet-sites userv mode
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>
4 years agostest: Use proper builddir subdir as default tmp
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>
4 years ago.gitignore: ignore config.stamp.in too
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>
4 years agostest: Use topbuilddir (now in common.make)
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>
4 years agostest: Use common.make and therefore our standard CFLAGS
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>
4 years agostest/udp-preload: Fix some compiler warnings
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>
4 years agobuild system: stest: Fix out-of-tree builds
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>
4 years agobuild system: test-example: Fix out-of-tree builds
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>
4 years agobuild system: Move srcdir setting out of common.make.in
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>
4 years agobuild system: Process test-example with autoconf
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>
4 years agostest: Rename from `test'
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>
4 years agobuild system: Rename stamp-h to config.stamp
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>
4 years agoipaddrset-test: Fix network with host bits
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>
4 years agotest: Add a missing dependency on the sites file
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>
4 years agotest: Rerun tests only when deps changed
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>
4 years agotest: New t-dyni-kex
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>
4 years agotest: Beak out proc test-kex
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>
4 years agotest: Slurp test-example/sites.conf and paste it in
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>
4 years agotest: udp-preload: Drop redundant headers
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>
4 years agotest: udp-preload: Fix copyright dates and error message
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>
4 years agotest: Fix build dependencies so `make check' works in sbuild again
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>
4 years agotest: Disconnect -j for check parallelism
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>
4 years agotest: Wire into "make check"
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>