Commit Graph

150 Commits

Author SHA1 Message Date
Andrew Bettison
fb7c9e5633 Fix compiler warnings on Linux gcc 4.7.1 2012-09-27 11:02:58 +09:30
Jeremy Lakeman
7c73ca7a78 Finish test and implementation of directory service 2012-09-18 12:30:15 +09:30
Jeremy Lakeman
6483d9e0ae Split client mdp functions so they can be built separately 2012-09-14 11:47:48 +09:30
Paul Gardner-Stephen
bba6839656 Initial stab at porting to Solaris.
It compiles without warning (with CC=gcc) but doesn't link
because NaCL doesn't build yet.
2012-09-05 20:42:50 +09:30
Andrew Bettison
d8fd9fa411 Refactor nanosleep(2) calls into sleep_ms() function 2012-08-21 13:35:33 +09:30
Andrew Bettison
12d8bc0c12 Use new typedef time_ms_t everywhere 2012-08-09 12:14:32 +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
a69f637b3a Replace DEBUG_HLR with DEBUG_KEYRING
Convert several fprintf(stderr,...) into DEBUGF() statements
2012-07-27 11:26:19 +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
04b95d2590 Merge branch 'andrew' into 'master' 2012-07-25 18:04:16 +09:30
Andrew Bettison
c545061b50 Add server.respawn_on_signal config option 2012-07-25 17:02:57 +09:30
Andrew Bettison
6de247e576 Improve diagnosis of SEGV failures in tests 2012-07-24 15:39:36 +09:30
Andrew Bettison
3b44bb6e58 More progress on dnahelper 2012-07-19 17:59:45 +09:30
Jeremy Lakeman
27c24f377e Add deadline time for alarm prioritisation 2012-07-13 12:18:45 +09:30
Andrew Bettison
d2898ee22c Add output fields to 'keyring add' command 2012-07-06 13:17:53 +09:30
Andrew Bettison
78a8aaca16 Code improvements while debugging 'dnaprotocol' tests
Use ssize_t and size_t where required by system calls
More stringent checking of errors from system calls
Log the offset when writing to dummy interface file
Clean up many WHY/INFO/DEBUG statements
Convert many fprintf(stderr,...) to DEBUGF()
2012-07-03 15:36:51 +09:30
Andrew Bettison
8020ea3b74 Merge branch 'eventscheduler' into master
Conflicts:
	commandline.c
	monitor.c
	overlay.c
	overlay_interface.c
	overlay_packetformats.c
	rhizome_fetch.c
	rhizome_http.c
	rhizome_packetformats.c
	serval.h
	server.c
	testdefs.sh
	testframework.sh
	tests/dnaprotocol
	tests/server
2012-07-03 10:26:22 +09:30
Jeremy Lakeman
89566e4d3d Refactor how functions are scheduled or file handes are watched 2012-07-02 13:19:54 +09:30
Andrew Bettison
4516628c14 Replace fprintf(stderr,...) with DEBUGF 2012-07-02 12:52:21 +09:30
Andrew Bettison
a5ba1ecacd Clean up debugging code
Only use DEBUG inside "if (debug & DEBUG_BLAH)", not INFO or WARN or WHY!
INFO messages for starting/stopping servald server.
2012-06-28 15:37:36 +09:30
Jeremy Lakeman
29cba17891 Fix rhizome transfers 2012-06-27 16:54:42 +09:30
Andrew Bettison
4afdbe1b5e Add server start/stop tests 2012-06-26 15:52:37 +09:30
Andrew Bettison
5b56e2b131 Add server start/stop tests 2012-06-26 15:46:10 +09:30
Andrew Bettison
981afb795e Overhaul rhizome HTTP server start code 2012-06-26 11:07:01 +09:30
gardners
5dc6d122a5 significant progress towards clean callback scheduler for poll()
events and timed callbacks.
2012-06-22 16:05:49 +09:30
Andrew Bettison
0ec3feaa29 Expunge setReason()
Replace with WHY() or WHYF() everywhere

Improve logMessage() to handle file/line/function printing internally

Mainly so that log messages from manifest alloc/free in rhizome_bundle.c
can make it into the Android log
2012-05-24 17:11:55 +09:30
Daniel O'Connor
990a8f3057 Add support for srtuct ucred on BSD.
This requires building with _GNU_SOURCE to get access to struct ucred on Linux. Previously the test failed on every platform except glibc <2.8 or so.

Building with _GNU_SOURCE causes TRUE to be defined so we can't use this as a variable anymore, and MIN/MAX so don't define our own.
2012-05-21 12:22:50 +09:30
Andrew Bettison
f90b21ec78 Implement rhizome config options
rhizome.datastore_path - if not set, reverts to serval instance path
rhizome.enable - if not set, defaults to true
2012-05-15 12:56:10 +09:30
Andrew Bettison
7087afc404 Refactor main() into main.c
Now dna.c only contains code for the old command line
2012-05-15 11:09:21 +09:30
Andrew Bettison
d11258cefc Overhaul debug flags
Config debug flags are now represented as individual items, eg:
   servald config set debug.verbose yes
   servald config set debug.rhizome yes
instead of aggregated, eg:
   servald config set debug verbose,rhizome  <-- no longer works

Added a debug flag "debug.all" that can be set and cleared, over which
individual flag sets/clears take priority.

Slimmed down dna.c by moving some globals and functions to the files where they
are used.

Default command line (help message) is now the new style, not the deprecated
style.
2012-05-14 18:37:32 +09:30
Andrew Bettison
e746557a08 Fix bug in overlay_gettime_ms()
The sequence start time was only getting set in overlay_interface_init(), which
was not always called, or was called after overlay_gettime_ms() had already
been used.

Added FATALF(), FATAL() and FATAL_perror() macros.

Removed a bunch of debug statements no longer needed in monitor.c and server.c.
2012-05-11 10:38:46 +09:30
Andrew Bettison
881576212c Fix all trivial compiler warnings 2012-05-10 18:08:59 +09:30
Andrew Bettison
d96d8ff8d6 Move signal handling to server.c
Improve diagnostic messages from signal handler

For some reason, signal handler was not being set in server process when called
from main()
2012-05-09 19:06:44 +09:30
Andrew Bettison
836f8332e8 Replace perror() with WHY_perror()
Puts more diagnostics to Android log
2012-05-08 14:53:34 +09:30
Andrew Bettison
c6968c430a Minor bug fix in diagnostic output 2012-05-08 14:04:41 +09:30
Andrew Bettison
391e8d7056 Fix broken stopfile logic
'start' command removes stopfile just before starting
'stop' command removes stopfile after stopping
2012-05-08 12:53:59 +09:30
Andrew Bettison
329189ec8c Fix bodgy server start/stop logic
Rename pidfile 'serval.pid' to 'servald.pid'
Rename stopfile 'doshutdown' to 'servald.stop'
Reinstate checking of stopfile on signals and in main loops
Correct delay loops in 'start' and 'stop' commands
Move some code from commandline.c to server.c
2012-05-08 12:19:52 +09:30
Andrew Bettison
6376baf8b8 Follow-up fixes to serval.pid clobber termination 2012-05-08 11:27:07 +09:30
Andrew Bettison
acc5e48f4f Terminate server process if serval.pid clobbered 2012-05-08 11:23:43 +09:30
Andrew Bettison
09f8434a21 Improve "start" command
Add "start exec <exec path>" variants for background mode
Add background startup wait logic, so that pid can be reported to caller
2012-05-07 19:14:52 +09:30
Andrew Bettison
cbc367b1f5 Rewrite server start/status/stop commands
Now correctly probes for server process existence using kill(pid, 0)
Status command does not dump config (use "config get" instead)
Output uses JNI cli output fields
Stop command uses 5 Hz wakeup, not busy wait while server exits
2012-05-07 13:49:38 +09:30
gardners
14e4af6392 DNA replies now include name. "set did" now accepts name.
Keyring now stores name. "node info resolvedid" now returns name.
2012-05-01 14:38:09 +09:30
gardners
283b29af6b Improved packet tx and rx debugging and made it more logical. 2012-04-14 06:38:11 +09:30
gardners
faa2f5ef6c Fixed keyring opening sequence for overlay mode. 2012-04-14 02:38:09 +09:30
gardners
aa7da3e2c9 Fixed format of DIDs when sending DNA resolution replies from
new keyring format.
2012-04-13 10:27:38 +09:30
gardners
099e7ab118 Fixed searching for DIDs with wildcard with keyring.
General improvements to handling identities from keyrings.
Fixed placing of DONE flag for each identity that a query
produces results as.
Various other fixes.
2012-04-13 10:23:59 +09:30
gardners
3e920c8dfa simple server mode now correctly opens and populates keyring
with any identities with blank pins.
2012-04-13 09:35:22 +09:30
gardners
5ac83f9ca1 Replaced use of HLR with keyring for phone number lookups and
other functions.  Not yet tested.
2012-04-13 09:25:03 +09:30
Andrew Bettison
91d19df5cb Ressurect testdna script 2012-04-03 19:15:39 +09:30
Andrew Bettison
e87e80aee7 Create instance directory in "set" and "node start" 2012-03-29 15:03:17 +10:30
Andrew Bettison
a338c2f0f9 Refactor instance path handling
- handle buffer limits when forming path names within instance dir
 - uniform use of serval_instancepath()
2012-03-29 14:07:07 +10:30
Andrew Bettison
4e29cb1eb3 Fix some dodgy code and remove the #warning message pointing to it 2012-03-26 15:03:57 +10:30
gardners
4cc2890637 Added warning for handling of sid in a function that appears to violate
some previous assumptions in the code.  To be examined.
2012-03-17 09:28:49 +10:30
gardners
2a2e520ef5 Various fixes and additions to enable "dna node start" and "dna node stop"
command line options to work.
2012-03-15 10:57:37 +10:30
Andrew Bettison
738b70b513 Test and fix ACTION_CREATEHLR idempotency code:
- refactor hlrSid() to not return pointer to static buffer, take 3rd arg instead
 - introduce SID_STRLEN macro constant, use it everywhere
 - reformat some code for readability
2012-03-14 12:00:54 +10:30
Andrew Bettison
6d8089031b ACTION_CREATEHLR does not create new SID if DID already created 2012-03-13 16:35:15 +10:30
Andrew Bettison
ceefd9b22b Fix SEGV bug in new transaction cache code 2012-03-13 16:35:15 +10:30
Andrew Bettison
f04a995c5c First cut at transaction caching to eliminate duplicate message deliveries 2012-03-13 16:35:14 +10:30
gardners
1eb4c34015 Renamed mphlr.h to serval.h
(also some temporary debugging has been added in some places)
2012-02-23 12:45:42 +10:30
gardners
2494788390 Mark sockets close on exec so that they don't get stuck/lost when
we restart ourselves due to an uncaught signal.
2012-02-23 11:59:06 +10:30
gardners
3fed04e6cd Added some extra checks for memory corruption (of course now that I
am looking, the problem is not happening).
2012-02-15 23:51:12 +10:30
gardners
ce2afbe2ab Various fixes and addition of memory corruption framework (not yet active).
Rhizome now advertises all manifests, instead of accidently skipping some.
2012-02-15 23:38:23 +10:30
gardners
9d3ab08f1e added debug output to help track down the recvmsg() control message IDs
on linux (seem to be different than on BSD).
2012-02-05 17:53:51 +10:30
gardners
355237cc6a removed IP_RECVDSTADDR which doesn't seem to exist on Linux
(or at least on the Android environment)
2012-02-05 16:21:55 +10:30
gardners
5cc6079c0f Move from recvfrom() to recvmsg() so that we can get packet TTLs on
reception.  Other changes associated with overlay mesh.
2012-02-05 16:15:19 +10:30
gardners
800f8d41eb Revamped debug/verbosity control to use flags for functions of interest
instead of general verbosity ramp.
2012-01-10 15:56:40 +10:30
gardners
0868e30caa Fixed issues with recognition of valid packet formats. 2012-01-09 04:30:23 +10:30
gardners
ccf26e1fe0 Rhizome web server can now serve a 400 error message, which means
that lots of the underlying stuff is now in place.
2011-12-23 04:25:18 +10:30
gardners
ad88045ca6 Rhizome web server progress. Still not working, but poll() now is
doing what it should, and we are detecting closed sockets.
Now to add some parsing etc.
2011-12-22 21:58:18 +10:30
gardners
60e391ecd5 fixing an out-by-one error in ACTION_GET packet handling. 2011-10-06 09:27:04 +10:30
gardners
d5d2bd16b3 added further debug output to chase down corrupt packet errors. 2011-10-06 09:16:47 +10:30
gardners
cbb1939241 Fixed various compiler warnings.
Change overlay_frame payload to use an overlay_buffer structure for
consistency and ease of payload construction.
Added some sanity checking to peer score calculation.
Getting closer to being able to TX acks to selfannouncements.
Other little things to accomplish these.
2011-09-05 12:19:53 +09:30
gardners
54cea0b91b Preliminary work for Rollie to add in Curve25519 crypto layer. 2011-09-01 17:04:25 +09:30
gardners
32a5f03073 Various single-instance variable processing fixes for DNA.
Further work on overlay mesh routing.
2011-08-29 16:20:27 +09:30
gardners
4396570745 Fixed DNA simple server and client modes to still work with overlay code in place. 2011-08-15 15:54:11 +02:00
gardners
cf778e1efd Various further work on overlay mesh.
Now resolves some kinds of abbreviated address, and queues up
the need to remind peers of abbreviation schemes it does not support.
2011-08-15 12:51:00 +02:00
gardners
0cf6e545c4 Fixed select() problems with dummy interfaces and EOF reporting.
Dummy interfaces now work.
Supressed lots of debug messages.
2011-08-14 10:36:39 +02:00
gardners
c8229c8517 More work towards handling overlay or DNA packets.
handling of sender address and sockets to use is still a big fat mess
and likely to be broken.
2011-08-12 21:34:38 +02:00
gardners
7e30d62b79 Cleaned up various compiler warnings. Added packet parser framework for
handling overlay frames.
2011-08-12 21:05:11 +02:00
gardners
2f0307a08d Added mesh potato build script.
Updated gateway operation to support mesh potato again.
2011-08-10 15:39:40 +02:00
gardners
5fb7b05265 Added HLR seeding code, so that HLR will always have at least one entry in it.
(although it may lack a location entry at present -- should fix that so that
the mobile phone software can just rely on DNA creating a suitable HLR for it).
2011-08-09 14:10:27 +08:00
gardners
92768cdcd0 core of overlay mode getting closer.
Compiles. With -N start to try to send regular packets.
2011-08-08 22:41:46 +08:00
Jeremy Lakeman
67eec6c3ff Send broadcasts based on network addresses 2011-07-04 11:20:46 +09:30
Jeremy Lakeman
f532b32efa Ensure received message buffer is terminated 2011-05-26 14:25:59 +09:30
Jeremy Lakeman
9b3c4f13bb Reply with sid from hlr file 2011-05-25 10:09:11 +09:30
gardners
803def3633 Add find hlr check, fix compile errors 2011-05-24 10:10:58 +09:30
gardners
23b791bd0a Minor fixes to get Thomas' DT reception and intent broadcasting working. 2011-05-23 21:12:31 +09:30
Jeremy Lakeman
83f88a6d08 Thomas' modifications to recieve DT SMS and escalate to Java via an intent. 2011-05-23 21:05:15 +09:30
gardners
d20da9616e Initial work on proper gateway support with direct tie-in to Asterisk. 2011-05-16 16:58:25 +09:30
gardners
def9a60fe5 Added more from Raiders Of The Lost Source (gateway mode) 2011-05-06 12:46:04 +09:30
gardners
f024213414 Added instrumentation logging option. 2011-05-05 18:40:38 +09:30
gardners
9912678203 Merge branch 'master' of github.com:servalproject/serval-dna 2011-04-27 21:19:03 +09:30
gardners
5a7381bd2a Fixes for OSX compilation, preparation for adding overlay mesh network. 2011-04-27 21:18:09 +09:30
Jeremy Lakeman
bfccb3816d Allow clients to request variables for all records by passing empty did.
Always add DONE flag to the last packet sent.
2011-04-27 12:17:26 +09:30
Jeremy Lakeman
a2bcb56e1f Minor bug fixes, mostly todo with uninitialised variables. 2011-03-31 00:09:42 +10:30
Jeremy Lakeman
59a0a4a2a0 Build a win32 console exe with VS2008 express 2011-03-30 22:17:11 +10:30
gardners
f537141b13 Preparatory work for Thomas to implement sending/receiving SMS over the mesh. 2011-03-22 17:03:14 +10:30
gardners
601ca12499 Added support for batmand.peers file for reliable peer querying.
Re-ported for asterisk module.
2011-03-21 13:08:35 +10:30
paul.gardner.stephen
f225465dfc Initial check in
git-svn-id: http://serval-dna.googlecode.com/svn/trunk/trunk/dna@2 6d01b88e-114a-4e5d-930d-818638e25ad7
2010-07-13 12:15:46 +00:00