Commit Graph

687 Commits

Author SHA1 Message Date
Andrew Bettison
95cce9109f Fix Android server thread start bug
Was failing to start if a stale pidfile was present.

Introduced the 'debug.server' config option to help diagnose pidfile
issues.
2016-10-20 13:29:01 +10:30
Andrew Bettison
c8bf8a7733 Refactor JNI out of CLI and server main loop
The CLI and server main loop now have no conditional JNI code.  All JNI
code has been moved into separate source files, which #include the new
"jni_common.h" instead of <jni.h>.  The "cli.h" header no longer
includes <jni.h>, so the rest of the Serval source code is now
unaffected by JNI definitions.

The 'cf_limbo' global variable is now thread-local, so that each thread
has its own independent copy of the loaded configuration.  The JNI
server entry point now calls cf_init() once.  The new 'cf_initialised'
flag prevents clobbering the config state by redundant calls to
cf_init().

The CLI "stop" command now sends SIGHUP to the specific thread in which
the server is running.  This is achieved by writing the PID and TID
(Linux Thread ID) into the pidfile, separated by a space, on systems
that support the Linux gettid() and tgkill() system calls.  The server's
signal handler has been overhauled, and its logging improved.
2016-10-13 16:23:18 +10:30
Andrew Bettison
a15396b793 Add server status test case 2016-10-13 16:01:22 +10:30
Andrew Bettison
fc10a83a1d Improve test framework
The execute() and executeOk() functions now set $TFWEXECUTED instead
of $executed.

The execute() and executeOk() functions now make a hard link from the
--stdout-file=PATH and --stderr-file=PATH files to the default files
of 'stdout' and 'stderr' so that post-fork handling can still cat their
contents into the log file.

The fork() function now sets the variables $TFWFORKSTDOUT_<label>
$TFWFORKSTDERR_<label> $TFWFORKPID_<label>.
2016-10-13 16:01:22 +10:30
Jeremy Lakeman
62a1ca46bc Wait for path establishment in network scan test 2016-09-27 15:51:23 +09:30
Jeremy Lakeman
ced74d0b6b Simplify BK handling using new signing key typedefs 2016-09-27 15:20:12 +09:30
Andrew Bettison
e34141a2a5 Upgrade to SQLite 3.14.2
Ignores a variety of warnings when compiling sqlite3.c.

Uses the new sqlite3_trace_v2() function for logging SQL statements, now
that sqlite3_trace() and sqlite3_profile() are deprecated.

Fixes a rhizomeops test failure caused because SQLite 3.12 increased the
default block size from 1024 to 4096, causing the fixed overhead of an
empty Rhizome db to exceed 32KB.  This caused the test to fail because
the first "file add" failed.  Now the test fixture adapts to the fixed
overhead.

Deletes the SQLite 3.10.2 source amalgamation.
2016-09-21 22:47:35 +09:30
Jeremy Lakeman
adf0a880bc Any identity could be the main one, check for any valid route 2016-09-21 17:27:39 +09:30
Andrew Bettison
298b83f97b Fix a failing keyringrestful test
The recent randomising of keyring slots broke an assumption
about the order of the 'keyring list' output.  Now the test's
assertions do not assume any order.
2016-09-21 12:16:50 +09:30
Jeremy Lakeman
a531c0e960 Use a random walk to find free keyring slots
Always round the file size up to the nearest 16 slots
2016-09-20 16:47:30 +09:30
Jeremy Lakeman
275c99bc4e Add cli option for changing an entry pin 2016-09-20 10:00:02 +09:30
Andrew Bettison
2f61c447a9 Add a new rhizomerestful test case: update a bundle to empty payload 2016-09-19 14:30:04 +09:30
Andrew Bettison
0657e27dea Fix a failing meshmsrestful test
On OS-X, "sed" is BSD sed(1); must use $SED instead to get GNU sed(1).
2016-09-15 17:17:34 +09:30
Andrew Bettison
21679e3865 Fix rhizomeprotocol test on OS-X 2016-09-12 15:09:46 +09:30
Andrew Bettison
43bd0bd33f Fix a failing keyring test
The in-memory identity creation test was failing intermittently because
the server only creates the in-memory identity on the first tick, and
under load the server sometimes does not tick for a while, leading to a
race with the "servald id self" command.

The test case now waits for the server to emit a tick before running the
"id self" command.  This necessitated a new DEBUG() statement and a new
debug flag 'overlaytick'.

Also disabled Rhizome for all the keyring tests, as unnecessary Rhizome
DB creation was slowing down the fixtures.
2016-09-06 15:00:21 +09:30
Andrew Bettison
2cfdafdb56 Add some MDP client DEBUG trace statements 2016-09-06 13:31:38 +09:30
Andrew Bettison
7f0fef2209 Fix an intermittent server test failure
The quit-on-monitor-client-disconnect test was non-deterministic
depending on load (eg, other concurrently running tests).  Under load,
it was likely that the server did not process the "monitor quit" command
before checking for disconnect, so the server did not terminate.

The fix was to make the monitor interface read and process all queued
input from the client before checking for HUP or ERR condition on the
socket.  With this fix, the "sleep 1" kludges before and after the echo
"monitor quit" to the console command are no longer needed.

In the process the monitor interface code was modernised: eg, now it
calls read_nonblock() instead of read(2).
2016-09-06 12:33:29 +09:30
Jeremy Lakeman
67b9aeeb4e Add simple meshmb find command 2016-08-29 11:06:53 +09:30
Jeremy Lakeman
e13b9c3c94 Reduce redundant reading of message ply's 2016-08-23 14:28:13 +09:30
Jeremy Lakeman
b2eb3a2199 Begin broadcast messaging service 2016-08-16 15:04:15 +09:30
Jeremy Lakeman
b6256ea89a Add identity_t type & rename signing key api to identity. 2016-08-16 12:22:13 +09:30
Jeremy Lakeman
c5d6579397 Add cli option to include text of last received message 2016-08-10 11:20:12 +09:30
Jeremy Lakeman
83b6ecb453 Roll an in memory identity when the keyring is empty 2016-08-02 11:01:32 +09:30
Jeremy Lakeman
dbded493c1 Refactor meshms ply handling into separate source file 2016-07-25 16:54:11 +09:30
Jeremy Lakeman
9f4f56b663 Add Java api to add identity with name and number 2016-06-07 12:30:42 +09:30
Jeremy Lakeman
ce2131870c Fix rhizome op test that used recipient field 2016-05-31 13:05:06 +09:30
Jeremy Lakeman
d9e89fd299 Add meshms restful stress test 2016-05-31 12:53:37 +09:30
Jeremy Lakeman
16a14269af Encrypt payloads without needing a sender
- reworked keyring identity handling to reduce memory searching
2016-05-31 12:50:32 +09:30
Jeremy Lakeman
89ab832c21 Link multiple versions of a journal payload to the same file 2016-05-24 14:47:49 +09:30
Jeremy Lakeman
dced3bbb91 Avoid 1 second delay in tests when using curl to post forms 2016-05-18 12:11:58 +09:30
Jeremy Lakeman
b55926b081 Add configuration for idle_tick_ms so tests can complete faster without wasting power 2016-05-10 11:19:49 +09:30
Jeremy Lakeman
6feaddf24d Rework route print command to use newer mdp api, show live updates & deprecate monitor messages 2016-05-10 10:28:14 +09:30
Jeremy Lakeman
6cedb2d0ac Cleanup sync state when complete, or peers move out of range 2016-05-09 11:10:50 +09:30
Jeremy Lakeman
c5957e9c85 Transfer bundles via msp, triggered by key sync 2016-05-09 11:10:50 +09:30
Jeremy Lakeman
6b7aa800e4 Start syncing rhizome based on manifest hashes 2016-05-09 11:10:50 +09:30
Jeremy Lakeman
7939a780fb Fix case where eof mime boundary overlaps buffer boundary 2016-04-11 13:10:37 +09:30
Jeremy Lakeman
2241a15e48 Use file locking to better detect if the server really is running 2016-04-06 14:57:30 +09:30
Jeremy Lakeman
5636edfe20 Append manifest into zip file comment 2016-03-30 16:25:43 +10:30
Jeremy Lakeman
9feffb89c0 Add test for missing file 2016-03-08 14:59:13 +10:30
Jeremy Lakeman
b5afcf9a8f Fix vomp stun test after route print change 2016-03-07 16:11:27 +10:30
Jeremy Lakeman
c1947cf774 Add prior hop SID to route print output 2016-03-02 10:51:16 +10:30
Andrew Bettison
fa4fd02fbd Fix MSP test case after switching to nc6 2016-02-15 18:41:54 +10:30
Andrew Bettison
3e4470bf4a Use nc6 in MSP tests instead of nc
On OS-X (BSD), nc6 appears to be the only available variant of
netcat that matches the Linux version.

Introduces a guard function to catch invocations of nc6 when
setup_netcat6 has not been called in the fixture.  Introduce
guard functions to prevent invocations of nc and netcat.
2016-02-15 18:41:54 +10:30
Jeremy Lakeman
3b88b50d01 Make sure the test is performed on the correct serval instance 2016-02-01 15:05:27 +10:30
Jeremy Lakeman
389f16d2bb Establish a unicast link to a configured host on demand 2016-01-27 16:27:47 +10:30
Jeremy Lakeman
d0da910b19 Avoid undefined behaviour as highlighted by clang 2016-01-27 16:27:47 +10:30
Andrew Bettison
0361b99ca7 Fix OSX bugs in test framework
Use GNU grep, sed and awk instead of BSD variants.  Developers will have
to install these using a package manager like homebrew.  Updated the
INSTALL.md and doc/Development.md tech docs with instructions.
2016-01-27 00:24:43 +10:30
Jeremy Lakeman
75523b7f3c Don't talk about SID's that don't match the whole abbreviation 2016-01-12 10:29:46 +10:30
Jeremy Lakeman
912806360c Tweak netlink setup code in an attempt to prevent gcc mis-optimization 2016-01-11 14:40:23 +10:30
Jeremy Lakeman
77162fbaec Improve config overflow message 2015-12-14 10:31:38 +10:30