The Serval Project's core daemon that implements Distributed Numbering Architecture (DNA), MDP, VoMP, Rhizome, MeshMS, etc.
Go to file
Andrew Bettison 5c84b2ffd5 Fix Rom's socket cleanup-on-start code
Fix buffer overflow bug: replace call to sprintf(3) with call to
FORM_SERVAL_INSTANCE_PATH()

Fix file descriptor leak bug: add missing closedir(3) call

Use lstat() instead of stat() to avoid warnings on broken sym links

Use WARNF_perror() where appropriate in preference to WARNF()

Remove redundant one-line comments
2013-09-19 04:30:40 +09:30
asterisk_include Added support for batmand.peers file for reliable peer querying. 2011-03-21 13:08:35 +10:30
Debian/etc Improve Debian init.d script and default file 2013-01-24 13:24:11 +10:30
doc Minimal doc/OpenBTS.md points to app_servaldna repo 2013-05-30 15:52:37 +09:30
java/org/servalproject/servald Fix JNI argv parsing: throw exception on NULL 2013-02-15 19:33:12 +10:30
m4 Artefacts created by libtoolize -c -i 2012-09-12 15:21:50 +09:30
nacl cleaned up NaCl build to just compile using make. #17 2012-10-18 17:26:52 +10:30
openwrt/packages/serval-dna Updated build files for openwrt (now all live in openwrt/). #26 2012-10-29 07:38:16 +10:30
sqlite-amalgamation-3070900 Reduce use of stderr in many places 2012-08-01 17:54:02 +09:30
tests Add [keyring-pin] arg to keyring load command 2013-09-10 11:28:55 +09:30
utilities Fix Markdown formatting 2013-02-22 00:05:34 -08:00
win32 Allow clients to request variables for all records by passing empty did. 2011-04-27 12:17:26 +09:30
.dir-locals.el Add file to set emacs variables to match the prevailing style. 2012-07-29 13:52:46 +09:30
.gitignore Build fakeradio with other test binaries 2013-08-19 13:56:19 +09:30
aclocal.m4 Merge branch 'master' of github.com:servalproject/serval-dna 2012-04-23 20:41:52 +09:30
Android.mk Issue #20: merge branch 'sockets' into 'development' 2013-09-19 04:30:14 +09:30
check-in-out-return.c created tool for automatically finding IN()s without matching 2013-02-20 16:18:56 +10:30
cli.c Move cli global state into a structure and pass it around 2013-07-03 16:51:27 +09:30
cli.h Clean up string formatting for 64bit compilation 2013-07-15 09:59:24 +09:30
commandline.c Add [keyring-pin] arg to keyring load command 2013-09-10 11:28:55 +09:30
conf_om.c Improve "config dump" command 2013-02-28 15:18:48 +10:30
conf_parse.c Silence clang warnings 2013-04-11 13:46:09 +09:30
conf_schema.c Don't encrypt by default when the recipient is broadcast 2013-07-19 10:28:15 +09:30
conf_schema.h Don't clean the database for every command line operation by default 2013-08-27 13:44:05 +09:30
conf.c Fix last warning about integer size format 2013-07-22 11:28:33 +09:30
conf.h Improve config schema macros and log options 2013-04-05 15:00:54 +10:30
config_test.c Improve new config code, SORTED and NO_DUPLICATE flags 2012-11-30 12:32:30 +10:30
config.guess Artefacts created by libtoolize -c -i 2012-09-12 15:21:50 +09:30
config.sub Artefacts created by libtoolize -c -i 2012-09-12 15:21:50 +09:30
configure.in Issue #20: merge branch 'sockets' into 'development' 2013-09-19 04:30:14 +09:30
constants.h Only ack soon if we have been asked to 2013-08-30 17:38:29 +09:30
crc32.c Use correct variable size for crc's 2013-02-20 15:36:26 +10:30
crypto.c Add API to generate public key from private key 2013-07-25 14:40:59 +09:30
crypto.h Add API to generate public key from private key 2013-07-25 14:40:59 +09:30
dataformats.c Replace "add did" command with improved "keyring add did" 2013-02-14 16:06:01 +10:30
directory_client.c Major refactor to packet queuing and delivery in preparation for unicast link tracking. 2013-08-09 09:37:08 +09:30
directory_service.c Add 'sid:' field to output of "reverse lookup" 2013-02-15 19:34:24 +10:30
dna_helper.c Clean up string formatting for 64bit compilation 2013-07-15 09:59:24 +09:30
encode.c Put back a pile of files needed for building on osx, and also required 2012-03-15 10:57:38 +10:30
fakeradio.c Basic routing test with simulated serial modem interface 2013-08-19 16:59:10 +09:30
fdqueue.c Improve fdqueue.c debug logging 2013-09-19 04:30:40 +09:30
fifo.c Add PA setup and FIFO code (still not plumbed into the main program) 2012-04-23 16:32:47 +09:30
fifo.h Add PA setup and FIFO code (still not plumbed into the main program) 2012-04-23 16:32:47 +09:30
headerfiles.mk Add new rotbuf primitives 2013-04-29 14:30:44 +09:30
install-sh Artefacts created by libtoolize -c -i 2012-09-12 15:21:50 +09:30
INSTALL.md Clean up a few details in INSTALL and README 2013-05-29 14:15:40 +09:30
instance.c Issue #20: merge branch 'sockets' into 'development' 2013-09-19 04:30:14 +09:30
jni.c Imported ref10/ implementation of crypto_sign from supercop-20120525 2012-10-18 17:26:48 +10:30
keyring.c Get rid of worse-than-useless keyring debug 2013-09-10 13:28:27 +09:30
log.c Use consistent integer types and formats 2013-09-09 12:09:40 +09:30
log.h Log crashes and unexpected signals as FATAL 2013-07-31 14:53:52 +09:30
lsif.c fix header selection for lsif.c 2013-07-19 20:04:15 +09:30
ltmain.sh Artefacts created by libtoolize -c -i 2012-09-12 15:21:50 +09:30
macconfig Fixed broadcast address discovery to work on Mac. 2011-08-08 16:11:05 +09:30
main.c Move cli global state into a structure and pass it around 2013-07-03 16:51:27 +09:30
Makefile.dbg Move debug options to Makefile.dbg so we don't have to re-run configure. 2012-07-29 14:55:10 +09:30
Makefile.in Improve version_string.sh script 2013-09-12 17:50:54 +09:30
mdp_client.c Make overlay_mdp_client_socket_path local 2013-08-26 11:55:11 +09:30
mdp_client.h overlay_mdp_bind and overlay_mdp_getmyaddr should be visible in MDP API 2013-08-26 11:55:11 +09:30
mem.c Add erealloc() function to mem.h, mem.c 2013-04-30 17:26:27 +09:30
mem.h Add erealloc() function to mem.h, mem.c 2013-04-30 17:26:27 +09:30
meshms.c Always store payloads with a temporary id 2013-08-27 16:15:51 +09:30
meshpotato_build Assorted unknown changes. Updated Makefile.in etc to properly build serval.c for building asterisk module. 2011-06-15 13:52:30 +09:30
monitor-cli.c Move cli global state into a structure and pass it around 2013-07-03 16:51:27 +09:30
monitor-client.c Issue #20: merge branch 'sockets' into 'development' 2013-09-19 04:30:14 +09:30
monitor-client.h Reuse command line parsing framework with monitor interface 2012-09-25 13:31:34 +09:30
monitor.c Issue #20: improve socket set-up logging 2013-09-19 04:30:40 +09:30
mpbuild Added mesh potato build script. 2011-08-10 15:39:40 +02:00
net.c Clean up string formatting for 64bit compilation 2013-07-15 09:59:24 +09:30
net.h New hton_in_addr() function 2013-02-05 16:56:37 +10:30
nonce.c Move cli global state into a structure and pass it around 2013-07-03 16:51:27 +09:30
os.c More consistent use of sleep_ms 2013-08-27 15:14:17 +09:30
os.h Fix bug in new bcmp() function 2013-05-21 12:45:33 +09:30
overlay_address.c Route mulit-hop via unicast links 2013-08-09 16:37:54 +09:30
overlay_address.h Major refactor to packet queuing and delivery in preparation for unicast link tracking. 2013-08-09 09:37:08 +09:30
overlay_buffer.c Prevent crash if dumping buffer contents 2013-08-30 17:38:29 +09:30
overlay_buffer.h Split network destination structure from interface structure 2013-08-05 14:35:49 +09:30
overlay_interface.c Resurrect packet visualisation 2013-09-02 14:55:02 +09:30
overlay_link.c Use int for signed value to fix android portability 2013-08-13 15:16:17 +09:30
overlay_mdp_services.c Fix format warnings on 64bit machines 2013-08-26 11:54:46 +09:30
overlay_mdp.c Fix Rom's socket cleanup-on-start code 2013-09-19 04:30:40 +09:30
overlay_olsr.c Major refactor to packet queuing and delivery in preparation for unicast link tracking. 2013-08-09 09:37:08 +09:30
overlay_packet.h Adjust retransmission delay based on measured RTT 2013-08-29 15:28:20 +09:30
overlay_packetformats.c Only ack soon if we have been asked to 2013-08-30 17:38:29 +09:30
overlay_packetradio.c More consistent use of sleep_ms 2013-08-27 15:14:17 +09:30
overlay_payload.c Only ack soon if we have been asked to 2013-08-30 17:38:29 +09:30
overlay_queue.c Only ack soon if we have been asked to 2013-08-30 17:38:29 +09:30
overlay.c Add test for server start with --keyring-pin option 2013-09-09 14:47:02 +09:30
pa_phone.c Refactor: rename some cli.h structs 2013-02-13 17:43:24 +10:30
packetformats.c Overhaul debug flags 2012-12-11 15:59:46 +10:30
performance_timing.c Log crashes and unexpected signals as FATAL 2013-07-31 14:53:52 +09:30
randombytes.c More consistent use of sleep_ms 2013-08-27 15:14:17 +09:30
README.md Clean up a few details in INSTALL and README 2013-05-29 14:15:40 +09:30
rhizome_bundle.c Change manifest service to MeshMS2 2013-08-01 11:37:35 +09:30
rhizome_crypto.c Don't update the database author if we already know it 2013-08-27 15:11:56 +09:30
rhizome_database.c Treat empty filehash the same as NULL 2013-08-28 16:15:28 +09:30
rhizome_direct_http.c Remove payload if hash doesn't match when reading back 2013-08-21 15:45:18 +09:30
rhizome_direct.c Clean up string formatting for 64bit compilation 2013-07-15 09:59:24 +09:30
rhizome_fetch.c Issue #20: merge branch 'sockets' into 'development' 2013-09-19 04:30:14 +09:30
rhizome_http.c relocate point of action for debug.rhizome_nohttptx so that it 2013-08-25 16:53:26 +09:30
rhizome_packetformats.c Fetch file payloads if they are missing, even if we already have the manifest 2013-08-22 15:14:21 +09:30
rhizome_store.c Always store payloads with a temporary id 2013-08-27 16:15:51 +09:30
rhizome_sync.c Count number of BARs we have seen 2013-08-30 17:38:29 +09:30
rhizome.c Treat empty filehash the same as NULL 2013-08-28 16:15:28 +09:30
rhizome.h Always store payloads with a temporary id 2013-08-27 16:15:51 +09:30
rotbuf.c Fix bug in rotbuf_next_chunk() when rotation == 0 2013-05-15 16:46:39 +09:30
rotbuf.h Fix rotbuf_advance(), add rotbuf_remain() 2013-04-30 17:28:32 +09:30
route_link.c Remember outgoing links 2013-08-30 17:38:29 +09:30
serval_packetvisualise.c Resurrect packet visualisation 2013-09-02 14:55:02 +09:30
serval.h Issue #20: improve new socket function logging 2013-09-19 04:30:40 +09:30
servalwrap.c Fix android commandline interface 2013-07-09 16:46:16 +09:30
server.c Pass command-line args to server() function 2013-08-30 11:20:19 +09:30
sha2.c Initial stab at porting to Solaris. 2012-09-05 20:42:50 +09:30
sha2.h Substantial preparatory work towards Rhizome/MeshMS store-and-forward 2011-12-13 19:34:12 +10:30
sighandlers.c more work on dna helper interface. 2012-06-21 16:35:28 +09:30
slip.c fix stupid sscanf() result check mismatch with field count. 2013-07-31 10:38:36 +09:30
socket.c Issue #20: fix bug in new esocket() function 2013-09-19 04:30:40 +09:30
sourcefiles.mk Issue #20: merge branch 'sockets' into 'development' 2013-09-19 04:30:14 +09:30
srandomdev.c Fix warnings from gcc 4.6.3 2013-03-18 16:48:15 +10:30
str.c Add strn_fromhex(), improve hexvalue() 2013-09-03 17:29:41 +09:30
str.h Add strn_fromhex(), improve hexvalue() 2013-09-03 17:29:41 +09:30
strbuf_helpers.c Issue #20: improve socket set-up logging 2013-09-19 04:30:40 +09:30
strbuf_helpers.h Issue #20: merge branch 'sockets' into 'development' 2013-09-19 04:30:14 +09:30
strbuf.c Fix bug in strbuf_puts(), not always appending nul 2013-02-20 14:28:06 +10:30
strbuf.h Log format warnings for strbuf_sprintf 2013-08-15 16:31:26 +09:30
strlcpy.c Fix issues arising from new strlcpy.c 2012-08-14 11:23:27 +09:30
strlcpy.h Fix build when strlcpy is present 2013-01-11 14:43:37 +10:30
testconfig.sh.in Trival test of dna JNI command line entry point 2012-04-23 18:25:26 +09:30
testdefs_rhizome.sh Don't encrypt by default when the recipient is broadcast 2013-07-19 10:28:15 +09:30
testdefs.sh Add test for server start with --keyring-pin option 2013-09-09 14:47:02 +09:30
testframework.sh Improve test framework: assertGrep --fixed-strings option 2013-09-05 09:19:14 +09:30
testnacl.c Added test code for NaCl. 2011-10-25 13:39:14 +10:30
tfw_createfile.c Fix string format warning 2013-08-19 13:54:19 +09:30
version_servald.c Servald version string from git describe 2013-03-12 14:03:33 +10:30
version_string.sh Fix bug in version_string.sh 2013-09-17 10:51:50 +09:30
vomp_console.c Move cli global state into a structure and pass it around 2013-07-03 16:51:27 +09:30
vomp.c Add packet retransmissions due to missed ack's 2013-05-29 11:58:05 +09:30
xprintf.c Add XPRINT strbuf adapter 2013-03-25 12:02:48 +10:30
xprintf.h Resurrect packet visualisation 2013-09-02 14:55:02 +09:30

Serval DNA

Serval Project, May 2013

This repository contains the source code for the “core” Serval components implemented in GNU C:

  • The Distributed Numbering Architecture (DNA) is the key innovation that makes mesh telephony viable in the absence of any infrastructure, eg, in the aftermath of a natural disaster or in remote locations. It is a protocol carried over MDP (see below) that allows any device to ask its neighboring devices for a phone number (DID). Such a request will propagate through the mesh, and any device may respond with the identity (SID) of a subscriber who has “claimed” that DID.

  • The Serval Keyring is a flat file containing all the user identities on a single device. Each identity is a set of elliptic curve secret cryptographic keys that belong to a single “mesh subscriber”, indexed by the subscriber's 256-bit public key, called a SID. Each identity in the keyring is locked by its own user-chosen password (called a PIN in the code and documentation), using elliptic curve cryptography to protect locked entries from theft or tampering, and steganography to allow the user to plausibly deny the existence of any locked identity.

  • The Mesh Datagram Protocol (MDP) is Serval's own layer 3 protocol designed for secure mesh networking. It is completely independent of Internet protocols such as IP and UDP, but for the time being is implemented as an “overlay” network based on UDP/IP because that is the interface that Linux and other operating systems provide for sending data over WiFi. However, MDP could easily be implemented directly over a layer 2 data link such as WiFi or Ethernet MAC. MDP uses subscribers' public keys (SID) as source and destination addresses, and has a 32-bit port number analogous to the 16-bit port number used in TCP/IP.

  • The Voice over Mesh Protocol (VoMP) is Serval's own call negotiation and two-way audio streaming protocol used to implement mesh voice calls. It is analogous to SIP/RTS, which is the dominant protocol used to implement Voice over Internet Protocol, but VoMP is designed for the variable and unstable conditions of wireless mesh networks. VoMP's session state model and signalling can handle packet loss, mid-call re-routing and re-connection where SIP would fail. VoMP's audio streaming can encapsulate many codecs and even DTMF (dialpad button) signalling.

  • The Rhizome content distribution service is a storage engine implemented using SQLite and a content-exchange protocol based on MDP and HTTP for the pervasive dissemination of content like images, videos, documents, software upgrades, etc. Each piece of content in Rhizome is called a “bundle”, which has two parts: a manifest that describes the content, and the payload, which is the content itself. Each bundle has its own unique cryptographic identifier that allows any recipient to verify that it has not been tampered with.

  • The MeshMS messaging service is implemented using Rhizome as its transport, with each thread represented as a pair of bundles, one for each direction. At present, the MeshMS logic is implemented in Java within the Serval Mesh Android app, but is planned to be re-implemented in C as part of Serval DNA (see issue #28).

  • Serval Infrastructure services may optionally be deployed on any devices in the mesh to expose external services to mesh subscribers and vice versa (eg, VoIP gateways, SMS satellite links, packetised web), and to overcome scalability limitations of a perfectly decentralised mesh (eg, central telephone directory).

Most of these services are performed by a daemon process called servald. Serval Infrastructure is implemented by a separate daemon called directory_service.

Serval DNA is free software produced by the Serval Project and many contributors. It is licensed to the public under the GNU General Public License version 2. All source code is freely available from the Serval Project's serval-dna Git repository on GitHub.

The copyright in most of the source code in Serval DNA is held by Serval Project Inc., a not-for-profit association incorporated in the state of South Australia in the Commonwealth of Australia for the purpose of developing the Serval mesh software.

The Serval Project will accept contributions from individual developers who have agreed to the Serval Project Developer Agreement - Individual, and from organisations that have agreed to the Serval Project Developer Agreement - Entity.

Download, build and test

Instructions for downloading, building and testing Serval DNA are in INSTALL.md. (If that link is does not work, try INSTALL.md.)

Configure

See doc/Servald-Configuration (alternative link [doc/Servald-Configuration] (/servalproject/serval-dna/blob/master/doc/Servald-Configuration.md)).

More information

The servald executable is a multi-purpose program designed to be invoked directly from the command line and also via JNI from within a Java program. The following command will print a summary of all the operations that servald offers:

$ servald help

Some operations are self-contained, some start and stop the servald daemon process, some communicate with the servald daemon as an MDP client, and others via a two-way pipe called the monitor interface.

For more documentation, see: