Commit Graph

149 Commits

Author SHA1 Message Date
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
132d3a6f9b rename profiling structure 2012-07-02 16:04:00 +09:30
Jeremy Lakeman
e705696896 separate statistics gathering from the scheduler structure 2012-07-02 15:20:30 +09:30
Jeremy Lakeman
89566e4d3d Refactor how functions are scheduled or file handes are watched 2012-07-02 13:19:54 +09:30
gardners
97cd8f5255 added code to time various servald functions and report periodic
statistics.  Handles nested calls to correctly aportion call time
among children.
2012-06-26 09:22:51 +09:30
Andrew Bettison
5c819fce7e Get rid of fprintf(stderr,...) in overlay.c
Replace with calls to DEBUGF() etc.
2012-06-25 16:32:52 +09:30
gardners
d579693f3d added stats generation and summarisation to take place of older
excessively chatty timing gathering.
2012-06-25 14:35:55 +09:30
gardners
3b6a004cc9 new event scheduler almost working, but after a while can stop
calling overlay_check_ticks alarm for some reason, which causes
queues to congest and bad things to generally happen.
2012-06-22 17:30:21 +09:30
gardners
895b5873f0 fixed bug cpu time wasting bug for dummynets. 2012-06-22 16:06:46 +09:30
gardners
6472ff29c1 fixed monitor interface problem with new event scheduler. 2012-06-22 16:06:46 +09:30
gardners
91bccec71d various fixes related to event scheduler.
server main loop is now just fd_poll()
2012-06-22 16:05:50 +09:30
gardners
f0ed4b2e52 debugging and related improvements for new event scheduler. 2012-06-22 16:05:50 +09:30
gardners
ae9e80fdce added missing file from previous commit.
formatting in overlay.c
2012-06-22 16:05:49 +09:30
gardners
5dc6d122a5 significant progress towards clean callback scheduler for poll()
events and timed callbacks.
2012-06-22 16:05:49 +09:30
gardners
2d718a297f reversed changes that broke DNA tests. Improved dnaprotocol
test script slightly.
2012-06-21 17:02:36 +09:30
gardners
50eaeca51a added sanity checking of poll timeout to prevent infinite wait
if any ticks are overdue (this whole thing will be revamped soon
to be simpler and more efficient, so this is a temporary solution).
2012-06-21 16:36:37 +09:30
Jeremy Lakeman
926d4296c4 Added overall timer for main loop, minor tweaks to order and freq. of processes 2012-06-21 11:33:43 +09:30
gardners
6023cd4da2 moved timing check definitions to serval.h 2012-06-21 11:33:42 +09:30
gardners
0dd5845cdd added instrumentation to detect when servald spends more than 5ms doing
anything.  Reports which bit of the overlay mesh main loop the time was
spent in, to help track it down.
2012-06-15 15:13:45 +09:30
Daniel O'Connor
d0e0864b0c Fix comment to be correct. 2012-06-15 15:09:21 +09:30
gardners
e319b146a6 cleaned up some debugging. 2012-05-22 15:57:19 +09:30
gardners
d2c811b4b4 further rhizome voice traffic detection hooks. 2012-05-22 14:15:19 +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
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
b15e5cfee7 Improve debugging/logging macros
Replace 'WHYRETNULL();' statements with 'return WHYNULL();'
Introduce DEBUG(), DEBUGF(), DEBUG_perror() and D macros
Add logMessage() and vlogMessage() functions
Implement setReason() using vlogMessage()
2012-05-10 12:53:57 +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
acc5e48f4f Terminate server process if serval.pid clobbered 2012-05-08 11:23:43 +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
25f81aeaaf fixed bug with cancelling calls due to lack of listeners.
worked around poll() with accept() unix domain socket linux bug.
generally hooked in the unix domain stream socket interface for
monitoring calls (and later rhizome).
2012-05-03 03:37:03 +09:30
gardners
d637f31ab7 work towards stream unix domain socket to allow Android/Java
monitoring of call status and rhizome bundle arrivals.
2012-05-03 02:31:12 +09:30
gardners
c3fe7ee8e3 "id peers" now returns something! 2012-04-30 06:16:03 +09:30
gardners
03aa6cbf49 debugging output tweaks. 2012-04-30 06:01:34 +09:30
gardners
92baae2a89 hopefully fixed acking of self-announcement frames when no route
to node exists.
2012-04-28 18:09:58 +09:30
gardners
cd00204893 sending voice packets should now result in their being marked
as high priority (priority dispatch still outstanding).
2012-04-25 14:35:44 +09:30
gardners
dde520c465 forwarding frames preserves priority of voice packets.
voice packets now just need to be marked with the right priority...
2012-04-25 14:35:44 +09:30
gardners
9b409c2891 Got VoMP ticks to update call state running. 2012-04-21 21:21:26 +09:30
gardners
32ed614494 fixed remaining known issues with signed/crypted MDP such that
MDP ping now works, and provides appropriate responses from local
and remote hosts, and the SIGNED or SIGNED and CRYPTED status can
be observed.
2012-04-16 07:04:23 +09:30
gardners
e7e8b2d630 fixed bug in RFS size patching.
A lot of debug output tweaks to track the problem down.
2012-04-16 06:06:43 +09:30
gardners
2581e9fe4c Revamped dequeuing of TXd frames.
Now almost works (queues don't stay full of junk), although
mdp ping still gets a duplicate reply for 2-hop pings.
2012-04-14 23:12:45 +09:30
gardners
79dc33b156 Work towards transparent decryption of MDP frames.
Runs, just gets an error during decryption, like as though
keys or nonce were wrong.
2012-04-14 12:17:46 +09:30
gardners
4a1e4eca55 fixed more bugs in duplicate broadcast quenching.
looks like it might be working right now.
2012-04-14 11:16:59 +09:30
gardners
3e2213db61 removed debugging output. 2012-04-14 10:58:31 +09:30
gardners
4e0c9bfd02 fixed logic errors in handling of nexthop and destination addresses
when receiving a frame and determining if it is broadcast etc.
(one major use case that has been fixed is broadcast nexthop, and
unicast destination, e.g., for link-local broadcast).
2012-04-14 10:54:48 +09:30
gardners
a71929bcd2 Removed some debugging output. 2012-04-14 07:42:43 +09:30
gardners
e636dcd0fc Fixed handling of broadcast frames so that not-forwarding a broadcast
frame does not equate to not examining its contents ourselves.
2012-04-14 07:39:02 +09:30
gardners
2802a5c042 Fixed bug in dequeuing broadcast frames after they have been
sent via interfaces.
Also some debugging output added.
2012-04-14 06:31:30 +09:30
gardners
752a29c112 Fixed handling of duplicate broadcasts (they get dropped sooner).
There does seem to be something odd about the broadcast processing
still, as the BPIs change after resolving addresses.
Maybe when we send a broadcast out via multiple interfaces it
gets marked duplicate after sending to the first interface?
2012-04-14 04:33:01 +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
gardners
aa543e1766 Various fixes and work towards MDP ping working.
MDP clients can now request the set of local addresses.
Framework is improved to avoid info leaks by sending more bytes
in an MDP frame than are necessary, but without having to bzero
almost 2KB each time.
2012-03-27 19:25:38 +10:30
gardners
d8f7f27bad Removed a debug statement. 2012-03-21 13:00:24 +10:30
gardners
70497df7b5 More work on MDP. Removed some debug fluff.
Added framework for MDP ping, and some work towards MDP port binding
and sending packets with option to wait for reply.  MDP server
doesn't yet support port binding, and client doesn't yet support
reading replies.
2012-03-19 16:06:34 +10:30
gardners
f384e6ea79 Further preparatory work for MDP. Next stop is actually checking
for inbound MDP connection requests on the unix domain sockets.
2012-03-17 13:02:09 +10:30
gardners
872c14df3f Added initial hook to handle MDP frames. 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
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
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
f862ba0af6 Rhizome file transfer via http getting close
(send side needs to send file body)
2012-01-13 17:21:06 +10:30
gardners
90729e20b6 fixed operation of rhizome web server in overlay server mode. 2012-01-12 16:50:25 +10:30
gardners
bf9f8559f1 Various debug fiddles and conversion from select() to poll()
(although poll() still doesn't let us monitor ordinary files
which is silly.)
2012-01-12 16:47:24 +10:30
gardners
670f7c51c7 Reworked Rhizome advertisement frames to include whole manifests
inline where possible.
2012-01-11 14:27:40 +10:30
gardners
f8eea651b5 Changed broadcast address to include a 64bit BPI to allow filtering
of duplicate broadcast announcements.
2012-01-10 21:56:07 +10:30
gardners
2a3721506b More debugging output fixes and bug fixes for overlay operation.
Added proper check to suppress frames claiming to come from
ourselves ( necessary for squelching multi-hop broadcasts, although
we need an extra step there of having transaction ids on broadcast
frames so that we can flood smartly).
2012-01-10 20:27:36 +10:30
gardners
44c0765981 Various debugging code cleanups.
Fixed some address resolution bugs (for when sender address is not
fully known).
There is still a bug in dequeuing packets though it seems.
2012-01-10 17:21:26 +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
9156a68c7f Added 2nd implementation of serval packet decoder for aiding debugging
of packet formation and decoding.
Fixed time calculation bug (duplicate time functions based off different
epochs).
Various debugging fiddles and tweaks.
2012-01-10 14:05:26 +10:30
gardners
23ee957169 Various minor tweaks to debugging and related things.
Fixed major memory handling error in neighbour structure allocation.
2012-01-09 16:28:44 +10:30
gardners
52b80069da Fixed local address setting bug. 2012-01-09 10:07:57 +10:30
gardners
95cca9895c Now we drop frames that claim to be from ourselves. 2012-01-09 09:57:57 +10:30
gardners
7e0ad31ef3 Improved handling of local addresses in overlay mesh.
Added check to stop us sending reachability acknowledgements to ourselves.
2012-01-09 09:55:21 +10:30
gardners
696850dcbf added missing break after rhizome packet process call. 2012-01-09 09:21:23 +10:30
gardners
1240c49a92 Added more debugging to no open path messages.
Added hook for reading rhizome advertisements.
2012-01-09 09:17:54 +10:30
gardners
16fb3a3f61 Added missing GPL license statements. 2011-12-21 20:25:05 +10:30
gardners
2a2f8d752f reception and processing of advertised routes now works :)
Indeed the core of the overlay mesh is now in place and nodes
on simple meshes discover each other. Plenty of bugs are sure
to remain.
2011-09-13 05:37:24 +09:30
gardners
ec22b5df0d Added infrastructure to tick route tables by progressively touching
all neighbours and nodes over a bounded timespread so that route
ticking doesn't add excessive delay/jitter.
2011-09-13 01:02:58 +09:30
gardners
a91c5d29c3 added code to display overlay mesh route table (incomplete)
fixed bug with recording routes from packets with unresolvable addresses.
2011-09-12 23:49:55 +09:30
gardners
78e3bfc4a3 Finally looks like selfacknowledgement acks get sent and can be
decoded.  Now to actually use them ...
2011-09-07 13:09:54 +09:30
gardners
b402aba22d More work towards getting selfannounce acks (and other packet types)
forwarding out.
2011-09-05 14:55:44 +09:30
gardners
67e822f1ff Fixed timing out of queued frames. 2011-09-05 13:19:00 +09:30
gardners
27a454ef72 Initial implementation of frame enqueuing. Queues require maxLength to be initalised to set
congestion threshold.
2011-09-05 12:49:37 +09:30
gardners
c3e220e5c1 Now attempts to enqueue self-annoucement ack frame (but enqueue function
not implemented).
2011-09-05 12:37:46 +09:30
gardners
37c0955494 More little fixes, especially initialising of overlay_buffers in
overlay_payload structures.
2011-09-05 12:34:54 +09: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
c06b75f5c9 Fixed some sign mis-matches in overlay_abbreviations.
Added infrastructure to keep track of receiver and sender interfaces
for multi-homed nodes.
2011-09-04 06:48:41 +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
89c5163899 Code to calculate appropriate overlay mesh data structure sizes to give 2^n bins
and maximised associativity in the range [4..7]. Still yet to actually allocate
the structures, though.
2011-08-18 04:30:13 +09:30
gardners
5dd6f9ce06 Progress towards core overlay mesh routing data structures. 2011-08-18 02:15:13 +09:30
gardners
b075b51c43 Merged overlay_payload and overlay_frame structures to just overlay_frame
which is now used for both encapsulation and decapsulation.
Improved payload length encoding scheme to be shorter for most payload
lengths.
selfannouncement frames now get directed to stub functions for
implementation.
2011-08-17 10:52:17 +09:30
gardners
62a7a65fd6 More work on parsing overlay frames. Now has bare bones to think about
forwarding frames. routing is still not implemented, so it doesn't do anything yet,
but it does try.
2011-08-15 16:22:29 +02:00
gardners
bd16fbbf5b Address lookup from cache works :)
This gets us a functional system once we add the code to send PLEASEEXPLAIN
messages to request resolutions.
2011-08-15 13:50:30 +02:00
gardners
02bf80246e Fixed bugs with overlay frame parsing. 2011-08-15 13:10:37 +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
229850c8d7 Overlay mode with address summarisation closer to working.
Self-announcements now abbreviate addresses, and in theory they
get expanded on reception -- but more testing and coding required.
2011-08-15 09:27:29 +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
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
gardners
6e172c76c9 Fixed broadcast address discovery to work on Mac.
Fixed Linux assumptions.
Added parsing of overlay mesh interface specification from command line.
Separated overlay mesh code out into several files.
Overlay mesh is still far from working, but the infrastructure is coming together.
2011-08-08 16:11:05 +09:30
Jeremy Lakeman
df70fa54d2 Build dna binary with ndk 2011-06-04 07:35:29 -04:00
gardners
b9f5448cc1 More work on overlay. Fixed nasty srandomdev() segfault bug. 2011-04-30 23:22:22 +09:30
gardners
0df58d2514 Added code towards overlay mesh, which will also support Rhizome transport. 2011-04-27 21:19:38 +09:30