Commit Graph

275 Commits

Author SHA1 Message Date
Jeremy Lakeman
2a7bd28e51 Extend packet queue to allow sending multiple copies of the same payload for reliability 2012-09-28 11:28:01 +09:30
Andrew Bettison
fb7c9e5633 Fix compiler warnings on Linux gcc 4.7.1 2012-09-27 11:02:58 +09:30
Jeremy Lakeman
222cb80ce7 Modify lookup uri format to distinguish between serval identities and gateway services 2012-09-21 15:17:56 +09:30
Jeremy Lakeman
0538e95be8 Reduce the potential for packet storms 2012-09-20 10:28:01 +09:30
Jeremy Lakeman
6d31aa52e7 Use the correct public key when a new keyring is created 2012-09-18 13:43:00 +09:30
Jeremy Lakeman
456bf3fdca Tidy up source port checking 2012-09-14 17:04:35 +09:30
Jeremy Lakeman
337d428f44 Reconstruct encryption / signature flags 2012-09-14 14:41:17 +09:30
Jeremy Lakeman
7b8885fd96 Rework mdp port bindings to use subscriber struct 2012-09-14 11:49:01 +09:30
Jeremy Lakeman
6483d9e0ae Split client mdp functions so they can be built separately 2012-09-14 11:47:48 +09:30
Jeremy Lakeman
fbe9980199 Add explicit flag for unicast peers 2012-09-10 10:55:12 +09:30
Jeremy Lakeman
f2bae4361e Improve logging and failure handling 2012-09-10 10:31:01 +09:30
Jeremy Lakeman
3cfcfb3728 Parse mdp payloads from the middle of a frame 2012-09-07 13:45:57 +09:30
Jeremy Lakeman
dc686ad10b Set incoming packet length 2012-09-07 11:34:00 +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
Jeremy Lakeman
1f6607af14 Refactor to avoid returning a pointer to the stack 2012-09-01 12:17:22 +09:30
Jeremy Lakeman
e05806f25e Separate routing calculation from resulting rules, refactor more code to use subscriber structure 2012-08-31 15:11:18 +09:30
Jeremy Lakeman
df0e20408c Close sockets on poll errors 2012-08-31 15:04:06 +09:30
Jeremy Lakeman
f6c899e107 Refactor overlay buffer interface to support simple parsing 2012-08-31 15:03:07 +09:30
Jeremy Lakeman
aa5706f9d7 Refactor routing node information to use new subscriber tree 2012-08-31 15:03:07 +09:30
Jeremy Lakeman
58457a703d Refactor monitor port bindings 2012-08-14 14:37:16 +09:30
Andrew Bettison
eec8fb6e95 Improve SAS resolution debug messages 2012-08-14 14:06:59 +09:30
Jeremy Lakeman
3ab79d8e5b Pass phone numbers in vomp call initiation 2012-08-13 14:01:57 +09:30
Jeremy Lakeman
6981e7e2c2 Allow monitor clients to resolve did's 2012-08-10 15:29:19 +09:30
Andrew Bettison
12d8bc0c12 Use new typedef time_ms_t everywhere 2012-08-09 12:14:32 +09:30
Andrew Bettison
fd1da2df93 Fix bug that failed dnaprotocol multi-lookup test 2012-08-06 16:44:36 +09:30
Andrew Bettison
0c7c4e7296 Improve logging to help diagnose dnaprotocol test failure
Replace printf() with DEBUGF() and INFOF()
Improve error message from overlay_mdp_sanitytest_sourceaddr()
2012-08-02 17:16:18 +09:30
Andrew Bettison
240be25793 Replace overlay_gettime_ms() with gettime_ms() 2012-07-30 17:22:38 +09:30
Daniel O'Connor
fd1f91db8d Refactor unix domain socket naming to a separate file instead.
Handle selection between normal & abstract sockets in a single place.

overlay_mdp.c tried to have both but this seems like a bug so I've removed the second socket (needs tests).
2012-07-30 11:19:25 +09:30
Andrew Bettison
15d7bec680 Rewrite fprintf(stderr,...) to DEBUGF() 2012-07-27 18:04:46 +09:30
Andrew Bettison
04b95d2590 Merge branch 'andrew' into 'master' 2012-07-25 18:04:16 +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
Andrew Bettison
5aac5a3854 Unfinished dnahelper implementation 2012-07-18 19:16:30 +09:30
Jeremy Lakeman
1d53726b7b Merge remote-tracking branch 'origin/master'
Conflicts:
	rhizome_fetch.c
	rhizome_http.c
	testframework.sh
2012-07-17 15:39:55 +09:30
Jeremy Lakeman
ddba8033e4 Refactor packet envelope and sid abbreviation reading and writing 2012-07-17 15:30:50 +09:30
gardners
7c5c6b0826 work towards DNA helper interface. 2012-07-16 13:00:55 +09:30
Andrew Bettison
86eb482ed9 Replace macros with functions
SET_NONBLOCKING(), SET_BLOCKING(), WRITE_STR() are now set_nonblock(),
set_block() and write_str() respectively, all of which log an error before
returning -1.  There are other useful methods: write_all() treats anything less
than all bytes written as an error; write_nonblock() treats EAGAIN and EINTR as
zero bytes written, and a combination: write_all_nonblock().
2012-07-10 16:33:39 +09:30
Andrew Bettison
68ef34c119 Add 'id allpeers' command to facilitate testing 2012-07-04 12:06:15 +09:30
Andrew Bettison
a90c0156ed New DEBUG_MDPREQUESTS debug flag
Use it to instrument the MDP_GETADDRS request, to investigate cause of
test 'dnaprotocol' fixture failure
2012-07-04 10:32:38 +09:30
Andrew Bettison
72769e162b Replace overlay_render_sid_prefix() with alloca_tohex()
To eliminate timebomb bugs caused by rotor wraparound
2012-07-04 10:30:46 +09:30
Andrew Bettison
2c87039307 Replace overlay_render_sid() with alloca_tohex_sid()
To eliminate timebomb bugs caused by rotor wraparound
2012-07-03 17:59:30 +09:30
Andrew Bettison
b1c78f9fa3 Tighten up overlay socket initialisation and peer listing 2012-07-03 17:38:54 +09:30
gardners
02ca21a601 CHANGED DNA REPLY PACKET FORMAT BREAKING BACKWARDS COMPATIBILITY
... as part of working on work on DNA helper callout facility.
(DNA replies now contain a token that can be used to match them
against DNA requests as a happy side-effect).
2012-07-03 16:45:03 +09:30
Jeremy Lakeman
495de9e0ec Add more profiling instrumentation 2012-07-03 15:50:04 +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
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
Jeremy Lakeman
29cba17891 Fix rhizome transfers 2012-06-27 16:54:42 +09:30
Jeremy Lakeman
0ca4c16f39 Refactor node info to ignore stale responses without sending another request 2012-06-26 11:20:00 +09:30
gardners
c5d89a043d clean up debugging. 2012-06-26 09:25:42 +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
gardners
b40a468276 Merge branch 'eventscheduler'
Conflicts:
	monitor.c
	serval.h
2012-06-25 16:50:23 +09:30
gardners
0c0e5b73e9 reduced debugging output. 2012-06-25 14:46:55 +09:30
Daniel O'Connor
3a606b7d91 Check the socket isn't too long before copying it to prevent a seg fault. 2012-06-25 14:01:50 +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
Daniel O'Connor
60512ad3e8 Fix build breakage. 2012-06-22 16:46:30 +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
8977142a30 fixed "timeout from MDP server" errors in node info output.
added extra tests for node info.
2012-06-21 16:36:38 +09:30
gardners
48a1d7e20f MDP socket name can now be changed by config option mdp.socket.
DNA tests now passing again.
2012-06-21 16:36:37 +09:30
gardners
fefe7d2e91 fixed dna query bugs and split wildcard query test into star and
empty string versions.
2012-06-21 16:36:37 +09:30
gardners
c3649c415f fixed a bug with DNA response generation. 2012-06-21 16:36:37 +09:30
gardners
374e4676a7 various simplifications of DNA reply generation and related code. 2012-06-21 16:36:37 +09:30
gardners
e5394dd143 added stubs for DNA lookup helper app (not yet complete).
cleaned up some unused variables.
2012-06-21 16:35:28 +09:30
gardners
8ea37af64d servald now can return arbitrary URIs in response to DNA requests. 2012-06-21 11:44:49 +09:30
Jeremy Lakeman
26f3966002 Ignore node info results from incorrect sid's 2012-05-25 09:55:56 +09:30
Jeremy Lakeman
43c7297a47 Sanity check on received packet 2012-05-24 17:33:15 +09:30
gardners
e1c30b8ed8 deprioritised peer list resolution so that rhizome doesn't
back off at the sight of the first peer list enquiry.
2012-05-22 17:40:11 +09:30
gardners
d2c811b4b4 further rhizome voice traffic detection hooks. 2012-05-22 14:15:19 +09:30
gardners
79ce37ec35 vomp calls should work again, and without the server blocking
on the mdp_client_socket.
2012-05-22 10:42:29 +09:30
gardners
62b400fe23 fixed "id peers" so that stale nodes disappear. 2012-05-22 06:36:32 +09:30
gardners
904663ef6c bandaid for hung servald processes.
(real fix being worked on).
2012-05-21 22:47:17 +09:30
Daniel O'Connor
9d07cccf8e Hide display of MDP socket name behind DEBUG_IO. 2012-05-21 16:18:09 +09:30
Daniel O'Connor
7cb980ab5c Don't discard return code from overlay_mdp_client_init. IMO this should be assert(mdp_client_socket != -1) though. 2012-05-21 11:09:45 +09:30
Andrew Bettison
189ecee4b9 Clean up over-use of WHY() in overlay_mdp.c 2012-05-20 16:06:32 +09:30
gardners
e38275067a more fixes and cleanups for dna lookup. 2012-05-18 13:44:15 +09:30
gardners
c9a58937ca other bug fixes and cleanups for "dna lookup" 2012-05-18 12:55:56 +09:30
gardners
844a480ae7 more trying to reuse socket addresses when stuck. 2012-05-17 13:14:16 +09:30
Andrew Bettison
881576212c Fix all trivial compiler warnings 2012-05-10 18:08:59 +09:30
Andrew Bettison
68cfa6218c Minor fix to WHY_perror() macro 2012-05-08 17:48:16 +09:30
Andrew Bettison
836f8332e8 Replace perror() with WHY_perror()
Puts more diagnostics to Android log
2012-05-08 14:53:34 +09:30
gardners
171eb75d48 fixed packet size calculation bug. 2012-05-07 16:50:49 +09:30
gardners
74634a5068 minor tweak to dna lookup. 2012-05-07 15:47:20 +09:30
gardners
081e1b64f9 take 2 at fixing dna lookup latency bug. 2012-05-07 15:40:15 +09:30
gardners
92691a82c9 make DNA lookups immediate-dispatch traffic. 2012-05-07 15:29:31 +09:30
gardners
7b520e7a49 fixed various bugs with priorty dispatch of voice traffic.
some debug tweaking etc.
2012-05-07 08:31:53 +09:30
gardners
f93ec055ca removed some debugging 2012-05-06 20:15:32 +09:30
gardners
eb8ffeb71f progress towards monitor interface for following calls. 2012-05-03 03:00:34 +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
3ca1c9c2b6 only close client socket if it has already been opened. 2012-05-01 06:58:07 +09:30
gardners
77f2220134 removed silly call to client_done when sending every MDP message. 2012-05-01 06:50:57 +09:30
gardners
b335424cd5 improved debug output for when sendto fails. 2012-05-01 06:43:22 +09:30
gardners
6e9d9783b8 various measures to prevent stale MDP bindings from hanging around
and causing pain.
2012-05-01 06:10:47 +09:30
gardners
3276b33c73 disabled some debugging output. 2012-05-01 05:16:16 +09:30
gardners
70a0f9e4a1 changed client socket path to include both pid and 32-bit random
value.  clutter should be constrained by the previous addition of
socket cleanup code.
2012-04-30 20:07:22 +09:30
gardners
ae9ecd74c4 by default replace old MDP bindings instead of returning with an
error.
2012-04-30 15:45:07 +09:30
gardners
900bfab1e9 changed client sockets to use PID instead of random 32bit number.
Means that bindings can be reused more easily, and directory doesn't
fill up with stale sockets so easily.
2012-04-30 15:34:54 +09:30
gardners
8a7d3e44f3 fixed bug in getmyaddrs() introduced in making "id peers" work. 2012-04-30 06:53:10 +09:30
gardners
1ebe63a470 cleaned up some debug output introduced during previous bug fixes. 2012-04-30 06:25:54 +09:30
gardners
c3fe7ee8e3 "id peers" now returns something! 2012-04-30 06:16:03 +09:30
gardners
08cf7f9639 fixed some bugs in overlay mesh routing score calculation and
selfannounce ack packet formats.  more remains to be done.
2012-04-29 13:10:54 +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
c191f951fa added debug for termination of client socket path name. 2012-04-27 07:18:02 +09:30
gardners
3532e236d9 fixed relevant_bytes() bug for nodeinfo messages. 2012-04-26 15:47:37 +09:30
gardners
88ba56b68b work towards "node info" command, and renamed stop/start etc to
drop node keyword, that in retrospect is not appropriate.
2012-04-26 07:14:01 +09:30
gardners
0a3b415772 Further refinements to MDP_GETADDRS, and inserted code for peer
list retrieval.
2012-04-26 06:04:19 +09:30
gardners
35f231dcb0 preparation for allowing MDP_GETADDRS to return either local IDs,
or SIDs of peers.
2012-04-26 05:58:16 +09:30
gardners
3f81911e6f fixed bugs in MDP_GETADDRS, now returns multi-packet lists properly
by setting the sub-ranges correctly.
2012-04-26 05:54:14 +09:30
gardners
44a416b969 added "id self" command to get all local SIDs (BatPhone needs this) 2012-04-26 05:48:06 +09:30
gardners
98c3b72cf4 mdp based dna lookup works now, but lacks duplicate suppression. 2012-04-25 20:33:25 +09:30
gardners
0133ea972a fixed infinite loop when responding to DNA lookups. 2012-04-25 20:24:08 +09:30
gardners
a2880ada1e closer to dna lookup working via mdp.
Bug to be fixed in sending replies.
2012-04-25 20:14:56 +09:30
gardners
4972da1b58 dna lookup via mdp nearly working. 2012-04-25 15:55:04 +09:30
gardners
f8a1ffc4c9 dna lookup command line utility mostly done. Now to make server
respond.
2012-04-25 15:24:21 +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
ac6271c715 voice packets get priority queued. getting ready for dna lookups
via mdp.
2012-04-25 14:35:44 +09:30
gardners
12be1e326e fixed unix domain socket "no buffer space" message (sockets
are buffered on receive side, not send side).
2012-04-24 21:09:27 +09:30
gardners
d9fd7ce33e tried to fix unix domain socket "no buffer space available" bug,
but to no avail.
2012-04-24 20:57:59 +09:30
gardners
c1191c779b enlarge MDP unix domain socket send buffers. 2012-04-24 15:27:59 +09:30
gardners
953e836ba6 fixed bug introduced in adding codec hints. 2012-04-23 13:55:17 +09:30
gardners
458ff3665b fixed poll/select issue that was causing 100% cpu utilisation on mac. 2012-04-22 20:15:57 +09:30
gardners
2a24f3e137 revamped mdp client unix domain socket system to use unique names
so that multiple clients can connect to the same server.
(on linux we should use abstract name space unix domain sockets
 so that we never have stale socket files hanging around).
2012-04-22 18:46:14 +09:30
gardners
c894d51c24 fixed type in client socket name. 2012-04-22 16:45:27 +09:30
gardners
56ab28b475 fixed a relevant_bytes calculation bug, and generally improved
error handling.
2012-04-22 08:25:48 +09:30
gardners
ead3e8cb95 cleaned out some debug info. 2012-04-22 06:29:10 +09:30
gardners
028b24261f fixed another relevant byte calculation bug. 2012-04-20 17:12:44 +09:30
gardners
971f402360 more fixing of relevant byte calculation. 2012-04-20 17:12:44 +09:30
gardners
44ad4db147 fixed MDP frame relevent byte calculation to work regardless of what
weird alignment foo the compiler decides to do.
2012-04-20 17:12:44 +09:30
gardners
a29a1283f7 More work towards integrating VoMP (creating unix domain socket
interface for call control/audio handling).
2012-04-19 21:54:36 +09:30
gardners
729ede461d Added hardwired MDP listener port for VoMP.
Moved VoMP header material into serval.h for use.
2012-04-19 07:34:12 +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
e639d3d255 fixed bugs and completed implementation of storing SID:SAS mappings.
Now to finish implementing verification process.
2012-04-16 06:36:46 +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
caab3078e5 substantial work towards public key signing of MDP frames and
the associated SID:SAS mapping cache and request packets.
2012-04-15 03:17:36 +09:30
gardners
0c2de88337 token formatting change? 2012-04-15 00:04:22 +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
2dab0e50d4 Fixed source/destination port switch bug fixed (though some issue
remains)
2012-04-14 14:20:49 +09:30
gardners
7c1f48c511 various debug cleanups 2012-04-14 13:56:53 +09:30
gardners
401da25a77 decrypting mdp frames now works, but there is something causing
frames to be resent after decryption.
2012-04-14 12:33:15 +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
9398f94a22 Cleaned up debug output. 2012-04-14 09:39:14 +09:30
gardners
25a626a61e Fixed reply packet handling for built in echo port. 2012-04-14 09:33:29 +09:30
gardners
3b0fb3929d Added code to extract MDP frames from packets.
source ports and decryption are currently not right.
2012-04-14 08:15:29 +09:30
gardners
ca24513599 Work towards actually authcrypting MDP payloads.
Not complete.
2012-04-14 02:14:41 +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
0b11389023 Fixed problem with null-termination of received addresses for
unix domain socket connections.
2012-03-29 20:45:07 +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
6f74393ea1 Replace bcmp() with memcmp() 2012-03-29 13:02:10 +10:30
gardners
942605d247 Removed some debugging, improved MDP PING client output. 2012-03-28 13:26:14 +10:30
gardners
3a0a62b780 Fixed source address of MDP echo frames when destination of echo
request was broadcast (returns local address or all zeroes).
2012-03-28 13:19:53 +10:30
gardners
6a50bbb024 MDP server can now pass received MDP frames to client. 2012-03-28 13:10:41 +10:30