Commit Graph

3477 Commits

Author SHA1 Message Date
Jeremy Lakeman
54b845f7e3 Split java test classes into a separate folder 2016-01-19 10:41:52 +10:30
Andrew Bettison
c3375d0501 Fix MDP client packet receive bug on OSX
Was failing because recvmsg(2) on OSX does not nul terminate the
pathname of local (AF_UNIX) sockets in the returned sockaddr buffer.
Zerofilling the buffer before calling recvmsg() does the trick.

In the process, improved debug and error logging, replacing
recvwithttl() with recv_message() and recv_message_frag().  The
mdp_net.c source file was retired.
2016-01-19 04:05:46 +10:30
Andrew Bettison
ae18d765a7 Fix OSX build errors 2016-01-18 21:16:01 +10:30
Jeremy Lakeman
b5c62a19d5 Add Java API for setting the instance path 2016-01-18 13:22:36 +10:30
Andrew Bettison
87ab136d0f Improve build instructions
Autoconf version 2.70 has never been tested; include automake 1.5.
2016-01-18 12:07:11 +10:30
Andrew Bettison
792aa07153 Update config.guess and config.sub scripts
Were early 2012 vintage.

This will help Debian and other distribution packagers, who rely on
having up-to-date architecture detection in every package when built.
2016-01-18 11:53:52 +10:30
Jeremy Lakeman
e9e35a8f93 Use the unicast tick_ms for link ACK's, if configured 2016-01-13 12:01:29 +10:30
Jeremy Lakeman
953950a8ad Only log debug messages for keyring slots that fail validation 2016-01-12 15:05:41 +10:30
Jeremy Lakeman
4fc48d44fd Simplify subscriber enumeration & only support the use-cases we need 2016-01-12 11:47:29 +10:30
Jeremy Lakeman
75523b7f3c Don't talk about SID's that don't match the whole abbreviation 2016-01-12 10:29:46 +10:30
Andrew Bettison
bc1203c87c Minor improvements to README 2016-01-11 18:02:26 +10:30
Andrew Bettison
e51189a1c8 Remove aclocal.m4 from version control
Henceforward, aclocal.m4 will be generated by the 'autoreconf' command.

The 'autoreconf -f -i' command may now emit a warning "Unsupported
attribute section, the test may fail" on some systems, but it will still
generate the proper aclocal.m4 and ./configure files.  To suppress this
warning, simply invoke autoreconf with '-I m4' argument:

    autoreconf -f -i -I m4

The INSTALL.md has been updated accordingly, and a new 'Notes for
Developers' technical document added, explaining the use of aclocal and
autoreconf, and documenting that these warning messages are of no
concern.
2016-01-11 18:02:26 +10:30
Andrew Bettison
f6c2706796 Fix recently added M4 macro files
These macros copied in from the Autoconf Macro Archive were missing
support for the following attributes:
 - AX_GCC_VAR_ATTRIBUTE() for __attribute__(section("..."))
 - AX_GCC_FUNC_ATTRIBUTE() for __attribute__(returns_nonnull)

This commit fixes them.  (The versions in aclocal.m4 were already fixed,
but aclocal.m4 is about to be removed from version control.)
2016-01-11 18:02:26 +10:30
Jeremy Lakeman
10ac5733a1 Revert some recent tweaks that were causing test failures 2016-01-11 16:23:32 +10:30
Jeremy Lakeman
88020a840d Add size cast to avoid compilation warning for some linux compilers 2016-01-11 14:52:29 +10:30
Jeremy Lakeman
912806360c Tweak netlink setup code in an attempt to prevent gcc mis-optimization 2016-01-11 14:40:23 +10:30
gardners
0fd63b330c add missing m4 macro file 2015-12-26 17:50:25 +10:30
gardners
eece21907b include ax_gcc_func_attribute M4 script for autoconf 2015-12-26 17:29:01 +10:30
gardners
3743a08be1 attempt to fix building on openwrt 2015-12-26 17:13:16 +10:30
gardners
104c311b21 add missing OUT() to sync_send_response exit path if sqllite
statement preparation fails.
2015-12-26 15:44:22 +10:30
Jeremy Lakeman
84d133438a Clean up jni server test 2015-12-14 11:22:02 +10:30
Jeremy Lakeman
77162fbaec Improve config overflow message 2015-12-14 10:31:38 +10:30
Andrew Bettison
bd45186a6a Document REST POST /restful/rhizome/insert
Adds definitions for Rhizome concepts such as Bundle ID, Bundle Secret,
payload, etc. and a detailed step-by-step definition of the insertion
logic.
2015-12-07 22:39:19 +10:30
Andrew Bettison
3f8f0f6fc7 Improve Rhizome HTTP API diagnostics
Add RHIZOME_BUNDLE_STATUS_MANIFEST_TOO_BIG enum option to indicate
that the manifest exceeded 8 KiB in size.

Refactor rhizome_add_manifest() and rhizome_manifest_finalise()
to return 'struct rhizome_bundle_result' instead of 'enum
rhizome_bundle_status', so that that their detailed failure messages
can reach the HTTP API layer instead of just being logged.

Fix HTTP response status codes produced Rhizome direct HTTP requests
to be consistent with the Rhizome RESTful API.
2015-12-07 22:35:42 +10:30
Andrew Bettison
74735339aa Fix minor bug in Rhizome manifest parsing
Did not indicate failure if last line was missing a newline.
2015-12-07 22:35:42 +10:30
Andrew Bettison
2b40e5394d Define $LF in testdefs
Accompanies $CR and $HT to help write more readable test
scripts.
2015-12-07 22:35:42 +10:30
Andrew Bettison
1bd599f79d Add --omit option to 'tfw_createfile' utility
Allows generation of files that do not contain a specific set
of characters.
2015-12-07 22:35:42 +10:30
Andrew Bettison
61a4911934 Fix SEGV bug in rhizome_bundle_result_sprintf() 2015-12-07 22:33:43 +10:30
Andrew Bettison
cc26dd99e5 Cosmetic: rename variable 'result' to 'http_status'
For more consistency with standard terminology.
2015-12-07 11:25:40 +10:30
Andrew Bettison
aabb1c5547 Call rhizome_bundle_result_free() in meshms.c
Otherwise there may be a memory leak.
2015-12-07 11:25:40 +10:30
Andrew Bettison
39460947f1 Add 'rhizomeall' test script
Runs all Rhizome test cases.
2015-12-01 00:51:15 +10:30
Andrew Bettison
fd50a34fc8 Add minor safety check to a Rhizome test case
Ensure that two generated test files are different instead of just
assuming they are; makes the test logic more explicit.
2015-12-01 00:51:15 +10:30
Andrew Bettison
98ed0406c5 Refactor Rhizome result handling
- Introduce the new 'struct rhizome_bundle_result' that contains a
  rhizome_bundle_status enum value and an optional, nul-terminated
  string that provides an explanation of the cause of the status; add
  functions to construct, query, and free the struct

- Replace 'enum rhizome_add_result' with 'struct rhizome_bundle_result',
  removing an unnecessary level of enum interpretation

- Make rhizome_fill_manifest() return 'struct rhizome_bundle_result' and
  add logic to check that the supplied author SID is correct (previous
  behaviour was: if an incorrect author SID was supplied but the correct
  author could be found in the keyring, then the incorrect one was
  silently ignored)

- Simplify the response code in rhizome_restful.cc to take advantage of
  the new 'struct rhizome_bundle_result'; in particular, the mapping
  from 'enum rhizome_bundle_status' codes to HTTP status codes is now
  expressed in a single switch statement

- Fix some minor failures in test scripts revealed by the changes
2015-12-01 00:51:15 +10:30
Andrew Bettison
078bf5eb6b Improve HTTP responses
In 'struct http_response', rename the 'result_code' field to
'status_code' for consistency with the terminology used in the HTTP
specification, and add a 'reason' field, so that the phrase that
appears in the first response line can differ from the standard
"canned" phrases.
2015-12-01 00:51:15 +10:30
Andrew Bettison
17b0644277 Allow anonymous bundles to have a 'sender' field 2015-12-01 00:51:15 +10:30
Jeremy Lakeman
c3ca8770ea Squelch logging due to unacked packet timeout 2015-11-30 14:22:45 +10:30
Andrew Bettison
dae68c7524 Replace quick compilation fixes with proper fix
Proper fix does not use "#ifdef __clang__", instead detects the
compiler's supported attributes at ./configure time.
2015-11-23 15:12:00 +10:30
Andrew Bettison
e8e87b8a34 Fix broken clang and Android builds
Recent addition of the GCC __attribute__(alloc_size) to some functions
in mem.h broke the build when using Clang 3.5.  This commit introduces
configure-time checks for all GCC attributes used in the Serval source
code, and adapts accordingly.
2015-11-23 15:00:25 +10:30
Andrew Bettison
1d3a6abe61 Remove __attribute__(returns_nonnull) from emalloc() et al
Was added in error; in fact, emalloc() and its ilk can return NULL.
Also, Clang 3.5 and the Android GCC do not support this attribute.
2015-11-23 15:00:03 +10:30
Jeremy Lakeman
67c1f382d4 Quick fix to unbreak android build too 2015-11-23 11:14:57 +10:30
Jeremy Lakeman
f774d12686 Fix build for clang 2015-11-23 10:54:41 +10:30
Jeremy Lakeman
fd38ddb892 Attempt to recover from transient network errors 2015-11-23 09:48:51 +10:30
Andrew Bettison
bdb3b99143 Add some comments to clarify Rhizome enums 2015-11-17 00:42:06 +10:30
Andrew Bettison
0dd778bab5 Optimise strbuf_ncat()
Do not write nul unnecessarily.
2015-11-17 00:42:06 +10:30
Andrew Bettison
fc67b38fd2 Fix bug in strbuf_reset()
Could write a nul char into a zero-size buffer.
2015-11-17 00:42:06 +10:30
Andrew Bettison
23cd578595 Cosmetic improvements to strbuf.h 2015-11-17 00:42:06 +10:30
Andrew Bettison
8310d3cf19 Add strbuf_malloc() macro 2015-11-17 00:42:06 +10:30
Andrew Bettison
45b7d4f4c5 Under GCC, check strbuf_local() buffer limit
If strbuf_local(buf, len) is called with a buffer whose size can be
deduced at compile time, then this change will check that 'len' does not
exceed that size, causing an assertion failure at run time if it does.

The safety check makes use of the GCC extensions: __builtin_object_size()
and __attribute__((alloc_size(n)).  Under non-GCC compilers, the safety
check will not be performed.
2015-11-17 00:42:06 +10:30
Andrew Bettison
fdc6156ec7 Under GCC, enforce proper strbuf_local_buf() arg
Internally the strbuf_local_buf(x) macro uses sizeof(x) to determine
the size of the buffer, but this will give the wrong behaviour if x
is a pointer (char *x), not an array (char x[]).  With this change,
invoking it with a pointer will cause a compile error.

The safety check makes use of the GCC extensions: __builtin_object_size()
and __attribute__((alloc_size(n)).  Under non-GCC compilers, the safety
check will not be performed.
2015-11-17 00:42:06 +10:30
Jeremy Lakeman
2ddbb86cb5 Don't ask for explanation of SIDs with dead routing links 2015-11-16 14:09:35 +10:30