Commit Graph

417 Commits

Author SHA1 Message Date
Jeremy Lakeman
79f4a78278 Add link state monitor commands 2013-05-02 16:19:59 +09:30
Jeremy Lakeman
dd03014b44 Choose the best link from a neighbour 2013-05-02 14:29:31 +09:30
Jeremy Lakeman
9ee09e36a0 Replace old routing engine with new link state engine 2013-05-02 14:29:28 +09:30
Andrew Bettison
4e48725c93 Merge branch 'new-keyring' into 'development' 2013-04-30 17:57:59 +09:30
Andrew Bettison
1f10f05302 Add "keyring dump" command 2013-04-30 17:29:06 +09:30
Jeremy Lakeman
559b270966 Only compare routes that have all links via the same neighbour 2013-04-29 17:07:36 +09:30
Jeremy Lakeman
85b885dde2 Add basic link state routing 2013-04-26 16:54:01 +09:30
gardners
3e7de24bdf added uartpbs and ctsrts config options to packet radio serial
interface configuration options.
2013-04-26 15:16:51 +09:30
Andrew Bettison
a8b88a462f Fix clang compiler warnings (revealed some bugs) 2013-04-12 17:16:50 +09:30
Andrew Bettison
a5d3c16928 Move 'serverMode' flag from server.c to log.c
Because log.c and conf.c now depend on serverMode
2013-03-18 15:34:33 +10:30
Andrew Bettison
b17f5a6f63 Servald version string from git describe 2013-03-12 14:03:33 +10:30
Andrew Bettison
b7185a294f Fix keyring SEGV bug
Sometimes, when adding a PIN to a keyring (eg, when opening a keyring
file), a SEGV would be caused while trying to validate the MAC for an
entry which apparently had zero keypair entries.

Changed some keyring struct 'int' fields to 'unsigned int', to ensure
that comparison logic behaves as expected.

Refactored some keyring code for more clarity and code maintenance
safety.

Added TODO comment about keyring file format non-back-compatibility.
2013-03-07 14:27:33 +10:30
Andrew Bettison
705f414a4d Fix SEGV bug in keyring_enter_pin()
The public and private key length fields were stored as 'int' not
'unsigned', so arithmetic for checking buffer overrun was not correct.
2013-03-06 14:02:33 +10:30
Jeremy Lakeman
90386ce1b1 Merge remote-tracking branch 'origin/development' into serial
Conflicts:
	rhizome.h
	rhizome_database.c
	rhizome_fetch.c
	rhizome_store.c
2013-02-20 17:23:03 +10:30
Andrew Bettison
390655580d Add 'rhizome delete' and 'rhizome clean' commands
sqlite_void_exec() and its ilk now return the count of changed rows, not
just zero, on success

sqlite_exec_prepared() and its ilk now return the count of rows (number
of step results SQLITE_ROW), instead of just zero, on success

rhizome_clean() function now produces an optional report of its changes

rhizome_fail_write() and rhizome_finish_write() now log WARNings not
ERRORs if the SQL DELETE FROM FILES or DELETE FROM FILEBLOBS statements
fail

Refactor rhizome_open_read() to use sqlite_exec_int64()

Ensure that 'rhizome extract' and 'rhizome dump' commands return exit
status of 1 in "not found" conditions, not 255, which is reserved for
errors

Test cases for four new commands: 'rhizome delete bundle', 'rhizome
delete manifest', 'rhizome delete payload' and 'rhizome delete file'
(no test case for 'rhizome clean' yet)
2013-02-20 15:37:09 +10:30
gardners
7cc4324ac6 added facility to log a clue for crash handler to hint where things
got stuck/caused a crash.
2013-02-20 15:36:31 +10:30
gardners
f114e6d19e add progress data for each rhizome transfer. 2013-02-20 15:36:28 +10:30
gardners
d49649ed96 add stored bundle count to /rssi web page display. 2013-02-20 15:36:28 +10:30
gardners
3bd4c49af5 add more info to /rssi http page. 2013-02-20 15:36:27 +10:30
gardners
66956d84ce add /rssi page to rhizome web server to allow easy querying of
radio link budget.
2013-02-20 15:36:27 +10:30
gardners
6a620fe221 added command line test for serial encapsulation.
renamed "crypt test" to "test crypt" for consistency.
2013-02-20 15:36:26 +10:30
Jeremy Lakeman
ed7912295a Use correct variable size for crc's 2013-02-20 15:36:26 +10:30
gardners
fea06932e5 added new slip.c with 7-bit-high packet encapsulation, packet length
and CRC32.
Also added in-line RSSI report reception for RFD900 radios.
2013-02-20 15:36:24 +10:30
Jeremy Lakeman
6d9bbe2e2c Refactor interface handling to separate encapsulation from stream type 2013-02-20 15:36:23 +10:30
Jeremy Lakeman
ba1800012e Only advertise BAR's on an alarm
- we no longer hit the database for every outgoing packet, attempting to announce bundles
- we no longer advertise manifests periodically
- when an interesting bar arrives, we ask for the manifest to be announced, which uses the existing packet format
2013-02-20 15:36:23 +10:30
Jeremy Lakeman
c7caec488a Don't aggregate packets together on radio links 2013-02-20 15:36:23 +10:30
Jeremy Lakeman
84ad4debfa Throttle serial radio devices when tx buffer is in use 2013-02-20 15:36:22 +10:30
gardners
e20cfdb59d closer to working.
POLLOUT seems to get stuck once triggered.
2013-02-20 15:36:21 +10:30
gardners
7287a2d599 add hook for transmitting packet via packet radio interface.
make serial port non-blocking (which for some reason has also
killed our ability to read from it :/).
2013-02-20 15:36:20 +10:30
gardners
0268ccd21a setup serial port mode when opening packet radio interface.
(now reads bytes over serial line)
2013-02-20 15:36:20 +10:30
gardners
190a5e693f refactored packet radio code mostly into separate file.
began writing stateful packet decoder.
2013-02-20 15:36:20 +10:30
gardners
70af7fae0d initial work on implementing packet radio interface.
can open and read from TTY.
doesn't do anything with the data yet.
doesn't write proper packets to the interface yet.
doesn't use bitrate config option yet.
2013-02-20 15:36:19 +10:30
Andrew Bettison
c176d23726 Add 'sid:' field to output of "reverse lookup"
Use sid_t in more places
2013-02-15 19:34:24 +10:30
Andrew Bettison
c42260f5f9 Replace "add did" command with improved "keyring add did"
Output is same format as "keyring add" command

Fixed minor bug in rolling a random DID -- last byte was not random

Some code improvements, including better support for sid_t
2013-02-14 16:06:01 +10:30
Andrew Bettison
e86a129d49 Refactor: rename some cli.h structs
Now all symbols defined in cli.h start with or contain "cli_"
2013-02-13 17:43:24 +10:30
Andrew Bettison
f66a894a63 Improve keyring PIN handling
Replace explicit [<pin,pin...>] command-line arguments with --entry-pin=<pin>
options.  Update test scripts accordlingly.

Add --keyring-pin=<pin> option (with one test case).
2013-02-13 16:49:52 +10:30
Andrew Bettison
fcb6600cd6 Rewrite command-line parser
Now supports optional args followed by non-optional.
2013-02-12 18:00:37 +10:30
Jeremy Lakeman
b35c1aca43 Specify that unicast traffic should use unicast UDP packets 2013-01-29 11:57:13 +11:00
Jeremy Lakeman
88f7fef992 Reduce priority of rhizome on MDP, stop sooner when packet queues fill 2013-01-28 13:35:24 +11:00
Jeremy Lakeman
3a93fee8a5 New JNI interface to better support cursor result sets 2013-01-23 14:43:50 +10:30
Jeremy Lakeman
a492c05d64 Re-add database cleanup 2012-12-31 15:09:12 +10:30
Jeremy Lakeman
9a78e16625 Use payload queue for periodic route advertisements 2012-12-19 12:36:28 +10:30
Jeremy Lakeman
82db15db5b Use any packet as a self-announce
Stop sending OF_TYPE_SELFANNOUNCE
Deprecate OF_TYPE_DATA_VOICE
Tweak payload priorities
Don't allow client applications to send high priority payloads
2012-12-16 10:09:29 +10:30
Jeremy Lakeman
e517e3a59e Add per-interface packet transmit limits 2012-12-14 17:07:28 +10:30
Jeremy Lakeman
7be03f15e7 Move link tracking to one c file 2012-12-14 17:07:28 +10:30
Jeremy Lakeman
f41830ebfb Add interface and sequence flags to packet format 2012-12-14 17:07:27 +10:30
Andrew Bettison
8d5862d599 Server daemon reloads config every 1 sec 2012-12-14 16:48:12 +10:30
Jeremy Lakeman
2932544eb8 Add IPv4 addresses to dummy interface 2012-12-10 14:06:25 +10:30
Jeremy Lakeman
78aa01ad30 Add stun lookup messages 2012-12-10 14:05:57 +10:30
Jeremy Lakeman
3a4f052470 Modify vomp call state to use subscriber structures 2012-12-10 14:05:56 +10:30
Andrew Bettison
8425882ffc Merge branch 'newconfig' into 'master'
Conflicts:
	commandline.c
	conf.h
	dataformats.c
	log.h
	overlay_address.c
	overlay_interface.c
	packetformats.c
	rhizome.c
	serval.h
	tests/directory_service
	vomp_console.c
2012-12-07 14:09:55 +10:30
Jeremy Lakeman
a4eaf37bbd Shrink vomp headers, reduce servald's knowledge of codec details 2012-12-05 15:38:04 +10:30
Jeremy Lakeman
3dfd64f4da Add manually triggered network scan command 2012-12-05 15:13:47 +10:30
Andrew Bettison
71ed78e058 Make all 'config' tests pass
Change a test case: configuration options are now case sensitive.

Fix config file load and parse logic in conf.c, always copy 'debug' flags
from config.debug.

The config schema 'interfaces' option is no longer MANDATORY.

Introduce new CLIFLAG_PERMISSIVE_CONFIG to supress bad-config ERROR messages
from the 'config set' and 'config get' commands.

Refactor cli_execute() into cli_parse() and cli_invoke().  Use *const* struct
command_line_option everywhere.
2012-12-04 16:52:49 +10:30
Jeremy Lakeman
5c7eb4a594 Add unicast probe packets
Probe directory service instead of assuming that it is always reachable
Fix directory service and routing tests
2012-12-04 14:47:57 +10:30
Andrew Bettison
caa209fc1d Integrate new config into servald
Not passing any tests yet, but compiles and links and simple uses do not
SEGV.
2012-12-04 14:12:28 +10:30
Andrew Bettison
d3c2205d44 Add os.c and "os.h", replacing mkdirs.c
The new header "os.h" defines a supplemental API around existing basic
operating system services (system calls and standard library functions).

Moved some function prototypes from serval.h and net.h into os.h.

This allows non-servald executables to take advantage of this API without
having to include serval.h and bringing in all the other servald link-time
baggage.
2012-12-04 10:12:35 +10:30
Andrew Bettison
5139d8d34d Add mem.c and "mem.h" with emalloc() etc. 2012-12-04 10:03:32 +10:30
Jeremy Lakeman
2b21a691ca Merge remote-tracking branch 'origin/master' into packet_format
Conflicts:
	constants.h
	packetformats.c
2012-12-03 14:10:32 +10:30
Jeremy Lakeman
a67e4114a8 Allow for payloads with a pre-determined destination 2012-12-03 13:44:31 +10:30
gardners
692817ffba added functions for reading values from byte streams. 2012-11-30 21:02:43 +10:30
gardners
7a4e3d20f8 Actually send Rhizome over MDP request packets.
Actually call appropriate callback when receiving Rhizome over
MDP packets.
2012-11-30 14:17:05 +10:30
gardners
eb7524e068 factored out internal MDP services into a separate file, and made
core case statement in that brief and clear.
2012-11-30 11:48:00 +10:30
Jeremy Lakeman
54f9d9b0e0 Rely on please explain, don't send too many full sids 2012-11-28 15:44:39 +10:30
Jeremy Lakeman
5a5853f38a Don't lookup subscribers twice for route announcements 2012-11-28 15:43:58 +10:30
Jeremy Lakeman
e0878644fe Add command to dump routing table 2012-11-28 15:43:58 +10:30
Jeremy Lakeman
627e86fb73 Shift all payload header writing to one place 2012-11-28 15:43:58 +10:30
Jeremy Lakeman
ce63e96db2 Use decode structure for tracking previous sid 2012-11-28 15:43:57 +10:30
Jeremy Lakeman
3d14e2f3db Hide more information about packet headers 2012-11-28 15:43:56 +10:30
Jeremy Lakeman
4ca6db34d6 Encapsulate payload header details 2012-11-28 15:40:39 +10:30
Andrew Bettison
494a766b9e Improve str.h and str.c
Move alloca_tohex() from serval.h into str.h so it can be used stand-alone.

Rename str_to_ll_scaled() to str_to_int64_scaled().  Add str_to_uint64_scaled()
and scale_factor().

Add a few more URI parsing functions.  Move some functions out of str.c and
into str.h as inline functions.
2012-11-22 18:15:40 +10:30
Andrew Bettison
960a6293e1 Move str_is_uri() from dataformats.c to str.c
Add lots of URI unpacking functions as well.
2012-11-21 18:08:06 +10:30
Jeremy Lakeman
36cee7e9bc Move payload queueing functions to separate .c file 2012-11-21 11:02:00 +10:30
Jeremy Lakeman
10bde11918 Remove resolution of peer details from node info command 2012-11-14 12:17:41 +10:30
Jeremy Lakeman
93ee6b3fc8 Don't kill the interface for unreachable unicast peers 2012-11-12 14:46:09 +10:30
Andrew Bettison
cbc91d11e0 Improve performance timing diagnostics
Add __whence args to fd_func_enter() and fd_func_exit() so that their log
messages get reported from the location of the IN() or OUT() macro, not a line
in performance_timing.c.

Removed diagnostic information from the FATAL() message in fd_func_exit(), and
a comment explaining why (causes SEGV).
2012-11-12 14:38:50 +10:30
Jeremy Lakeman
54e2d66934 Allow for with slightly longer paths 2012-11-09 13:40:55 +10:30
Andrew Bettison
4450116472 Refactor string functions, add str_fromprint()
Move lots of non-Serval-specific string functions from "serval.h"/dataformats.c
to "str.h"/str.c.

Add str_fromprint() function that reverses the effect of toprint(): interprets
escape sequences in the source string "\n\t\r\0\xHH\\" and replaces them with a
single char in the destination string.
2012-11-07 16:42:45 +10:30
Andrew Bettison
39fc4ce6de Issue #30, remove periodic Rhizome fetch alarm
Replace the main-loop scheduled periodic alarm with an "activate" alarm that is
scheduled whenever a fetch candidate is added to any queue, unless the alarm is
already scheduled.

Replace the "rhizome.fetch_interval_ms" config item with
"rhizome.fetch_delay_ms" [default 50], which is the number of milliseconds
between adding a fetch candidate and firing the "activate" alarm.  This allows
time for a few more Rhizome advertisment packets to arrive after the first one,
before deciding which fetches to start first.

Add new `is_scheduled()` alarm primitive.
2012-10-24 15:13:50 +10:30
Andrew Bettison
a9d3a1387c Issue #30, rewrite Rhizome fetch queues and slots
Causes SEGV in rhizomestress test.
2012-10-23 18:10:20 +10:30
Jeremy Lakeman
f93216f369 Remove dead code 2012-10-19 15:02:22 +10:30
Jeremy Lakeman
f1b0374b97 Extract crypto signing primitives from mdp processing 2012-10-19 14:54:41 +10:30
Jeremy Lakeman
95843e1f20 Pass overlay frame into mdp processing 2012-10-19 10:40:03 +10:30
Andrew Bettison
8ab7cc79b5 Improve debug logging from watch(), schedule() etc.
Use new '__whence' mechanism.
2012-10-16 17:00:03 +10:30
Andrew Bettison
259b9a9d24 Logging/debug improvements: __WHENCE__, __whence
Introduce __WHENCE__ macro and a block comment in log.h explaining it.

In "primitive" kinds of functions, rename 'whence' arguments to '__whence' and
use WHYF(), WARNF(), DEBUGF() macros instead of calling logMessage() directly.
2012-10-16 17:00:03 +10:30
Paul Gardner-Stephen
37495e4794 fix interface detection on solaris. 2012-10-15 15:58:42 +10:30
Andrew Bettison
3f1f495d68 Issue #17, overhaul manifest author crypto logic
Add test case for new feature of the "rhizome add" command: if the author SID
is not specified (empty arg) then it searches the keyring for the author.

Removed "authorSid" argument from several functions that also take a struct
rhizome_manifest * arg, since the author, if known, is now supplied in the
struct.

Improve return value handling and refactored some rhizome crypto code.
2012-10-11 17:58:24 +10:30
Jeremy Lakeman
b22e3f1964 Add hop count to mdp ping
- Allow mdp client to specify ttl
- Copy ttl into and out of overlay frame
2012-10-10 16:22:31 +10:30
Jeremy Lakeman
4b2b8f1783 Store keyring identity pointer for local identities in subscriber tree 2012-10-10 15:29:36 +10:30
Jeremy Lakeman
5d553538e7 Remove dead code 2012-10-09 16:20:44 +10:30
Jeremy Lakeman
1f379ea209 Add and preserve QOS bit flags in packet header 2012-10-09 16:17:07 +10:30
Jeremy Lakeman
e28deeb6d5 Move requested payload queue into frame structure 2012-10-09 15:44:37 +10:30
Andrew Bettison
3433b0fbb5 Move is_sid_broadcast() and is_sid_any() macros into serval.h
From overlay_mdp.c.  is_sid_broadcast() was defined as is_broadcast().

Also clean up the signature and implementation of is_all_matching().
2012-10-09 13:49:23 +10:30
Jeremy Lakeman
275aa49903 Change route announcement format, add please explain support 2012-10-09 12:57:11 +10:30
Andrew Bettison
89343c69cd Merge branch 'rhizomedirect' into 'master' 2012-10-05 17:45:30 +09:30
Jeremy Lakeman
48c9a7067e keyring_get_nm_bytes doesn't need to know about port numbers 2012-10-05 09:14:24 +09:30
Jeremy Lakeman
32cd46c165 Simplify id peers command, hide mdp implementation details from node info 2012-10-03 16:21:06 +09:30
Jeremy Lakeman
b72c01518b Move SAS key storage into subscriber structure 2012-10-03 13:59:46 +09:30
Jeremy Lakeman
fa7719fbe8 Write simple vomp console client 2012-09-28 15:23:50 +09:30
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