]> git.proxmox.com Git - mirror_kronosnet.git/log
mirror_kronosnet.git
6 years agoMerge pull request #99 from kronosnet/skip
Fabio M. Di Nitto [Tue, 19 Dec 2017 14:50:52 +0000 (15:50 +0100)]
Merge pull request #99 from kronosnet/skip

Skip tests if socket buffers are inadequate

6 years agoRemove spaces after function names
Ferenc Wágner [Tue, 19 Dec 2017 14:01:50 +0000 (15:01 +0100)]
Remove spaces after function names

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agoAnything that stops operation and returns an error should be log_err
Ferenc Wágner [Tue, 19 Dec 2017 13:58:09 +0000 (14:58 +0100)]
Anything that stops operation and returns an error should be log_err

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agoDocument knet-specific errno values
Ferenc Wágner [Tue, 19 Dec 2017 11:18:14 +0000 (12:18 +0100)]
Document knet-specific errno values

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agoMore fine-grained error handling
Ferenc Wágner [Tue, 19 Dec 2017 11:17:50 +0000 (12:17 +0100)]
More fine-grained error handling

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agotests: skip if socket buffers are too small
Ferenc Wágner [Mon, 18 Dec 2017 20:38:50 +0000 (21:38 +0100)]
tests: skip if socket buffers are too small

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agotests: replace open coded error handling with knet_handle_start() calls
Ferenc Wágner [Mon, 18 Dec 2017 20:31:45 +0000 (21:31 +0100)]
tests: replace open coded error handling with knet_handle_start() calls

Done by:
$ sed -i -e '1h;2,$H;$!d;g' -e 's/knet_h = knet_handle_new(1, logfds\[1\], \(KNET_LOG_[A-Z]*\));\n\n\tif (!knet_h) {\n\t\tprintf("knet_handle_new failed: %s\\n", strerror(errno));\n\t\tflush_logs(logfds\[0\], stdout);\n\t\tclose_logpipes(logfds);\n\t\texit(FAIL);\n\t}/knet_h = knet_handle_start(logfds, \1);/g' libknet/tests/*.c

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agotests: introduce knet_handle_start helper
Ferenc Wágner [Mon, 18 Dec 2017 18:08:31 +0000 (19:08 +0100)]
tests: introduce knet_handle_start helper

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agoReport ENAMETOOLONG if socket buffers are too small
Ferenc Wágner [Sat, 16 Dec 2017 21:00:37 +0000 (22:00 +0100)]
Report ENAMETOOLONG if socket buffers are too small

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agoMerge pull request #103 from kronosnet/mtu-lock
Fabio M. Di Nitto [Tue, 19 Dec 2017 10:28:14 +0000 (11:28 +0100)]
Merge pull request #103 from kronosnet/mtu-lock

[PMTUd] fix external API and PMTUd interaction

6 years ago[PMTUd] fix external API and PMTUd interaction
Fabio M. Di Nitto [Sun, 17 Dec 2017 08:33:53 +0000 (09:33 +0100)]
[PMTUd] fix external API and PMTUd interaction

The problem:

PMTUd can take a long time to release the global read lock, mostly due
to the pthread_cond_timedwait required to ack/nack packets from the
other hosts. This delay could block any wrlock operation for several seconds
if not more.

The solution:

each call to the global pthread_rwlock_wrlock has been changed to a wrapper
that will notify the PMTUd to interrupt its operations (and restart) first,
then get a global write lock that is queued as soon as PMTUd is going out.

This solution also improves a lot shutdown speed.

How to test:

This is not super simple to test and verify. I used 2 VMs with known MTU of
1500. Start knet_bench on both (normal ping_data -C is more than enough).
Once they have established data exchange, change the MTU on one of the nodes
to 1600 (or higher). This should guarantee that the PMTUd process will take
a very long time to complete.
First verify that the PMTUd process takes several seconds.
Once the next PMTUd run starts, hit ctrl+c on the node that is executing
the PMTUd and the process should exit much faster than before this patch.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years agoMerge pull request #104 from kronosnet/spelling
Fabio M. Di Nitto [Mon, 18 Dec 2017 19:13:06 +0000 (20:13 +0100)]
Merge pull request #104 from kronosnet/spelling

Spelling fixes

6 years agoFix typo and capitalization
Ferenc Wágner [Sun, 17 Dec 2017 20:49:20 +0000 (21:49 +0100)]
Fix typo and capitalization

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agoFix grammar (allow requires an object)
Ferenc Wágner [Sun, 17 Dec 2017 20:48:00 +0000 (21:48 +0100)]
Fix grammar (allow requires an object)

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agoMerge pull request #102 from kronosnet/clang v0.9
Fabio M. Di Nitto [Fri, 15 Dec 2017 16:39:27 +0000 (17:39 +0100)]
Merge pull request #102 from kronosnet/clang

Clang

6 years ago[build] define conditionals only once
Fabio M. Di Nitto [Fri, 15 Dec 2017 10:34:01 +0000 (11:34 +0100)]
[build] define conditionals only once

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[build] workaround BSD / clang breakage
Fabio M. Di Nitto [Fri, 15 Dec 2017 08:34:43 +0000 (09:34 +0100)]
[build] workaround BSD / clang breakage

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[build] fix clang builds
Fabio M. Di Nitto [Fri, 15 Dec 2017 07:02:33 +0000 (08:02 +0100)]
[build] fix clang builds

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years agoMerge pull request #101 from kronosnet/mtu2
Fabio M. Di Nitto [Fri, 15 Dec 2017 09:22:17 +0000 (10:22 +0100)]
Merge pull request #101 from kronosnet/mtu2

[PMTUd] fix multiple issues and stability problems

6 years ago[PMTUd] fix multiple issues and stability problems
Fabio M. Di Nitto [Thu, 14 Dec 2017 03:11:56 +0000 (04:11 +0100)]
[PMTUd] fix multiple issues and stability problems

- resolve locking issue with thread_heartbeat that was causing
  spurious up/down link event.
  In the event of a PMTUd run taking too long, the heartbeat
  thread could hang for much longer than ping_timeout.
  Use backoff_mutex to sync between threads instead of the global lock.

- pause the DATA tx thread when sending any PMTUd related packets.
  Similar method as knet_send_sync, using the tx_mutex, allows a much
  more stable communication between nodes without any visible performance
  hit.

- calculate higher timeouts when using crypto to improve stability

- fix an odd race condition with the kernel where, during a single PMTUd run,
  the same packet size was marked both BAD and GOOD (via EMSGSIZE) by the
  kernel. That situation would cause our PMTUd to run away and calculate
  bad values.

- add a minor usleep between sending PMTUd packets to give time to the
  kernel to make its own mind about the link PMTU. This is based on average
  latency.

- since PMTUd can take several seconds before completion, use the "end time"
  to record the last run vs the start time.

- fix a major issue in sending PMTUd reply where an errno was not being
  passed down the link layer and would cause the RX thread to block forever.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years agoMerge pull request #98 from liu4480/add-debuginfo
Fabio M. Di Nitto [Sat, 9 Dec 2017 05:16:58 +0000 (06:16 +0100)]
Merge pull request #98 from liu4480/add-debuginfo

allow to choose whether to build debuginfo packages or not

6 years agoallow to choose whether to build debuginfo packages or not
Bin Liu [Thu, 7 Dec 2017 06:48:57 +0000 (14:48 +0800)]
allow to choose whether to build debuginfo packages or not

1. If not "--enable-rpm-debuginfo" or "--disable-rpm-debuginfo" is
specified, follow the system default behavior
2. If set, then build debuginfo package or not build based on the
flag.

6 years agoMerge pull request #96 from kronosnet/modules2
Fabio M. Di Nitto [Tue, 5 Dec 2017 07:54:24 +0000 (08:54 +0100)]
Merge pull request #96 from kronosnet/modules2

Modules2

6 years agobuild: remove useless assignment
Ferenc Wágner [Mon, 4 Dec 2017 22:27:56 +0000 (23:27 +0100)]
build: remove useless assignment

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agobuild: use AS_HELP_STRING for consistent formatting
Ferenc Wágner [Mon, 4 Dec 2017 22:25:58 +0000 (23:25 +0100)]
build: use AS_HELP_STRING for consistent formatting

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agobuild: recover original option ordering
Ferenc Wágner [Mon, 4 Dec 2017 22:00:52 +0000 (23:00 +0100)]
build: recover original option ordering

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agobuild: move more repetitive module work into our Autoconf macro
Ferenc Wágner [Mon, 4 Dec 2017 21:44:08 +0000 (22:44 +0100)]
build: move more repetitive module work into our Autoconf macro

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years agoCheck ABI version on module load
Ferenc Wágner [Mon, 4 Dec 2017 21:39:20 +0000 (22:39 +0100)]
Check ABI version on module load

Signed-off-by: Ferenc Wágner <wferi@debian.org>
6 years ago[tests] drop obsoleted tests that are broken after moving to the new modules format
Fabio M. Di Nitto [Mon, 4 Dec 2017 20:29:46 +0000 (21:29 +0100)]
[tests] drop obsoleted tests that are broken after moving to the new modules format

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[tests] make module tests dynamic by using internal knowledge of what is built or not
Fabio M. Di Nitto [Mon, 4 Dec 2017 05:25:07 +0000 (06:25 +0100)]
[tests] make module tests dynamic by using internal knowledge of what is built or not

drop all related #ifdef as well

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[modules] update valgrind BSD exceptions
Fabio M. Di Nitto [Wed, 29 Nov 2017 08:34:55 +0000 (09:34 +0100)]
[modules] update valgrind BSD exceptions

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[modules] spec file: fix directory shipping
Fabio M. Di Nitto [Wed, 29 Nov 2017 13:05:57 +0000 (14:05 +0100)]
[modules] spec file: fix directory shipping

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[modules] update spec file to ship modules in separate rpms + meta packages
Fabio M. Di Nitto [Wed, 29 Nov 2017 12:34:37 +0000 (13:34 +0100)]
[modules] update spec file to ship modules in separate rpms + meta packages

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years agoUnify compress and crypto module loaders
Ferenc Wágner [Thu, 30 Nov 2017 08:41:32 +0000 (09:41 +0100)]
Unify compress and crypto module loaders

6 years agoUnify crypto module initialization functions
Ferenc Wágner [Thu, 30 Nov 2017 00:57:57 +0000 (01:57 +0100)]
Unify crypto module initialization functions

Taken from Fabio M. Di Nitto.

6 years agolibknet.h uses ssize_t, include its definition directly
Ferenc Wágner [Tue, 28 Nov 2017 07:28:24 +0000 (08:28 +0100)]
libknet.h uses ssize_t, include its definition directly

This fixes the BSD build.

6 years agoPass log_msg to the plugins
Ferenc Wágner [Wed, 29 Nov 2017 18:34:21 +0000 (19:34 +0100)]
Pass log_msg to the plugins

6 years agoSwitch over all plugins to the module system
Ferenc Wágner [Tue, 28 Nov 2017 00:13:03 +0000 (01:13 +0100)]
Switch over all plugins to the module system

6 years agoMake the bzip2 compress plugin a proper module
Ferenc Wágner [Mon, 27 Nov 2017 21:35:42 +0000 (22:35 +0100)]
Make the bzip2 compress plugin a proper module

Our current practice of dlopening foreign shared libraries is problematic
for several reasons:
* not portable: modules and shared libraries can be different object types
* dependency information is invisible (our canaries mostly solve this)
* hardwiring SONAMES breaks on transitions (KNET_PKG_SONAME solves this)
* symbol versioning information is lost (theoretically solvable)

The preferred way out is generating dynamically loaded private modules
from the main source, which then rely on the dynamic linker to load the
external symbols as usual.

6 years agoSeparate compress_model_t definition into a new header file
Ferenc Wágner [Mon, 27 Nov 2017 20:52:31 +0000 (21:52 +0100)]
Separate compress_model_t definition into a new header file

We'll use this type together with the zlib headers, which clash with
our compress.h because both define a function named compress.

6 years agoMerge pull request #94 from kronosnet/sock
Fabio M. Di Nitto [Tue, 28 Nov 2017 16:02:54 +0000 (17:02 +0100)]
Merge pull request #94 from kronosnet/sock

[transport] make the new derooted sock management less chatty

6 years ago[transports] add logging around setsockopts that have specific per distro/include...
Fabio M. Di Nitto [Tue, 28 Nov 2017 15:17:34 +0000 (16:17 +0100)]
[transports] add logging around setsockopts that have specific per distro/include requirements

this is helpful to determine if a given option has been built-in and/or activated
properly

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[transport] add missing include files and really fix 86c81a32cfccde1dea
Fabio M. Di Nitto [Tue, 28 Nov 2017 09:48:58 +0000 (10:48 +0100)]
[transport] add missing include files and really fix 86c81a32cfccde1dea

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[transport] consistency is not optional :-)
Fabio M. Di Nitto [Tue, 28 Nov 2017 08:53:21 +0000 (09:53 +0100)]
[transport] consistency is not optional :-)

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[transport] fix errno handling
Fabio M. Di Nitto [Tue, 28 Nov 2017 08:52:08 +0000 (09:52 +0100)]
[transport] fix errno handling

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[transport] make the new derooted sock management less chatty
Fabio M. Di Nitto [Tue, 28 Nov 2017 08:49:41 +0000 (09:49 +0100)]
[transport] make the new derooted sock management less chatty

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years agoMerge pull request #91 from kronosnet/no-root
Fabio M. Di Nitto [Mon, 27 Nov 2017 14:51:17 +0000 (15:51 +0100)]
Merge pull request #91 from kronosnet/no-root

Enable testing without root privileges

6 years agoDetailed error reporting about socket buffer sizes
Ferenc Wágner [Mon, 27 Nov 2017 12:02:12 +0000 (13:02 +0100)]
Detailed error reporting about socket buffer sizes

6 years agoRemove the need_root() function
Ferenc Wágner [Sun, 26 Nov 2017 09:29:25 +0000 (10:29 +0100)]
Remove the need_root() function

The point is not having root privileges, but having high enough socket
buffer caps.  Very few of the test can run without it.

6 years agoDon't require root privileges unless necessary
Ferenc Wágner [Wed, 22 Nov 2017 22:10:33 +0000 (23:10 +0100)]
Don't require root privileges unless necessary

On Linux, if /proc/sys/net/core/[rw]mem_max are set to at least
8388608 (KNET_RING_RCVBUFF), setting the socket buffer sizes
doesn't require root privileges.

FreeBSD uses the kern.ipc.maxsockbuf sysctl MIB variable for
capping user buffer requests.

Linux doubles the requested amount for administrative overhead,
but FreeBSD does not, so we can't be too strict when checking
the results.

6 years agoMerge pull request #93 from kronosnet/dynamic-pong
Fabio M. Di Nitto [Sat, 25 Nov 2017 12:29:10 +0000 (13:29 +0100)]
Merge pull request #93 from kronosnet/dynamic-pong

Dynamic pong

6 years ago[tests] workaround buggy valgrind-freebsd implementation.
Fabio M. Di Nitto [Sat, 25 Nov 2017 10:42:10 +0000 (11:42 +0100)]
[tests] workaround buggy valgrind-freebsd implementation.

valgrind is not officially supported on FreeBSD. The current valgrind-freebsd
port is maintained separately and it's lagging several releases behind
vs upstream valgrind.

When running knet+openssl+valgrind on x86_64, with high pthread_cond_timedwait
configuration, valgrind appears to be stuck tracing openssl internal operations
to the point that the internal knet RX thread is not scheduled for minutes.
At that point all processes will go kaboom (heartbeat, PMTUd, etc) almost constantly
failing this test.

Given that all other architectures and OSes can run this test happily, I am adding
this exception to the test suite, to be re-evaluated in future if newer versions
of valgrind will be available on FreeBSD.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[tests] don't duplicate test
Fabio M. Di Nitto [Fri, 24 Nov 2017 14:23:30 +0000 (15:23 +0100)]
[tests] don't duplicate test

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[tests] use a new tunable functions to wait for packets
Fabio M. Di Nitto [Fri, 24 Nov 2017 12:56:42 +0000 (13:56 +0100)]
[tests] use a new tunable functions to wait for packets

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[tests] when running under valgrind, allow a lot more time for host to be reachable
Fabio M. Di Nitto [Fri, 24 Nov 2017 11:29:37 +0000 (12:29 +0100)]
[tests] when running under valgrind, allow a lot more time for host to be reachable

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[links] fix description
Fabio M. Di Nitto [Fri, 24 Nov 2017 11:29:17 +0000 (12:29 +0100)]
[links] fix description

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[links] add pong_timeout backoff mechanism to deal with high latency links
Fabio M. Di Nitto [Fri, 24 Nov 2017 10:36:52 +0000 (11:36 +0100)]
[links] add pong_timeout backoff mechanism to deal with high latency links

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years agoMerge pull request #92 from kronosnet/timer-fixes
Fabio M. Di Nitto [Fri, 24 Nov 2017 09:15:23 +0000 (10:15 +0100)]
Merge pull request #92 from kronosnet/timer-fixes

Timer fixes

6 years ago[links] extend knet_link_set_ping_timers ABI to be ready for future expansion
Fabio M. Di Nitto [Thu, 23 Nov 2017 10:39:01 +0000 (11:39 +0100)]
[links] extend knet_link_set_ping_timers ABI to be ready for future expansion

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[tests] implement common and more flexible wait_for_host implementation
Fabio M. Di Nitto [Thu, 23 Nov 2017 09:58:51 +0000 (10:58 +0100)]
[tests] implement common and more flexible wait_for_host implementation

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[docs] update header to be more specific about ping timers and relative man pages
Fabio M. Di Nitto [Thu, 23 Nov 2017 04:16:48 +0000 (05:16 +0100)]
[docs] update header to be more specific about ping timers and relative man pages

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[PTMUd] don't harcode 2 seconds timeout to receive a PMTUd response from the remote...
Fabio M. Di Nitto [Thu, 23 Nov 2017 04:11:47 +0000 (05:11 +0100)]
[PTMUd] don't harcode 2 seconds timeout to receive a PMTUd response from the remote node

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years agoMerge pull request #87 from chrissie-c/balance_crypt_stats
Fabio M. Di Nitto [Thu, 23 Nov 2017 12:20:19 +0000 (13:20 +0100)]
Merge pull request #87 from chrissie-c/balance_crypt_stats

stats: Make the crypt_packet stats balance

6 years agostats: Only collect crypt over stats for received data packets
Christine Caulfield [Thu, 16 Nov 2017 15:16:41 +0000 (15:16 +0000)]
stats: Only collect crypt over stats for received data packets

This is more for consistency really. The TX code only accumulates the
crypto overhead for data packets because it's not worth adding all the
accounting code around the ping/pong & pmtu transmitters.

6 years agostats: Make the crypt_packet stats balance
Christine Caulfield [Tue, 14 Nov 2017 15:49:20 +0000 (15:49 +0000)]
stats: Make the crypt_packet stats balance

The tx_crypt stats only included data packets whereas the rx_crypt
stats included everything, because the TX was done in different places
and the RX in just the one.

I've added a 'stats_extra' structure so that the other threads can
update their own stats without extra locking, the get_stats call adds
them in as necessary.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
6 years agoMerge pull request #90 from kronosnet/soname
Fabio M. Di Nitto [Tue, 21 Nov 2017 03:44:27 +0000 (04:44 +0100)]
Merge pull request #90 from kronosnet/soname

build: determine the plugin SONAMEs automatically

6 years agobuild: determine the plugin SONAMEs automatically
Ferenc Wágner [Mon, 13 Nov 2017 22:28:10 +0000 (23:28 +0100)]
build: determine the plugin SONAMEs automatically

Most importantly, this avoids dlopening libcrypto.so, which is a symlink
in the OpenSSL development packages on Linux.  Rather, we use the SONAME
of the first library added by pkg-config, which seems to work well across
the board.  The strange case is NSS, which ends up using libssl3.so on
CentOS, Fedora and RedHat, but libnss3.so on Debian, FreeBSD and Ubuntu.
The tests pass regardless, so this might be tolerable.

6 years agoMerge pull request #89 from chrissie-c/knet_bench_stats
Fabio M. Di Nitto [Fri, 17 Nov 2017 20:40:54 +0000 (21:40 +0100)]
Merge pull request #89 from chrissie-c/knet_bench_stats

[knet_bench] Add option to display stats

6 years ago[knet_bench] Add option to display stats
Christine Caulfield [Fri, 17 Nov 2017 12:39:36 +0000 (12:39 +0000)]
[knet_bench] Add option to display stats

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
6 years agoMerge pull request #88 from kronosnet/nss-workaround
Fabio M. Di Nitto [Wed, 15 Nov 2017 22:13:46 +0000 (23:13 +0100)]
Merge pull request #88 from kronosnet/nss-workaround

[build] workaround memory alignment bug in nss in combination with va…

6 years ago[build] workaround memory alignment bug in nss in combination with valgrind on Linux...
Fabio M. Di Nitto [Wed, 15 Nov 2017 17:54:04 +0000 (18:54 +0100)]
[build] workaround memory alignment bug in nss in combination with valgrind on Linux/i386

Over the past few weeks, we noticed CI failing on i386 when running make check-memcheck
(test suite executed with valgring). Those failures were not consistent and sometime random.

After some heavy debugging it turns out that those failures are a combination of libnss3
internal memory allocator bug and valgrind internal memory allocator.

Current libnss3 memory allocator expects a 16 bytes memory aligned
buffer and in the event the memory is not aligned, it would round it.
The issue is that, in performing this rounding, nss does not track properly the
original address of the memory, and the equivalent of subsequent free of this buffer
would fail, leaking memory and potentially accessing memory not allocated or corrpting
memory.

The nss bug is already fixed upstream by commit: changeset:   13557:52e38f913220

Valgrind on Linux/i386 memory allocator can return memory that is not aligned to the 16 bytes,
contrary to what malloc/glibc does. Valgrind was returning (somehow randomly) a non aligned
buffer to nss triggering the nss bug and the leak.

By forcing valgrind to use aligned memory, nss bug does not trigger and there is no memory leak
during the execution of the test suite.

The memory leak never triggered when running knet in normal conditions.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years agoMerge pull request #86 from kronosnet/pthread
Fabio M. Di Nitto [Tue, 14 Nov 2017 15:44:04 +0000 (16:44 +0100)]
Merge pull request #86 from kronosnet/pthread

build: adopt ax_pthread.m4 to provide all necessary flags

6 years agobuild: adopt ax_pthread.m4 to provide all necessary flags
Ferenc Wágner [Tue, 14 Nov 2017 11:38:56 +0000 (12:38 +0100)]
build: adopt ax_pthread.m4 to provide all necessary flags

Previously we only linked with -lpthread, but for example the -pthread
GCC option provides a CPP define as well.

6 years agoMerge pull request #85 from wferi/libcrypto
Fabio M. Di Nitto [Tue, 14 Nov 2017 12:42:42 +0000 (13:42 +0100)]
Merge pull request #85 from wferi/libcrypto

We only use the crypto part of OpenSSL

6 years agoRevert "build: link as needed"
Ferenc Wágner [Mon, 13 Nov 2017 17:25:19 +0000 (18:25 +0100)]
Revert "build: link as needed"

This reverts commit e3c019fde32f78bf2e3a9bcf6c2fff93245708a0.

Once LIBS is kept empty and OpenSSL isn't linked to in full, overlinking
shouldn't be a problem anymore.

6 years agobuild: only kronosnetd needs PAM, so keep the linker options separate
Ferenc Wágner [Mon, 13 Nov 2017 21:52:37 +0000 (22:52 +0100)]
build: only kronosnetd needs PAM, so keep the linker options separate

6 years agobuild: remove unused function checks
Ferenc Wágner [Mon, 13 Nov 2017 19:17:02 +0000 (20:17 +0100)]
build: remove unused function checks

These have no corresponding HAVE_X checks in the code.

6 years agobuild: the check_lib_no_libs function was unused
Ferenc Wágner [Tue, 14 Nov 2017 10:34:34 +0000 (11:34 +0100)]
build: the check_lib_no_libs function was unused

The optional arguments of AC_CHECK_LIB work good enough.

6 years agobuild: don't add the dl library to LIBS, keep it in dl_LIBS only
Ferenc Wágner [Mon, 13 Nov 2017 18:54:00 +0000 (19:54 +0100)]
build: don't add the dl library to LIBS, keep it in dl_LIBS only

This leaves us with an empty LIBS in the most common cases.

6 years agobuild: clock_gettime does not require the rt library for glibc 2.17+
Ferenc Wágner [Mon, 13 Nov 2017 18:07:09 +0000 (19:07 +0100)]
build: clock_gettime does not require the rt library for glibc 2.17+

So stop overlinking with -lrt on modern systems.

6 years agobuild: we only use the crypto part of OpenSSL
Ferenc Wágner [Mon, 13 Nov 2017 14:28:08 +0000 (15:28 +0100)]
build: we only use the crypto part of OpenSSL

6 years agoMerge pull request #84 from kronosnet/api-fixes
Fabio M. Di Nitto [Mon, 13 Nov 2017 15:16:22 +0000 (16:16 +0100)]
Merge pull request #84 from kronosnet/api-fixes

Api fixes

6 years ago[libknet] fix comments and update man pages
Fabio M. Di Nitto [Mon, 13 Nov 2017 11:42:59 +0000 (12:42 +0100)]
[libknet] fix comments and update man pages

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[libknet] add padding to get *_info structs
Fabio M. Di Nitto [Mon, 13 Nov 2017 09:16:06 +0000 (10:16 +0100)]
[libknet] add padding to get *_info structs

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[tests] fix tests differently
Fabio M. Di Nitto [Mon, 13 Nov 2017 05:11:18 +0000 (06:11 +0100)]
[tests] fix tests differently

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[tests] fix build on i386
Fabio M. Di Nitto [Mon, 13 Nov 2017 05:04:47 +0000 (06:04 +0100)]
[tests] fix build on i386

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[tests] add api_knet_send_crypto
Fabio M. Di Nitto [Mon, 13 Nov 2017 04:57:26 +0000 (05:57 +0100)]
[tests] add api_knet_send_crypto

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[transports] knet_get_transport_list should behaves as knet_get_compress/crypto_list
Fabio M. Di Nitto [Sun, 12 Nov 2017 10:55:49 +0000 (11:55 +0100)]
[transports] knet_get_transport_list should behaves as knet_get_compress/crypto_list

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[tests] fix error message in api_knet_get_compress_list.c
Fabio M. Di Nitto [Sun, 12 Nov 2017 10:49:47 +0000 (11:49 +0100)]
[tests] fix error message in api_knet_get_compress_list.c

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[docs] update copyright and manpagea
Fabio M. Di Nitto [Sun, 12 Nov 2017 09:17:02 +0000 (10:17 +0100)]
[docs] update copyright and manpagea

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[compress] move knet_handle_get_compress_list to knet_get_compress_list
Fabio M. Di Nitto [Sun, 12 Nov 2017 07:16:25 +0000 (08:16 +0100)]
[compress] move knet_handle_get_compress_list to knet_get_compress_list

now matches the same API as get_transport_list

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[crypto] move knet_handle_get_crypto_list to knet_get_crypto_list
Fabio M. Di Nitto [Sun, 12 Nov 2017 06:35:29 +0000 (07:35 +0100)]
[crypto] move knet_handle_get_crypto_list to knet_get_crypto_list

now matches the same API as get_transport_list

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[logging] don't hardcode the max, use max value for the typedef
Fabio M. Di Nitto [Sat, 11 Nov 2017 14:54:37 +0000 (15:54 +0100)]
[logging] don't hardcode the max, use max value for the typedef

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[transports] make KNET_MAX_TRANSPORTS = UINT8_MAX now that the APIs allow holes in...
Fabio M. Di Nitto [Sat, 11 Nov 2017 14:51:56 +0000 (15:51 +0100)]
[transports] make KNET_MAX_TRANSPORTS = UINT8_MAX now that the APIs allow holes in the IDs

this way we don't need to break ABI if we add new transports later on.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[transports] cleanup API calls
Fabio M. Di Nitto [Sat, 11 Nov 2017 12:28:55 +0000 (13:28 +0100)]
[transports] cleanup API calls

knet_get_transport_id_by_name, knet_get_transport_list and knet_get_transport_name_by_id don't need
a handle to be functional as they only access build-time info that don't change at runtime.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years ago[transports] move to use the same internal API as crypto and compress modules
Fabio M. Di Nitto [Sat, 11 Nov 2017 07:27:50 +0000 (08:27 +0100)]
[transports] move to use the same internal API as crypto and compress modules

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
6 years agoMerge pull request #83 from wferi/canary
Fabio M. Di Nitto [Mon, 13 Nov 2017 14:01:48 +0000 (15:01 +0100)]
Merge pull request #83 from wferi/canary

Automatic canaries

6 years agoExtend the preprocessor schema to the NSS crypto plugin
Ferenc Wágner [Mon, 13 Nov 2017 09:20:28 +0000 (10:20 +0100)]
Extend the preprocessor schema to the NSS crypto plugin

6 years agoExtend the preprocessor schema to the OpenSSL crypto plugin
Ferenc Wágner [Mon, 13 Nov 2017 09:04:17 +0000 (10:04 +0100)]
Extend the preprocessor schema to the OpenSSL crypto plugin

6 years agoValidate dynamic symbol prototypes
Ferenc Wágner [Sat, 11 Nov 2017 19:05:47 +0000 (20:05 +0100)]
Validate dynamic symbol prototypes

Practically, all imported symbols are functions returning an int, but
the LZMA API defines it as an enum.