Commit Graph

168 Commits

Author SHA1 Message Date
Jeremy Lakeman
ecb79d818f Refactor storage of binary values to enable reuse 2016-09-13 15:25:39 +09:30
Andrew Bettison
7f0fef2209 Fix an intermittent server test failure
The quit-on-monitor-client-disconnect test was non-deterministic
depending on load (eg, other concurrently running tests).  Under load,
it was likely that the server did not process the "monitor quit" command
before checking for disconnect, so the server did not terminate.

The fix was to make the monitor interface read and process all queued
input from the client before checking for HUP or ERR condition on the
socket.  With this fix, the "sleep 1" kludges before and after the echo
"monitor quit" to the console command are no longer needed.

In the process the monitor interface code was modernised: eg, now it
calls read_nonblock() instead of read(2).
2016-09-06 12:33:29 +09:30
Andrew Bettison
0869470d96 Add DEBUG_cli_parsed() statements to monitor commands 2016-09-06 11:19:45 +09:30
Jeremy Lakeman
83b6ecb453 Roll an in memory identity when the keyring is empty 2016-08-02 11:01:32 +09:30
Jeremy Lakeman
6feaddf24d Rework route print command to use newer mdp api, show live updates & deprecate monitor messages 2016-05-10 10:28:14 +09:30
Jeremy Lakeman
c78ee668d5 Add interface index to UP/DOWN monitor message 2016-04-27 13:16:00 +09:30
Jeremy Lakeman
c04d015bc6 Don't continuously toggle fd blocking mode 2016-03-30 16:25:43 +10:30
Jeremy Lakeman
edc1658cfd Rework detection of rhizome add from cli to trigger bundle_add 2016-03-08 13:33:23 +10:30
Jeremy Lakeman
cf8932d5ba Use trigger for interface up/down 2016-03-08 10:16:20 +10:30
Jeremy Lakeman
79e8a94792 Add route_link.h 2015-09-28 11:58:48 +09:30
Andrew Bettison
7d9a5faa4e Move if(config.debug.xxx) tests into DEBUGF()
Original DEBUG() and DEBUGF() macros renamed to _DEBUG() and _DEBUGF()
New DEBUG() and DEBUGF() macros, first argument is flagname
New DEBUGF2(foo, bar, ...) macro does if(config.debug.foo||config.debug.bar) test
Replace almost all config.debug.xxx references to IF_DEBUG(xxx)
2015-07-13 16:00:05 +09:30
Jeremy Lakeman
98ffa90b72 Log the source of monitor errors 2014-10-03 11:16:41 +09:30
Jeremy Lakeman
2ec63b371a Build the array of console commands by using linkage tricks 2014-08-22 10:36:52 +09:30
Jeremy Lakeman
628a52ca87 Add monitor message for interface up/down events 2014-06-13 13:34:10 +09:30
Jeremy Lakeman
e5e848e838 Ensure interface and routing alarms stop when network interfaces are all down 2014-06-12 16:04:15 +09:30
Jeremy Lakeman
52da7778cd Allow closing a monitor connection to force the server to quit 2014-06-11 20:39:26 +09:30
Jeremy Lakeman
025726dcab Fix android build, related to issue #76 fix 2014-04-07 15:25:43 +09:30
Jeremy Lakeman
f78a4d69a2 Don't shuffle monitor client connections on close 2014-02-25 13:55:49 +10:30
Jeremy Lakeman
b8971e51f4 Refactor socket helper functions to take socket_address struct 2014-02-20 14:44:38 +10:30
Jeremy Lakeman
b56f4c27d3 Replace internal usage of overlay_mdp_dispatch 2014-02-19 16:39:42 +10:30
Jeremy Lakeman
63db7b4513 Refactor dna lookup requests to new interface 2014-02-19 16:35:58 +10:30
Andrew Bettison
5d741361ea Fix -Wsign-compare warnings: make loop counters unsigned 2013-12-10 16:21:23 +10:30
Andrew Bettison
30b2059608 Fix -Wunused-parameter warnings
New UNUSED(param) macro suppresses the warning for a specific parameter

In some cases, removed the unused parameters.  In others, used the
parameter in a DEBUGF() or assert() statement to document the intent.
2013-12-09 18:22:18 +10:30
Petter Reinholdtsen
804af66308 Add supid copyright headers on request from Andrew Bettison in the serval project. 2013-12-07 18:38:14 +01:00
Petter Reinholdtsen
4d80c7c5db Merge branch 'development' into warnings-security 2013-12-07 17:57:46 +01:00
Jeremy Lakeman
b63f1f0114 Fix formatting issues 2013-12-06 12:10:08 +10:30
Andrew Bettison
9b64bb87e0 Uniform copyright notices
Added some missing copyright/license block comments
2013-12-04 17:15:36 +10:30
Petter Reinholdtsen
36a2eed016 Merge latest version. Clean up merge conflict. 2013-12-01 00:06:36 +01:00
Jeremy Lakeman
99d5d9fa1f Refactor dataformats into separate header 2013-11-27 13:11:42 +10:30
Jeremy Lakeman
0d5d878521 Refactor socket name and address length handling 2013-11-27 13:08:37 +10:30
Petter Reinholdtsen
4f2b8b8fb7 Make sure all array values are initialized, getting rid of compiler warning. 2013-10-30 18:19:54 +01:00
Andrew Bettison
a95ef79139 Use sid_t everywhere
Remove stowSid() at last

Change API of tohex() and strbuf_tohex(), to pass string length instead of
binary byte count.  This allows odd numbers of hex digits to be produced.

Remove alloca_tohex_sid(); replace with alloca_tohex_sid_t()

New alloca_tohex_sid_t_trunc() macro
2013-10-09 18:54:21 +10:30
Andrew Bettison
ab31420faf rhizome_bid_t
Consistent type for internal binary representation of Rhizome Bundle ID
(aka Manifest ID)
2013-10-03 23:16:45 +09:30
Andrew Bettison
c0aa4796a1 Remove MDP and Monitor socket names from config
Now they are fixed names under the instance path: "mdp.socket" and
"monitor.socket".
2013-09-25 16:56:06 +09:30
Andrew Bettison
cc96e08e9d Issue #20: Improve socket name handling
The recently added cmp_sockaddr() function does not call stat(2) any
more to compare local AF_UNIX socket address paths, so not it is stable
enough to use for ordering sockaddr structs.

New function: real_sockaddr() converts the file path of a local AF_UNIX
file socket using realpath(3).  The MDP client uses it on the sender
address of every MDP reply packet it receives to ensure that symlinks in
the instance path do not cause MDP client failures.

Rename recently added socket_setname() function: make_local_sockaddr().
2013-09-20 14:07:19 +09:30
Andrew Bettison
ae61a4f35c Issue #20: Make abstract sockets work
Finish the work started by Daniel in 2012, by using abstract local
AF_UNIX sockets on platforms that support them (Linux, Android).

Fix all sorts of bugs and issues that prevented the existing MDP and
Monitor client and server code from working with abstract socket names.
2013-09-19 17:26:06 +09:30
Andrew Bettison
d64d9487c1 Issue #20: improve socket set-up logging 2013-09-19 04:30:40 +09:30
Andrew Bettison
2b3119b49b Issue #20: merge branch 'sockets' into 'development'
Daniel's improvements to the local file/abstract socket code, with many
improvements to bring it up to date.
2013-09-19 04:30:14 +09:30
Jeremy Lakeman
3855ff35c4 Clean up string formatting for 64bit compilation 2013-07-15 09:59:24 +09:30
Jeremy Lakeman
53f3920b90 Move cli global state into a structure and pass it around 2013-07-03 16:51:27 +09:30
Jeremy Lakeman
0c681b879d Send full manifest with bundle announcement 2013-07-02 12:07:04 +09:30
Jeremy Lakeman
3e57add9ca Fix, initialise read / write handles so we don't close fd=0 2013-06-19 12:05:56 +09:30
Jeremy Lakeman
dcdb8fcdd4 Announce all links on connection to monitor interface 2013-05-08 13:42:11 +09:30
Jeremy Lakeman
79f4a78278 Add link state monitor commands 2013-05-02 16:19:59 +09:30
Andrew Bettison
5bbdef5587 Improve command-line parsing (issue #59)
Emit HINT log message about using "help" command

Support alternatives syntax "word|word|..." in CLI schema

Better return values from cli_parse()
2013-04-09 17:23:20 +09:30
Andrew Bettison
a88234ce9d Add optional filter args to 'help' command 2013-03-25 12:05:26 +10:30
Andrew Bettison
300ec986f1 Fix warnings from gcc 4.6.3 2013-03-18 16:48:15 +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
fcb6600cd6 Rewrite command-line parser
Now supports optional args followed by non-optional.
2013-02-12 18:00:37 +10:30
Jeremy Lakeman
e9d283f3f6 Allow name to be missing 2013-01-17 11:45:45 +10:30