Commit Graph

149 Commits

Author SHA1 Message Date
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
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
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
7cc4324ac6 added facility to log a clue for crash handler to hint where things
got stuck/caused a crash.
2013-02-20 15:36:31 +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
1e76772c3a print a back trace whenever any signal is received. 2013-02-20 15:36:30 +10:30
Andrew Bettison
f66a894a63 Improve keyring PIN handling
Replace explicit [<pin,pin...>] command-line arguments with --entry-pin=<pin>
options.  Update test scripts accordlingly.

Add --keyring-pin=<pin> option (with one test case).
2013-02-13 16:49:52 +10:30
Andrew Bettison
8d5862d599 Server daemon reloads config every 1 sec 2012-12-14 16:48:12 +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
Jeremy Lakeman
f93216f369 Remove dead code 2012-10-19 15:02:22 +10:30
Andrew Bettison
4ecb996909 Issue #21, INFO message on unlink a stale pidfile 2012-10-08 17:20:19 +10:30
Andrew Bettison
89343c69cd Merge branch 'rhizomedirect' into 'master' 2012-10-05 17:45:30 +09:30
Andrew Bettison
fb7c9e5633 Fix compiler warnings on Linux gcc 4.7.1 2012-09-27 11:02:58 +09:30