Commit Graph

162 Commits

Author SHA1 Message Date
Jeremy Lakeman
79e8a94792 Add route_link.h 2015-09-28 11:58:48 +09:30
Andrew Bettison
a276fc9d28 Remove Rhizome enabled test from Keyring REST API 2015-09-28 09:56:15 +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
Jeremy Lakeman
5aeb9b960d Move config to a thread local 2015-06-15 14:14:41 +09:30
Jeremy Lakeman
a3de276999 Allow SIGIO to unblock poll() without dying 2015-06-01 16:46:21 +09:30
Jeremy Lakeman
51ed6162dd Add support for running and stopping servald from a JVM thread
fdpoll will now run a callback when about to sleep / woke up.
A new Java interface to indicate server started / sleeping / waking up.
An android implementation may allow the CPU to sleep.
If there's a java exception the server will try to shutdown.
Calling servald stop is currently undefined.
2015-05-25 11:46:37 +09:30
Jeremy Lakeman
fea91f3f82 Use configured reachable timeout for network links, read dummy files even when not ticking 2015-03-30 17:38:40 +10:30
Jeremy Lakeman
7bc253e844 Refactor source and build process to split out test commands 2014-12-01 13:26:27 +10:30
Jeremy Lakeman
dac67c7059 Small fixes while testing directory services 2014-09-12 15:24:23 +09:30
Jeremy Lakeman
83949f6585 Never call at_exit functions from android dalvik vm 2014-09-08 11:24:19 +09:30
Jeremy Lakeman
a37db8e958 Move most console commands to other files 2014-08-25 16:03:30 +09:30
Jeremy Lakeman
6f5160bf54 Don't return from server() as we can't guarentee that everything is cleaned up. 2014-06-30 22:37:55 +09:30
Jeremy Lakeman
31dbfa4e58 Improve debug info for rhizome sync 2014-06-28 20:27:29 +09:30
Jeremy Lakeman
0cb68c98a3 Open the database immediately on config load 2014-06-23 15:31: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
52da7778cd Allow closing a monitor connection to force the server to quit 2014-06-11 20:39:26 +09:30
Andrew Bettison
d46939f81e Improve server start/stop logic
Unlink server pidfile on orderly exit

Only call serverCleanUp() in server process, not in "start" command
(fixes race condition)
2014-06-11 15:18:25 +09:30
Andrew Bettison
a1c42eb378 Move serverMode flag from log.c to server.c 2014-06-11 14:53:26 +09:30
Jeremy Lakeman
afd31fe12c Ensure a race condition while starting servald only starts one process 2014-06-11 09:01:56 +09:30
Jeremy Lakeman
0b0e4cc8b4 Delay rhizome open database using an alarm, close on config change 2014-06-11 09:01:55 +09:30
Jeremy Lakeman
f09e6c38d2 Test that server quits after deleting pid file 2014-06-05 14:55:50 +09:30
Jeremy Lakeman
6d4ad0e150 Rework scheduler to allow for lazy but important alarms 2014-06-04 17:13:08 +09:30
Jeremy Lakeman
f93fba11af Stop polling interfaces if no phsical interfaces are enabled 2014-06-04 17:13:08 +09:30
Jeremy Lakeman
b6de3fcd34 Only send rhizome sync packets when we have neighbours 2014-05-30 15:03:22 +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
2c0efc6334 Set up SEGV crash handler in main() not server()
Now all commands will attempt to log a GDB backtrace on a crash, not
just the server daemon process.

Added strbuf_append_signal_name()
2014-05-08 14:24:00 +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
684735b11c Fix config file timestamp bug
Ensure that timestamp always advances by at least one second every time
the config file is modified, add test case

Refactor test defs: detecting started HTTPD is not specific to Rhizome

Refactor struct file_meta and associated functions into "io.h" and io.c

Add various strbuf helper functions for formatting struct timespec
and struct file_meta to assist debug logging
2014-04-29 15:04:20 +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
Andrew Bettison
bb677e50fd Refactor keyring open/seed out of server()
Now the keyring is opened and seeded before the server daemon process is
forked, and any keyring error prevents the server from starting

No longer necessary to pass a (cli_parsed*) argument to server()
2014-04-07 16:22:31 +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
a6f408f013 Return mdp inet & http port numbers in servald start & status 2014-02-25 12:42:36 +10:30
Jeremy Lakeman
33cbc98300 Add proc files for http server & mdp udp ports 2014-02-24 17:15:28 +10:30
Jeremy Lakeman
ae67dd9c56 Initialise client API sockets before PID file 2014-02-24 17:14:35 +10:30
Jeremy Lakeman
04955f1ddd Fix interface name comparison for detecting real interfaces 2014-01-20 16:01:29 +10:30
Jeremy Lakeman
506518ad06 Allow interfaces to use local unix addresses
- broadcast packets are sent to all sockets in the same folder
- switched most tests to use local sockets
2014-01-09 15:01:38 +10:30
Jeremy Lakeman
5f2c6e364a Refactor interface addresses to use new socket_address struct 2014-01-09 15:01:38 +10:30
Andrew Bettison
5d741361ea Fix -Wsign-compare warnings: make loop counters unsigned 2013-12-10 16:21:23 +10:30
Jeremy Lakeman
0085291ae6 Remove stop file last during server shutdown to allow database cleanup 2013-11-21 18:11:47 +10:30
Andrew Bettison
ba0ab14c69 Clean up inclusion of <netinet/in.h>
Make all #include <netinet/in.h> conditional upon HAVE_NETINET_IN_H

Remove unnecessary #include <netinet/in.h> from source files

Reformat include block in "serval.h" for readability
2013-11-12 11:39:06 +10:30
Andrew Bettison
32ce7f5ed9 Do not catch SIGQUIT
So that it can be used to make a core dump during manual debugging
2013-11-08 18:25:33 +10:30
Andrew Bettison
5d7ea6e6f5 Improve logic and logging in server_pid() 2013-10-07 04:47:23 +10:30
Andrew Bettison
7d30b3cce7 Pass command-line args to server() function
So that the daemon can open the keyring file with --keyring-pin and --entry-pin
options.

Also remove some unused code.
2013-08-30 11:20:19 +09:30
Jeremy Lakeman
bf7d0d5b16 Cache rhizome read state when serving content via MDP 2013-08-16 14:57:28 +09:30
Jeremy Lakeman
6c85999917 Log crashes and unexpected signals as FATAL 2013-07-31 14:53:52 +09: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
300ec986f1 Fix warnings from gcc 4.6.3 2013-03-18 16:48:15 +10:30
Andrew Bettison
a5d3c16928 Move 'serverMode' flag from server.c to log.c
Because log.c and conf.c now depend on serverMode
2013-03-18 15:34:33 +10:30