We implemented this to mirror the behavior on STM32 with FreeRTOS. We do
not need it anymore on POSIX systems, so better go with the defaults of
the OS.
Closes: #162
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds test for shared library of uD3TN to the CI. The test builds and starts uD3TN from library and runs integration test.
Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
As we do not allow reuse of the same socket file by concurrently running
uD3TN instances, uD3TN may crash on startup if we do not use different
socket filenames.
See: https://gitlab.com/d3tn/ud3tn/-/jobs/5740147850#L232
See: #156Closes: #164
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Everything that this job does is covered by the more extensive
integration test job `integration-test-valgrind-memory-check`.
There also is a potential race condition which makes this test flaky,
see #157.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
See suggestion in !133: This uses the correct Docker image which
contains the fix from DTN7's `master` branch.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This excludes the case when one of the process IDs is zero, otherwise `kill` would unnecessarily send `SIGTERM`.
Signed-off-by: Fiona Fuchs <fiona.fuchs@d3tn.com>
This failure case effectively prevents the CLA from accepting further
connections and, thus, should be handled explicitly. See discussion in
!135 - we propose to restart uD3TN via a service manager or fault
handler in this case.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This changes the download source of DTN7 from the version on crates.io (version 0.19.0) to the one on the GitHub repository of DTN7 (commit 732d1a0). This was due to a bug on the initial version, that threw an error (InvalidUrlFormat) in an irregular manner. This bug has been fixed with the most recent commit.
Signed-off-by: Fiona Fuchs <fiona.fuchs@d3tn.com>
With enabled hardening, nix adds `-D_FORTIFY_SOURCE=2` to the compiler
options, which only works in combination with the optimization level
`-O2`.[^1] For debug builds, optimization is disabled in the Makefile,
which leads to the following warning:
`warning _fortify_source requires compiling with optimization (-o)`
To remove this warning, hardening is deactivated for the devShell
environment.
[^1]: https://nixos.org/manual/nixpkgs/stable/#sec-hardening-in-nixpkgs
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
This modifies the `exit_handler`, so that all the logs will still be printed if any `wait` statement returns an error code. In addition, redundant checks at the end of setting up each instance are removed, as they did not work properly.
Signed-off-by: Fiona Fuchs <fiona.fuchs@d3tn.com>
This adds
- a Dockerfile, which contains all the necessary dependencies for the interoperability test,
- a bash script, that performs bundle forwarding between uD3TN and DTN7-rs,
- a config file for the bundle forwarding scenarios in the script,
- and a CI job, which runs the uD3TN - DTN7-rs interoperability test.
Signed-off-by: Fiona Fuchs <fiona.fuchs@d3tn.com>
Previously we were using ASSERT(0|false), which only works in debug
builds. In some cases, this is intended, but we cannot reliably continue
operation in others. We now use abort() where we have to terminate the
program abnormally. In cases where only debug builds should terminate, a
comment is added.
This is done along with the logging updates as the code is typically
related and would cause conflicts otherwise.
Closes: #163
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Rules that have been applied:
- ERROR: Anything that is or may be problematic for the program to
continue running.
- WARN: Anything abnormal but definitely not critical for program
continuation, especially issues encountered when interacting with
clients (e.g. AAP).
- INFO: All state changes not corresponding to the "normal" processing of
individual data or messages/bundles, as well as further informative and
helpful messages. Includea errors that occur during normal data
processing.
- DEBUG: Messages to trace what happens with individual bundles and
other fine-grained information about internal processes.
At the moment, `LOG_ERRNO` always emits messages with the "ERROR" level.
We might want to change this in the future to better differentiate WARN
and ERROR in this regard also.
Closes: #140
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This uses the `nixos/nix` Docker image on a standard Docker CI runner to
execute the Nix build job. We already tested and reviewed this in !134 -
it does not greatly increase the pipeline runtime. Another advantage is
that it validates the build without an active Nix cache.
In addition to the configuration in !134 it pins the NixOS image version
to prevent issues based on a different version in this regard (e.g.,
differences in experimental command or submodule support).
Note that currently newer images than `nixos/nix:2.18.1` do not work
because of issues with submodule handling. This is tracked in #160.
Fixes: #158
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Otherwise we run into a conflict with the default socket and one
instance may not start properly.
Fixes: #156
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
protobuf==4.21.12 requires python>=3.7[^1]. To resolve the version
conflict between μD3TN and the protobuf package, the required minimum
Python version is set to >=3.7.
[^1]: https://pypi.org/project/protobuf/4.21.12/Closes: #153
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
Since protobuf==4.24.4 is not (currently) part of nixpkgs, but
protobuf==4.21.12, the pinned version is changed to reduce the effort
for packaging version 4.24.4 itself.
The protobuf Python language bindings have been regenerated to
incorporate the changes from the modified version.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
This reduced unnecessary clutter by default if we do not want to debug
uD3TN. Should also slightly increase performance by issuing less
`printf` statements.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This resolves the race condition documented in #139.
The log macros now each call only a single function which locks
a binary semaphore during execution.
Fixes: #139
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
To build μD3TN with AAP2, the protobuf language bindings in the
`generated/` directory must be added as an input source.
In addition, `python3Packages.protobuf` and `python3Packages.setuptools`
must be added as a dependency for `python-ud3tn-utils`.
To interactively generating nanopb protobuf C-language bindings via
`make aap2-proto-headers` additional packages are added to the devShells
environment.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
- `bpgen` sometimes sends a different amount of bundles, supposedly because
of a race condition. We already test the transmission of bundles this part
was testing with the following test.
- We wait for graceful termination of uD3TN because of the leak
sanitizer that runs on termination. We do not need this for HDTN and
other utilities. We should also make it part of the normal testing
routine, not of the exit function, which might fail and not print the
logs if waiting for uD3TN returns non-zero.
- Some delays were unnecessary.
- A delay is introduced before `bpsendfile` to ensure it is only run
after `aap_receive` has connected to uD3TN.
- We now ensure the uD3TN 2 log is always shown.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
The report is created in `/ud3tn_build`, not in the directory
created by GitLab runner. However, it has to be uploaded from there.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds proper docstrings including documenting return values and
exceptions for the `aap2_client` module.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We now perform the range check via argparse and provide a function to
add the parser argument like with other common parser arguments.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds the AAP 2.0 typedefs to the checkpatch list, so it will not
complain about style when declaring a variable or function argument as
`<typedef> *const <name>`.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
- remove comments on "callback-style" serialization (not needed)
- define magic number in Python AAP 2.0 client via descriptive var
- make `secret` in Python AAP 2.0 client a private variable (used
nowhere else and should not be a class property)
- add missing Python docstrings
- add some comments explaining behavior
- language enhancements and fixes in docs and comments
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
There might be incompatible changes in those messages before their
public release. As we only support basic send/receive functionality over
AAPv2, we do not need to include the definitions of other messages.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>