This is handy e.g. for testing custom source EIDs, not requiring an
additional BPA instance to be run for injecting bundles.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
The JSON parser unit test heavily uses multiline strings so we can read
the embedded JSON properly. It seems there is no better way to make
checkpatch happy here.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This introduces a JSON contact configuration format for the
deterministic first-contact forwarding (DFCF) implementation as a modern
alternative to our homebrewn configuration messages. For now, it is only
supported in the external DFCF BDM, but integration into the "router
agent" is planned.
Example JSON configuration string (from our tests):
```
{
"command": "ADD",
"node_id": "dtn://ud3tn2.dtn/",
"cla_addr": "mtcp:127.0.0.1:4223",
"reachable_eids": [
"ipn:1.0"
],
"contact_list": [
{
"start": 1401519306972,
"end": 1401519316972,
"data_rate": 2400,
"reachable_eids": [
"dtn://66553/",
"dtn://89326/"
]
},
{
"start": 1401519506972,
"end": 1401519516972,
"data_rate": 1200,
"reachable_eids": [
"dtn://12349/",
"dtn://89326/"
]
}
]
}
```
Closes: #15
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
- This simplifies ithe invocation via Makefile and documents the arguments.
- We missed to add the storage CLA + agent and the compat. router
directories there.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Strict mode activates some messages with `CHECK` level, which are not very
important. However, we cannot fulfil all of them, so we ignored a couple
of message types. It turns out that this also ignores messages with a
`WARNING` level and the same type (e.g., `LINE_SPACING`), which we want
to address in any case. Thus, we disable the strict checking option and
remove related ignore flags.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This also extends the MTCP sink script to allow writing to stdout so we
can check the returned payload.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Adds a SPDX-License-Identifier to all nix files and adjust
`license-check.sh` to consider Nix files and the corresponding
directories.
Filtering directories that should not be checked is now performed in the
find command instead of in the iteration. In addition, the iteration
function is changed, as the for loop splits by spaces, which leads to an
error for file names with spaces — linebreaks are used instead.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
- Moves `tools/aap` + `tools/aap2` to `python-ud3tn-utils/aap*/bin/` to
add the scripts to the python package
- Adds a `main()` function to each script to reference it
- Define `logger` as global variable
- Adds a symbolic link to keep compatibility with existing tooling
- Moves `tools/aap/aap_test.py` to `test/functional/`
- Adds additional dependencies (pyd3tn, cbor) to python-ud3tn-utils and
the corresponding nix package
- Add scripts to python-ud3tn-utils `pyproject.toml`
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
We must use the context manager in the thread that actually accesses
the object (and, transitively, the AAP2 RPC socket).
See: #198Fixes: #198
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
With the addition of the storage agent and the compat. BDM we have the
issue that two new agents accept configuration through bundles, which
cannot check that those bundles come from trustworthy sources. In the
past we restricted contact configuration messages to local clients and
performed an "EID spoofing detection" so that we could check the source
EID - if it is the same as the local node ID, we allowed the
configuration bundle to be processed. With AAPv2 and potentially more
security-relevant components (such as BDMs) appearing in the future, we
need a new mechanism.
The idea behind the implemented mechanism is to reuse the existing AAP
2.0 shared-secret authentication that is applied for BDMs themselves
also for sending configuration messages: We add the possibility to
register an AAP 2.0 RPC agent (one that sends commands *toward* uD3TN)
with the "dispatch" authorization flag. This client can then request a
special flag to be added when sending bundles. The new flag is only
added internally by uD3TN to its in-memory data structure and is
delivered to all internal agents as well as AAP 2.0 clients receiving
the marked bundles. Those agents and clients (such as the sqlite/storage
agent) can then easily check for the flag to be present and thus
determine whether the bundle comes from an authenticated and authorized
source.
Note: The `adu_flags` field for the BundleADU AAP 2.0 message is now a
`repeated` field to represent the option of multiple flags being present
(Protobuf does not support bit fields for this purpose).
Fixes: #187
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
When transmission had been attempted and generated a "TX
success/failure" result, the BDM will need the information which
transmission is affected by the generated dispatch. Additionally, the
term "DispatchRequest" is imprecise, as uD3TN does not require the BDM
to dispatch the bundle in any case (it can do so, but especially after
TX success/failure, oftentimes, it is intended to just proceed with
normal bundle processing).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds a "flags" field to the FIB link, allowing for configuring a
link for "direct dispatch", i.e., to make it usable without first
contacting a BDM. It is important to make this optional as otherwise
contact-based routing and QoS could not be implemented properly via a
BDM.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
If the write method of the CLA fails, the serailizers will now return
early and this failure is handled properly by the TX task.
In the case of the BPv6 serializer, we add the necessary flow control to
the `write_bytes` macro, to prevent needing a conditional for every
write* or serialize* statement.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We use this function in all BDMs - thus, we should move it to a common
library. This also adds a test, ported from the unit test for the
corresponding function in uD3TN's eid.c.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
- Fix the handling of bundles that have been already fragmented: include
the offsets provided by uD3TN in the scheduling decision. We extend
the bundle ID representation by some fields not used for hashing and
comparison to keep the necessary data in memory.
- Implement the re-schedule routine to try to re-schedule fragments and
drop bundles if they cannot be re-scheduled.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This cleans up the intermediate bundle ID storage automatically, making
recognition of looping bundles optional and enabling the stress test to
work as-is. If one wants to filter looping bundles, a new command line
argument is added for that purpose.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds a Python BDM which implements the forwarding approach of uD3TN
v0.13 (the latest release). It listens to the config endpoint and is
thus compatible with `aap_config.py`.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This is a simple forwarding module that only supports ongoing /
persistent contacts and forwards according to a provided JSON mapping
table.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
- Implement management of FIB and BDM agents:
* add administrative secret which is required for registering FIB and
BDM agents
* allow registering reverse-direction agents for TX/RX of ADUs when
passing the admin secret
* add cmdline option to pass the admin secret via an env variable
* make administrative secret optional in debug builds
- Register agents by number, as FIB and BDM agents may not have a sink
ID. Numbers are allocated by the agent_register function.
- Remove global state, add function to de-allocate everything.
- Add comprehensive unit tests.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
To identify a specific bundle, a command line argument is added to
specify the composite bundle ID based on source, destination, creation
timestamp, sequence number, fragment offset and payload length.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
- Introduces a CompoundBundleId to filter exactly one bundle
- Filter bundles either by their ID or selected metadata
- Transfer the entire StorageCall object to the CLA via the agent queue
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
Enables simple interaction with a StorageAgent, such as "push" and
"delete" of bundles from the storage, using the command line.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
Enables simple interaction with a StorageAgent, such as "push" and
"delete" of bundles from the storage, using the command line.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
For protecting µD3TN from proprietary forks that do not give back to the
open-source project, we decided to re-license the µD3TN project under
the GNU Affero General Public License v3.0 (AGPLv3).
To still enable proprietary projects to use µD3TN, D3TN will start to
offer proprietary licenses. To ensure that all future contributions are
compatible with this dual licensing scheme, all external contributions
will still be accepted under the terms of the Apache 2.0 license.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Found by flake8: We now check for the value being a tuple using the
proper `isinstance()` function.
Tested using:
```
build/posix/ud3tn -e ipn:1.0 -p 4242 &
python tools/aap/aap_contact_plan_reader.py \
--plan <(echo "a contact +1 +3600 1 2 10000") \
--nodes <(echo "1 mtcp:localhost:4224 tcp localhost 4242\n2 mtcp:localhost:4225 socket ud3tn.socket")
```
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
- pyd3tn: Fix pinned cbor version
- python-ud3tn-utils: Update protobuf to version 2.24.4
- tools: Update flake8 to version 6.1.0
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@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>
This adds the option to enable keepalive messages for AAPv2 in the
aap_receive and aap_ping tooling, so that the AAPv2 connections stay
alive until bundles are received.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We specify AAP 2.0 to be an RPC protocol whereas the direction of calls
can be switched during configuration. Each call needs to be answered.
This change adds the answer for bundle reception by a client.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
- We have files generated from Protobuf in the codebase, which do not
contain the license header.
- We have a new component directory (`aap2`).
- The license header check is extended to the `proto` and `options`
files.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds adapted versions of `aap_send.py`, `aap_receive.py`, and
`aap_ping.py` for AAP2 and implements the required client classes in
the `ud3tn_utils` module.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This adds the Nanopb library as submodule under `external/` and adds
corresponding build configuration to the Makefiles. Additionally, a
Protobuf stub for AAP 2.0 is included along with a `make` target to
build the corresponding C language files (`aap2-proto-headers`).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This enables a set of "strict" diagnostics from `checkpatch.pl` but
disables some that would cause excessive refactoring or do only apply to
the Kernel.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This...
- sets the line length limit to 100 chars in accordance with the new
Linux kernel line length limit
- ignores things we have no control or which do not apply to us: camel
case (used via TinyCBOR, simplequeue, and FreeRTOS), and macros and types
we have not implemented (things only part of the Linux kernel)
Signed-off-by: Felix Walter <felix.walter@d3tn.com>