This adds a target `data-decoder` which builds a binary to decode a
specified binary file using uD3TN's parsing logic (based on the CLA RX
subsystem) and print details about it. In this first version only the
decoding of BPv7 bundles is implemented.
This binary can be used, e.g., for fuzz testing.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This is basically an extended `aap_test.py` as part of the integration
tests, which verifies the received AAP messages and also checks the
returned bundle ID if it contains a well-formed timestamp and sequence
number.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds a custom header that does explicitly not include the Unity
wrappers for malloc, free, etc. by defining the guard used by that header
file. This way we can remove the wrappers provided via the linker
altogether.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We cannot easily support this on MacOS, but we do not use it except in
tests. Thus, remove it and make the tests only run on Linux and use
`sem_getvalue` directly.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This removes the `hal_time` dependency of the `routing_table`, as it now
assumes that the provided `struct node` is ordered, free of conflicts,
and has valid contact timestamps. This is ensured by invoking
`node_prepare_and_verify` beforehand, in `router_process_command`.
The tests are updated accordingly.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds a Dockerfile plus interoperability tests for the ION
experimental baseline release v1.0.1.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
ION by default sends bundles encoded with CBHE (BPv6). This tests that we
can receive them. Also for BPv7 it makes sense to test reception, of
course. :-)
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This also adds a test for it, sending bundles from within ION to uD3TN
in the "minimal forwarding test".
Fixes: #7
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This changes the "from" and "to" fields in the contact struct to
milliseconds-based timestamps and adapts all dependent code. The contact
data format is kept second-based for backward compatibility.
The commit also introduces a new function to work with millisecond
timestamps in the remaining capacity calculation and modifies the tests
related to the latter such that they do not need to change the timestamp.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This allows for capturing sanitizer warnings in the test and removes the
need to kill all uD3TN instances (just those launched by the test).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adapts the BIBE test to the behavior of the other functional tests
(ION interoperability), expecting the dependencies to be present when
run. The CI config is adapted to use the prepared Docker image,
preventing reinstallation of Python dependencies during the CI job.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds a Dockerfile containing everything needed in our other tests
(Clang, Python, Python dependencies, Netcat).
See also: #16
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
In newer versions of ION the `ionstart` utility may not execute the
`dtn2admin` program, so our egress plans were not loaded properly.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Note that this needs to extend the preparation script for build uD3TN in
case of the ION BIBE interop test with the proper compatibility flag.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This makes the ion interop testing script flexible such that we can
specify the EID scheme to be used. Two additional CI tests are added for
the ipn scheme. Note that these use the newest version of ION while
there still seems to be incompatibility for dtn EIDs with these (see
issue #116).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This makes the ION interoperability tests assume a prepared environment
(ION, uD3TN compiled, Python deps, ...) and, thus, only execute the test
run itself. The CI routines make use of the new Docker image.
Additionally a timeout for stopping ION is added (#120).
Fixes: #120
See also: #16
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This provides two new Dockerfiles for testing, one just containing ION
and one with an additional Python3 virtual environment for
interoperability testing.
Additionally, two scripts are provided:
* build_docker_images.sh: build images that can be pushed to the
registry and then used by the CI toolchain
* prepare_for_test.sh: a script to be run inside a newly created Docker
container based on the provided `ion-interop` image, to build uD3TN
and add the Python modules from the uD3TN source tree efficiently
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This artificially reduces the maximum number of open file descriptors to
make ION services start faster and address an issue with huge delays on
systems that have this limit set to 2^30-8 (observed in container
runtimes #121)
Fixes: #121
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
`hal_task_create` returned a reference to the new task allocated on the
heap via `malloc`. We commonly used the pattern to `free` this reference
from the new thread which, however, could result in race conditions and
other synchronization issues. We added a fix using a semaphore in the
application agent, but this would have been needed in other places (CLA,
...) as well. As we do not make use of the task reference anywhere
besides in the CLA for error handling, we can remove the heap-allocated
value altogether and replace it with an `enum ud3tn_result` to simplify
things and circumvent the named synchronization issues.
In the case of the CLA function `cla_link_init`, logic is introduced to
request the RX task to exit immediately in case the TX task cannot be
launched.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This test was prone to off-by-one errors if the time advanced between
calls. It is also unnecessary as we do not use a special clock
implementation anymore and !85 will fully remove the function to mock
the system time.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We have two test cases that are randomly influenced by the system they
are running on. This makes the checks in these tests more forgiving to
random variations that may occur.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds some tolerance for the bundle age check, such that it does not
have to be within a fractional millisecond bound.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This ensures the next test's config is not received (via another CLA)
before the deletion has been processed.
Unfortunately, we have no way to determine whether a command has been
processed by uD3TN (there is no operation to query it), so we have to
rely on a simple timeout. This will change with the new forwarding
interface, see the corresponding Milestone.
Fixes: #110
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
There was a rare memory leak if the contact was not found in the target
list (e.g., already deleted earlier).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This makes the testing logs prettier and may help in decoding the
responses received by aap_receive.py.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We do not need this anymore due to making logging line-buffered and it
collides with ASAN in some cases.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Do not return a reference to a non-thread-safe global variable:
ctime() is not thread safe. As we only use the function in logging, we
can directly print the return value, protected by a mutex.
This also adapts the tests and makes the initialization routine always
run. To use the system time again, UINT64_MAX can be passed.
Found by Clang's thread (data race) sanitizer.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We were taking the current time value in milliseconds and sometimes
subtracting larger values from it. This cleans up the calculations to
always determine the expiration time as uint64_t and compare it against
the current uint64_t timestamp.
It further removes the unnecessary "current timestamp" parameter in
`bundle_get_expiration_time_s` (we now store the reception time with the
bundle, so, do not need this anymore) and avoids a integer wrap-around
case in the function.
Note that the current time cancels out in the age block-based
calculation as we can use the reception timestamp there and offset it by
the calculated relative remaining lifetime.
Found by Clang's UB sanitizer.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This enables ASAN and UBSAN in our unit and integration tests.
Another integration test using the thread (data race) sanitizer is added
to detect such issues as well.
The tests are extended such that they wait for uD3TN (all instances if
we launch multiple ones) to terminate, to allow for exit checks of
sanitizers to run. For example, ASAN and the thread sanitizer make use
of this and we need to obtain the exit status code to tell whether the
CI job succeeded or not.
Note that memory leak detection is turned off in the unit tests as they
do not properly deallocate temporary variables, see: #104
aap_send and aap_receive are always invoked with `-v` to get more
information on what happens there in the tests.
Fixes: #55
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Previously we would simply ignore any contact that was overlapping. This
changes the routing table's behavior such that overlapping contacts with
the same node are merged and overlapping contacts with multiple
different nodes are just allowed and added alongside each other. The
maximum number of contacts defined by `MAX_CONCURRENT_CONTACTS` now is
just a limitation of the Contact Manager which will not process more
than that number of contacts at the same time. (If one of them ends, a
concurrent contact that was not handled can be added.)
This change requires, however, that overlapping contacts are properly
rejected in router commands. This is achieved by a corresponding update
of the add/update/delete functions and an extension of the preliminary
checks.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>