Commit Graph

1347 Commits

Author SHA1 Message Date
Andrew Bettison
f37ec5af09 Reduce use of stderr in many places
serval_packetvisualise() is now replaced by DEBUG_packet_visualise() which uses
logging system not stderr (so now it will appear in Android log).

Replaced several fprintf(stderr,...) with DEBUGF(...).

Command line only prints a full help message on "help" command -- a command
parse failure simply informs the user about the "help" command.
2012-08-01 17:54:02 +09:30
Andrew Bettison
560e0c6699 Add logString() function 2012-08-01 17:52:38 +09:30
Andrew Bettison
2bd7c38483 Remove unused trans_cache.c 2012-07-31 18:12:20 +09:30
Andrew Bettison
76cfb7beae Fix bug failed dnaprotocol tests non-deterministically
Appending to the dummy interface file was altering the read offset position, so
very many receive packets were being lost.
2012-07-31 17:49:24 +09:30
Andrew Bettison
ac12eac5bc Remove a line of redundant log debug 2012-07-31 17:49:00 +09:30
Andrew Bettison
cd168ac368 Improve dnaprotocol tests: enable logging in commands 2012-07-31 17:47:59 +09:30
Andrew Bettison
91fd0a7801 Improve test framework: always log stderr on some assertions 2012-07-31 17:47:09 +09:30
Andrew Bettison
24b05eaeaa Fix bug in self-announcements
On first tick, do not send s1 = 0, but s1 = s2 - 1 (1 ms window)
2012-07-31 16:21:29 +09:30
Andrew Bettison
813cf94f79 Replace fprintf(stderr,...) with DEBUGF(...) 2012-07-31 16:20:48 +09:30
Andrew Bettison
dbef192513 Improve dump() logging primitive 2012-07-31 16:20:09 +09:30
Andrew Bettison
ddc17434c4 Fix next-hop logic for case of no interfaces up 2012-07-30 18:35:28 +09:30
Andrew Bettison
55f22c8cd5 Convert fprintf(stderr,...) to DEBUGF() 2012-07-30 18:35:06 +09:30
Andrew Bettison
240be25793 Replace overlay_gettime_ms() with gettime_ms() 2012-07-30 17:22:38 +09:30
Andrew Bettison
b9396505f8 Remove some unused declarations 2012-07-30 16:15:42 +09:30
Andrew Bettison
07349c3aea Improve copyright attributions and comments 2012-07-30 16:15:42 +09:30
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