Commit Graph

1232 Commits

Author SHA1 Message Date
Andrew Bettison
f002f5b9fd Refactor log.h constants.h serval.h
Move DEBUG_ and LOG_LEVEL_ macro constants from constants.h into log.h.

Move dumpResponses() out of log.c, so that log.h is almost ready for re-use
(still depends on conf.h).

Remove unused and now obsolete catv() function -- replaced with toprint()
and alloca_toprint().

Add copyright/licence comments, fix up some copyright attributions.

Add #ifndef..#define..#endif __SERVALD_FOO_H to header files: log.h serval.h
constants.h
2012-07-30 16:15:42 +09:30
Andrew Bettison
d63318cd2f Mop up executable rename from 'dna' to 'servald' 2012-07-30 16:15:42 +09:30
Daniel O'Connor
9cf4d5529a Refactor out socket name setting code into one place.
This consistently handles abstract vs normal sockets with a single switch.

overlay mdp tries to have both (abstract & normal) but the code paths seem different, I have consolidated them.

Needs more testing.
2012-07-29 22:20:54 +09:30
Daniel O'Connor
09d0fecf28 Remove carnal knowledge of conf.c from serval.h and commandline.c by providing a function to set the instance path override. 2012-07-29 18:58:41 +09:30
Daniel O'Connor
c241d3630c Move debug options to Makefile.dbg so we don't have to re-run configure.
Remove DO_TIMING_CHECK since it's no longer used
2012-07-29 14:55:10 +09:30
Daniel O'Connor
dbbf4bff1c Add file to set emacs variables to match the prevailing style. 2012-07-29 13:52:46 +09:30
Daniel O'Connor
5e43c81214 Sort source files 2012-07-29 13:09:13 +09:30
Daniel O'Connor
3907eb3842 Use variables for source/object files. 2012-07-29 13:04:03 +09:30
Daniel O'Connor
8cc08699ca Fix warning caused by user sourced format string (not a real error) 2012-07-29 13:03:11 +09:30
gardners
72f8b1916d minor fixes to get things building with monitor client library. 2012-07-29 12:44:04 +09:30
gardners
274a77fa46 Refactor serval.h to split out log, config and other bits so that
we can have a standalone ServalD monitor client library and simple
header file.  Create that too.
2012-07-29 12:42:27 +09:30
gardners
93449d380e various fixes for libmonitorclient and commits made by others
inbetween. Hopefully I have captured all the changes.
2012-07-29 12:35:53 +09:30
Andrew Bettison
8db737ee6f Quieten startup logging a bit 2012-07-27 19:59:16 +09:30
Andrew Bettison
ce12258f63 Improve logging in keyring.c
Use DEBUGF() not WHYF() for debug messages, test DEBUG_KEYRING.

Use WHY_perror() in more places.
2012-07-27 18:18:57 +09:30
Andrew Bettison
bb97a80452 Minor improvements to 'dnaproctocol' tests 2012-07-27 18:04:46 +09:30
Andrew Bettison
1da66a87ce Fix bug that non-deterministically broke 'dnaprotocol' tests
If a selfannounce ack was received in millisecond zero, then the peer did not
show up as routable.
2012-07-27 18:04:46 +09:30
Andrew Bettison
15d7bec680 Rewrite fprintf(stderr,...) to DEBUGF() 2012-07-27 18:04:46 +09:30
Andrew Bettison
2152c9267f DEBUG_VERBOSE log messages for all command-line commands 2012-07-27 18:04:46 +09:30
Andrew Bettison
3b1adc3a31 Add DEBUG_argv() and WHY_argv() macros
Implemented usng new logArgv() function.

Refactored logMessage()
2012-07-27 18:04:46 +09:30
Andrew Bettison
bbd28eed45 Add strbuf_toprint(), strbuf_toprint_quoted(), etc. 2012-07-27 18:04:46 +09:30
Daniel O'Connor
6d83fddbe5 Rename strnstr as it already exists in FreeBSD & OSX (with different argument ordering).
Arguably we could detect it but I couldn't be bothered dealing with auto*
2012-07-27 16:47:05 +09:30
Andrew Bettison
0dee99dec2 Remove old command-line support 2012-07-27 11:44:20 +09:30
Andrew Bettison
bb5d658779 Rewrite many fprintf(stderr,...) to DEBUGF(...) 2012-07-27 11:29:27 +09:30
Andrew Bettison
62d851f97c Improve DEBUG_GATEWAY debugging
Rewrite all fprintf(stderr,...) to DEBUGF(...)

Improve error reporting from runCommand() and safeSystem(), make them local to
gateway.c
2012-07-27 11:28:14 +09:30
Andrew Bettison
a69f637b3a Replace DEBUG_HLR with DEBUG_KEYRING
Convert several fprintf(stderr,...) into DEBUGF() statements
2012-07-27 11:26:19 +09:30
Andrew Bettison
82648b7e63 Improve logging -- first log INFO message 2012-07-26 18:34:50 +09:30
Andrew Bettison
a6a81a0f64 Improve server signal handling
Use sigaction(2) instead of deprecated signal(2), allowing SEGV et al to be
received in handler and therefore in re-spawned server.

Receive SIGSEGV et al in a separate handler function which kills the server
with the same signal if it does not re-spawn.

Log a GDB backtrace on SEGV et al before exiting or respawning.

Rename config option "serval.respawn_on_signal" to "server.respawn_on_crash".
2012-07-26 18:31:23 +09:30
Andrew Bettison
99ead3b9b1 Add strbuf_append_shell_quote() function 2012-07-26 18:30:24 +09:30
Andrew Bettison
81cafe9d6f Improve log_backtrace() function
Add BACKTRACE macro.  Improve gdb output buffering: log each line individually,
read progressively, reduce buffer size.  Log diagnostics if gdb cannot be run.
2012-07-26 16:51:59 +09:30
Andrew Bettison
ed2410c152 Add strbuf_end() function 2012-07-26 16:47:17 +09:30
Andrew Bettison
6b23bcba51 Enable log_backtrace() on Mac OS X (untested) 2012-07-25 18:19:32 +09:30
Andrew Bettison
e9abed6efb Remove redundant logging from 'dnaprotocol' tests 2012-07-25 18:04:45 +09:30
Andrew Bettison
04b95d2590 Merge branch 'andrew' into 'master' 2012-07-25 18:04:16 +09:30
Andrew Bettison
f2ddc00797 Fix SEGV bug in new overlay abbreviation code 2012-07-25 17:45:57 +09:30
Andrew Bettison
d8fc9bd3c2 Fix DEBUG_OVERLAYEBBREVIATIONS from fprintf(stderr) to DEBUGF() 2012-07-25 17:43:44 +09:30
Andrew Bettison
2b57773472 Add log_backtrace() function 2012-07-25 17:02:57 +09:30
Andrew Bettison
c545061b50 Add server.respawn_on_signal config option 2012-07-25 17:02:57 +09:30
Andrew Bettison
ba69ae616f Improve test framework: fix tfw_core_backtrace
Was not actually printing a gdb backtrace
2012-07-25 17:02:57 +09:30
Jeremy Lakeman
6e7c2196ba Close interfaces on socket errors or when not detected 2012-07-25 16:53:44 +09:30
Jeremy Lakeman
74095e5356 Correctly display interface ip addresses on android 2012-07-25 14:53:53 +09:30
Jeremy Lakeman
5ec739c712 Add performance timing debug option 2012-07-25 13:33:30 +09:30
Jeremy Lakeman
9a16fe4e96 Fix compilation for android 2012-07-24 16:04:59 +09:30
Andrew Bettison
6de247e576 Improve diagnosis of SEGV failures in tests 2012-07-24 15:39:36 +09:30
Andrew Bettison
6b07b4c22e Improve test framework: support gdb core dumps
Add --core-backtrace option to execute() function
Add tfw_core_backtrace() function
2012-07-24 15:38:36 +09:30
Andrew Bettison
54da59bc56 Fix DNA helper so all tests pass
Added a couple more 'dnahelper' tests for timeout conditions
and spurious output
2012-07-24 11:29:07 +09:30
Andrew Bettison
f472ac9a8d Lots of 'dnahelper' tests, all pass but one
Test fails because DNA helper logic does not yet impose a timeout on receiving
the "DONE" ACK after a request.
2012-07-23 18:29:57 +09:30
Andrew Bettison
10fd1c1fc6 Improve test framework: log message from assertStdoutIs 2012-07-23 15:18:11 +09:30
Andrew Bettison
3e0f8df18a Fix bug in DID parsing, affects "set did" command 2012-07-23 15:17:21 +09:30
Andrew Bettison
30567c1d34 Start writing systematic 'dnahelper' tests 2012-07-23 12:23:17 +09:30
Andrew Bettison
0e5c5e0e98 More work on dnahelper, almost done
Servald starts DNA helper, receives startup ACK, sends requests, receives
responses, handles malformed helper responses, echoes dnahelper stderr lines to
log, sends MDP reply packet, waits for dead helper process, all asynchronously.
Shuts down helper process during servald shutdown.

Remaining issues:
 - Does not impose a timeout on helper responses.
 - Only the first URI is reported by the "dna lookup" command.
2012-07-20 18:17:43 +09:30