Commit Graph

125 Commits

Author SHA1 Message Date
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
Andrew Bettison
6488f7ad65 Fix basic bugs in new HTTP server code
All 'rhizomeprotocol' HTTP tests still fail
2013-10-25 17:38:51 +10:30
Andrew Bettison
640a61cbe5 Add 'debug.rhizome_httpd' config option 2013-10-16 11:23:45 +10:30
Andrew Bettison
3d3e900e72 First HTTP RESTful interface tests 2013-10-14 17:46:09 +10:30
Andrew Bettison
c9f9025581 Fix intermittent 'routing' test failures
Caused by tests running so slowly that nodes become unreachable due to
timeout before the assertion of reachability is made.  The timeout was
hard coded at five times the tick interval (2.5 seconds).

Introduced new config options: mdp.iftype.*.reachable_timeout_ms and
interface.*.mdp.reachable_timeout_ms to allow the timeout to be
configured.  Configure the timeout to 60 seconds in 'routing' tests.

Changed the config schema to move options interfaces.*.mdp_tick_ms and
interfaces.*.packet_interval into interfaces.*.mdp.tick_ms and
interfaces.*.mdp.packet_interval (introduced new sub-struct 'mdp').
2013-10-08 16:36:07 +10:30
Andrew Bettison
e3f64516d5 Add config option 'debug.rhizome_bind' 2013-10-04 03:46:52 +09:30
Andrew Bettison
c0aa4796a1 Remove MDP and Monitor socket names from config
Now they are fixed names under the instance path: "mdp.socket" and
"monitor.socket".
2013-09-25 16:56:06 +09:30
Jeremy Lakeman
ed21200289 Improve config description 2013-09-20 14:41:35 +09:30
gardners
fa157500b3 Add debug output for mavlink sent and received frames.
debug.interactive_io can be used to pause after sending or receiving a packet.
2013-09-10 15:14:23 +09:30
gardners
33ad9ae0bc Split debugging info related to ACK's and packet retransmissions 2013-09-10 14:53:12 +09:30
gardners
f02e55c443 add 32bit crc to mavlink frames, and reject those that fail. 2013-09-10 14:53:12 +09:30
gardners
7248e01567 Implement flow of mavlink packets over serial connections
Replaces upper-7 bit slip encoding
Solves reliability of reading radio status messages
2013-09-10 13:07:52 +09:30
gardners
0cbebedc77 Add tx throttling for packet radios
avoids missing data due to lack of flow control.
2013-09-10 11:53:38 +09:30
Jeremy Lakeman
44ab51e2ab Don't clean the database for every command line operation by default 2013-08-27 13:44:05 +09:30
gardners
06bb93c88b add extra debug option to trace MDP Rhizome transfer problems. 2013-08-25 21:16:33 +09:30
gardners
9b09021605 add test for falling over to MDP when HTTP rhizome fetching fails. 2013-08-25 16:37:44 +09:30
Jeremy Lakeman
1468d2deb0 Pre-emptively send small payloads via MDP 2013-08-21 09:21:40 +09:30
Jeremy Lakeman
a516af616e Improve reliability
- don't drop packets that haven't been resolved yet on incoming acks
- statistically drop unicast packets during tests
2013-08-12 16:38:37 +09:30
Jeremy Lakeman
ddfb7d9417 First cut of new meshms API, unfinished 2013-07-22 17:55:02 +09:30
Jeremy Lakeman
49e0286b43 Reduce packet header size for point-to-point links
- new interface.x.point_to_point config
- disable local echo for point to point dummy interfaces
- add ME and YOU sid abbreviation codes after learning other sid
2013-07-16 15:38:00 +09:30
Jeremy Lakeman
aa87168d7d Add per-interace dump of sent and received bytes 2013-07-15 15:27:41 +09:30
Jeremy Lakeman
c0b31a2774 Report packet acks, make routing decisions based on dropped packets 2013-05-08 11:37:02 +09:30
gardners
109fe77df9 add new debug option to show packet radio byte stream.
make uartbps default to 57600.
2013-05-07 17:29:11 +09:30
Jeremy Lakeman
85b885dde2 Add basic link state routing 2013-04-26 16:54:01 +09:30
gardners
3e7de24bdf added uartpbs and ctsrts config options to packet radio serial
interface configuration options.
2013-04-26 15:16:51 +09:30
Andrew Bettison
a8b88a462f Fix clang compiler warnings (revealed some bugs) 2013-04-12 17:16:50 +09:30
Andrew Bettison
b826ac1f1b Improve logging: add HINT level, NOWHENCE() macro 2013-04-09 17:23:19 +09:30
Andrew Bettison
ec481e5f0f Rename config option 'log.stderr' to 'log.console'
Because Android <stdio.h> defines 'stderr' as a macro...
2013-04-05 16:55:14 +10:30
Andrew Bettison
f7fc63c452 Improve logging tests, fix failures, add 'log.file.path' config option 2013-04-05 16:23:20 +10:30
Andrew Bettison
a822dca2fa Improve config schema macros and log options
Add STRUCT_ASSIGN macro to config schema

Document STRUCT_DEFAULT and STRUCT_ASSIGN in block comments

Move 'log.file_xxx' options to 'log.file.xxx'
2013-04-05 15:00:54 +10:30
Andrew Bettison
60551df890 Implement configurable log file rotation 2013-04-04 17:52:54 +10:30
Andrew Bettison
2d09ec545e Improve configuration dump to log
Refactor much of the new code in log.c

Add new functions: cf_load_strict() and cf_reload_strict() for use by the
server, which does not want to overwrite its in-memory config at all if there
is any defect in the config file.  However, commands always want to overwrite
the default in-memory config, even with a defective config file, so that
logging has a chance to succeed.

Added `log_format.dump_config` boolean config option
2013-03-29 00:22:08 +10:30
Andrew Bettison
95b0c028f2 Log to file, Android and stderr simultaneously
Indepent configuration of show_pid, show_time and log level for each
destination

Update test scripts for new config options

Include xprintf.c in MDP client source files (now used by log.c)
2013-03-27 16:17:38 +10:30
Andrew Bettison
d3d6fa4547 Add log format config options for file and stderr
Upgrade configuration schema macros to allow optional "default label"
argument to SUB_STRUCT and VALUE_SUB_STRUCT elements.

New STRUCT_DEFAULT section declares alternative STRUCT default values
with a label.
2013-03-26 16:11:31 +10:30
Andrew Bettison
c9f9ef5ed4 New config type: bool_t (char)
Replace 'int_boolean' and 'char_boolean' representations with 'boolean'.

Clean up spacing and column alignment in conf_schema.h
2013-03-05 12:35:30 +10:30
Jeremy Lakeman
4cdd3da77f Add config option to disable fetching via rhizome 2013-03-05 10:56:20 +10:30
Andrew Bettison
54ce857cff Improve config schema declaration
Remove array key SORTED flag; all arrays are now sorted by key

Use representation's comparison function for sorting arrays, not
a schema-supplied comparison function.
2013-03-01 15:27:28 +10:30
Andrew Bettison
5939aa9edc Add config cf_cmp_ functions 2013-02-27 18:11:18 +10:30
Andrew Bettison
4648f5096a Fix some config schema declarations
Replace 'int' representation with 'uint32_nonneg', so that default value
of -1 is out of reach of parser.
2013-02-27 16:30:23 +10:30
Andrew Bettison
6eb08ae805 Add new "config dump" command - not working yet
Add cf_fmt_xxx() functions for converting configuration structs into a
config object model tree.
2013-02-26 18:09:08 +10:30
Andrew Bettison
14ce5af688 Refactor configuration schema code
Replace 'parsefunc' (cf_opt_foo) function arguments in schema
declarations with 'repr' (foo) names, which are used to declare
cf_opt_foo and cf_fmt_foo.
2013-02-25 17:23:44 +10:30
Jeremy Lakeman
90386ce1b1 Merge remote-tracking branch 'origin/development' into serial
Conflicts:
	rhizome.h
	rhizome_database.c
	rhizome_fetch.c
	rhizome_store.c
2013-02-20 17:23:03 +10:30
gardners
944486c048 simplify external/internal blob storage to a boolean flag instead
of a threshold.
2013-02-20 16:18:59 +10:30
gardners
9e9f93b079 make external blob output conditional on debug flag. 2013-02-20 16:18:58 +10:30
gardners
5a3dec28d9 make rhizome over mdp idle timeout configurable at runtime. 2013-02-20 16:18:57 +10:30
gardners
a23612428b make rhizome over mdp block size configurable.
1K seems too big to be reliable on our prototype UHF radio links,
as CRCs fail almost all the time. #48
2013-02-20 16:18:57 +10:30
gardners
2252fdcaa7 created tool for automatically finding IN()s without matching
OUT()s or where return() is used instead of RETURN().
Added OUT() to end of all functions using IN() that lacked it to
make it easier to statically analyse this invariant.
Fixed several return instead of RETURNs detected through use of
this tool. #49
2013-02-20 16:18:56 +10:30
gardners
641d749ab4 Create files for large rhizome bundles
- configurable size threashold
2013-02-20 15:36:32 +10:30
gardners
f465f3a9ee Add lots of profiling to assist in debugging
- made some debug output conditional.
- make it possible to debug slip decoding without getting swamped by other output.
- Improve reporting of unnamed schedule() calls.
- always collect performance statistics, and report on any excess
  use (>1sec in every 3), even if debug.timing is not enabled.
- include file size information in Rhizome transfer messages.
- reduce output when debug.rhizome_rx is set.
2013-02-20 15:36:30 +10:30
gardners
80168e3530 Improve debug logging
- add debug.trace to help track down segfaults
- warn about alarms without names (which are then hard to track down).
2013-02-20 15:36:30 +10:30
gardners
042cfc3fa1 add debug.rejecteddata option for reporting bad packets/manifests
etc.
2013-02-20 15:36:26 +10:30
gardners
5b26cabee3 fixed bugs in UPPER7 SLIP encapsulation.
Improved debugging of the same.
2013-02-20 15:36:25 +10:30
Jeremy Lakeman
f2025cd601 Configure rhizome announce interval 2013-02-20 15:36:24 +10:30
Jeremy Lakeman
6d9bbe2e2c Refactor interface handling to separate encapsulation from stream type 2013-02-20 15:36:23 +10:30
gardners
190a5e693f refactored packet radio code mostly into separate file.
began writing stateful packet decoder.
2013-02-20 15:36:20 +10:30
Andrew Bettison
cf13a4b51e Add 'rhizome.clean_on_open' config option 2013-02-20 14:43:20 +10:30
Andrew Bettison
cfe4da687c New hton_in_addr() function
To silence warnings in struct in_addr assignments on Solaris, whose struct
in_addr definition is a monstrosity.
2013-02-05 16:56:37 +10:30
Jeremy Lakeman
b35c1aca43 Specify that unicast traffic should use unicast UDP packets 2013-01-29 11:57:13 +11:00
Andrew Bettison
546fccc794 Support relative log.file config option
As already documented in doc/Servald-Configuration.md
2013-01-23 14:54:25 +10:30
Jeremy Lakeman
e517e3a59e Add per-interface packet transmit limits 2012-12-14 17:07:28 +10:30
Andrew Bettison
5985df751d Overhaul debug flags
Replace debugflags_t and DEBUG_XXX bit masks with config schema "debug.xxx"
entries.

No more support for "debug.all".
2012-12-11 15:59:46 +10:30
Jeremy Lakeman
70266fc7e5 Resolve host names for use with a directory service 2012-12-10 16:15:37 +10:30
Jeremy Lakeman
2932544eb8 Add IPv4 addresses to dummy interface 2012-12-10 14:06:25 +10:30
Andrew Bettison
8425882ffc Merge branch 'newconfig' into 'master'
Conflicts:
	commandline.c
	conf.h
	dataformats.c
	log.h
	overlay_address.c
	overlay_interface.c
	packetformats.c
	rhizome.c
	serval.h
	tests/directory_service
	vomp_console.c
2012-12-07 14:09:55 +10:30
Andrew Bettison
ecdf32fbe2 Rename cf_opt_port() to cf_opt_uint16_nonzero()
Improves the usefulness of the 'config schema' output.
2012-12-07 11:14:05 +10:30
Andrew Bettison
aa638a9bfd Fix new 'interfaces' config option
Introduce CFINCOMPATIBLE config parse result flag.

Sort interface rules by unsigned integer key.

Legacy and modern 'interfaces' config styles are now incompatible.

Validate config_network_interface struct to enforce that only exactly one of
'match' and 'dummy' options are set.

Add test cases for 'interface' config option.
2012-12-05 12:58:07 +10:30
Andrew Bettison
c53789d764 Legacy 'interfaces' config option improvements
Legacy form is now incompatible with modern form.

Test case to check legacy parsing.
2012-12-04 18:22:26 +10:30
Andrew Bettison
71ed78e058 Make all 'config' tests pass
Change a test case: configuration options are now case sensitive.

Fix config file load and parse logic in conf.c, always copy 'debug' flags
from config.debug.

The config schema 'interfaces' option is no longer MANDATORY.

Introduce new CLIFLAG_PERMISSIVE_CONFIG to supress bad-config ERROR messages
from the 'config set' and 'config get' commands.

Refactor cli_execute() into cli_parse() and cli_invoke().  Use *const* struct
command_line_option everywhere.
2012-12-04 16:52:49 +10:30
Andrew Bettison
caa209fc1d Integrate new config into servald
Not passing any tests yet, but compiles and links and simple uses do not
SEGV.
2012-12-04 14:12:28 +10:30
Andrew Bettison
4aac3637ed Improve new config code, SORTED and NO_DUPLICATE flags
Config Object Model parser now returns bitmask result of CFxxx flags and only
allocates root node if the config file is non-empty.

Added emalloc_zero().
2012-11-30 12:32:30 +10:30
Andrew Bettison
f654d435b1 Rename some new config source and header files 2012-11-29 16:12:03 +10:30