Commit Graph

120 Commits

Author SHA1 Message Date
Jeremy Lakeman
c2956568d6 Send a meshmb message via restful api 2016-10-26 13:08:13 +10:30
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
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
Jeremy Lakeman
802310c6f1 Don't append meshms timestamps if the clock is considered unreliable 2016-05-31 13:00:48 +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
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
6b7aa800e4 Start syncing rhizome based on manifest hashes 2016-05-09 11:10:50 +09:30
gardners
52bd428c09 make rhizome http port number configurable via serval.conf 2015-08-24 16:06:25 +09:30
Andrew Bettison
7d9a5faa4e Move if(config.debug.xxx) tests into DEBUGF()
Original DEBUG() and DEBUGF() macros renamed to _DEBUG() and _DEBUGF()
New DEBUG() and DEBUGF() macros, first argument is flagname
New DEBUGF2(foo, bar, ...) macro does if(config.debug.foo||config.debug.bar) test
Replace almost all config.debug.xxx references to IF_DEBUG(xxx)
2015-07-13 16:00:05 +09:30
Andrew Bettison
819fa8bee4 No time stamps in Android log by default 2015-06-29 15:39:19 +09:30
Andrew Bettison
6febcc350d Replace RESTful newsince polling with triggers
Remove the 'api.restful.newsince_poll_ms' config option, no longer
needed.
2015-06-02 02:23:06 +09:30
Andrew Bettison
30f4a398ea Merge RESTful Rhizome journal append into development
Support for appending to Rhizome journals using the RESTful API
2015-04-13 16:59:06 +09:30
Andrew Bettison
dbe0cf862f Remove 'debug.manifests' option
Use existing 'debug.rhizome_manifest' instead
Improve format of manifest alloc/free log messages
2015-03-30 18:19:26 +10:30
Jeremy Lakeman
943bca3bea Add transmit timeout config per network destination for low bandwidth links 2015-03-30 14:15:08 +10:30
Jeremy Lakeman
f7dbe06836 Rearrange interface config to support unicast settings 2015-03-23 13:35:22 +10:30
gardners
2296196f7b Add config option to select packet radio type. 2014-10-01 15:52:14 +09:30
Andrew Bettison
ccece93309 Refactor "conf_schema.h" to fix compile warnings
In STRUCT() and ARRAY() declarations, change the optional "validator"
arg from taking a bare function name to enclose the function name in
VALIDATOR(function)
2014-08-14 16:40:30 +09:30
Andrew Bettison
11e9d38299 Rename config 'rhizome.api.restful' to 'api.restful' 2014-06-30 11:11:01 +09:30
Jeremy Lakeman
31dbfa4e58 Improve debug info for rhizome sync 2014-06-28 20:27:29 +09:30
Jeremy Lakeman
75d488b339 Add new debug flag to show what payloads are being included in network packets 2014-06-28 20:17:26 +09:30
Jeremy Lakeman
ca8f651b8d Cleanup the rhizome database every 30 minutes or so 2014-06-23 13:49:58 +09:30
Jeremy Lakeman
2ef73884a1 Add configurable limit to ensure a minimum amount of free space is preserved
- default to 100MB of free space
- currently disabled on android due to missing sys/statvfs.h
2014-06-23 13:06:21 +09:30
Jeremy Lakeman
7ff89afcf4 Reinstate rhizome database storage limit
- old / large payloads should be evicted to fit more payloads
- if there isn't enough space, new payloads will not be added
2014-06-19 11:09:09 +09:30
Jeremy Lakeman
f4e6841ed7 Ensure directory service tests aren't creating a global routing table 2014-06-16 17:22:46 +09:30
Jeremy Lakeman
c1fc33542d Default to using unicast link layer packets 2014-05-26 14:36:58 +09:30
Jeremy Lakeman
b94378ae97 Remove unused debug flags 2014-05-26 14:01:34 +09:30
Jeremy Lakeman
ca9faeef9b Remove respawn_on_crash behaviour, we aren't using or testing it 2014-05-12 13:44:51 +09:30
Andrew Bettison
ea9de737a2 MDP packet filter rules configuration
Configurable rules file path: mdp.filter_rules_path

Add filter rules parsing code, add filtering to outgoing as well as
incoming packets

New test script: tests/mdp with two test cases

Improve test defs: new execute_servald() function

Widen MDP port number format from 8 to ten chars to accommodate leading
"0x"
2014-04-29 15:31:50 +09:30
Andrew Bettison
e80cce72a0 Configurable MOTD (Message of the Day) on HTTPD root page
Also improve root page HTML: change <br> to <br />
2014-04-29 13:57:29 +09:30
Andrew Bettison
5d9e3f1287 New config option: 'debug.config'
Logs some information about configuration file loading and re-loading
2014-04-16 19:12:01 +09:30
Andrew Bettison
d022bbdf27 New config option: server.config_reload_interval_ms 2014-04-16 18:24:16 +09:30
Andrew Bettison
2716228074 Add server watchdog and config reload test 2014-04-16 18:06:27 +09:30
Jeremy Lakeman
23cb4600e2 Improve VOMP testing 2014-04-10 11:14:46 +09:30
Andrew Bettison
53c1b1c04c Filesystem Heirarchy Standard (FHS) paths
If no instance directory specified, then use paths like
/etc/serval/serval.conf
/var/cache/serval
/var/log/serval
/var/run/serval
etc. for files, instead of all in a single directory.

Log all directory creation as INFO messages.

Interpretation of log.file.directory_path has changed slightly.

Updated servald configuration tech doc.
2014-03-26 15:35:43 +10:30
Jeremy Lakeman
ee68856878 Reduce log spam from debug.rhizome 2014-03-12 14:32:59 +10:30
Andrew Bettison
0bef066949 Store Rhizome external blob files in "blob" subdirectory
This will make issue #50 a bit easier to tackle
2014-03-07 16:55:38 +10:30
Jeremy Lakeman
33cbc98300 Add proc files for http server & mdp udp ports 2014-02-24 17:15:28 +10:30
Jeremy Lakeman
7ed6be3690 Introduce basic vomp console test 2014-02-19 16:39:05 +10:30
Andrew Bettison
015ed0b181 Refactor to rename "Rhizome HTTP server" to "HTTPD server"
Move HTTPD start/stop/dispatch logic from rhizome_httpd.c into new
httpd.c

Rename config.debug.httpd -> config.debug.http_server
Rename config.debug.rhizome_httpd -> config.debug.httpd
Rename config.debug.rhizome_nohttptx -> config.debug.nohttptx
2014-02-03 15:56:07 +10:30
Jeremy Lakeman
68421db114 Add msp debug flag 2014-01-09 15:06:35 +10:30
Andrew Bettison
34188fa489 Replace config 'rhizome.external_blobs' with 'rhizome.max_blob_size' 2013-12-30 16:30:43 +10:30
Jeremy Lakeman
d45470ce81 Refactor radio link for better encapsulation 2013-11-27 13:13:08 +10:30
Jeremy Lakeman
1681abd620 Increase default mdp timeout & make it configurable 2013-11-27 13:10:11 +10:30
Jeremy Lakeman
ad33264834 Rename mavlink to radio_link
- split link state from slip structures and encapsulate it completely
- allocate interface specific buffers on demand
2013-11-27 13:09:26 +10:30
Andrew Bettison
851dbb4d64 Add 'debug.subscriber' config option
Add debug logging to find_subscriber() function
2013-11-26 15:33:54 +10:30
Andrew Bettison
a9ccd38adc Improve overlay buffer ob_xxx() primitives
All ob_append_xxx(b,...) functions return void

ob_makespace() returns 1 if successful, 0 if not

Add ob_overrun(b) predicate to check for overrun after any number of
appends
2013-11-26 15:33:54 +10:30
Andrew Bettison
29fab6dcb7 Add 'rhizome.api.restful.newsince_poll_ms' config option 2013-11-20 14:50:57 +10:30
Andrew Bettison
fce0893173 Implement HTTP /restful/rhizome/newsince/.../bundlelist.json
Now functions as per requirements, blocks for 60 seconds sending
new bundles as they appear, sends new token with each new bundle.
Tested manually.
2013-11-19 15:43:51 +10:30
Andrew Bettison
bacba19dc1 Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.

Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key.  These maintained by the setter functions.

Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.

More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c.  More uniform use of
size_t to dimension memory buffers.  Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems.  Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.

Replace some 'int' loop variables with 'unsigned' where appropriate.

Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.

Instrument the first MeshMS test case to aid debugging.

New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.

Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-11-04 19:17:49 +10:30