So far the contact interval check was done in the
config parser. As this is a semantical and not
syntactical check it is moved to the RoutingTable.
Modified @ 2022-12-21 by Felix Walter to adapt to new state of codebase,
adding the check to `node_prepare_and_verify` in `node.c` instead.
Closes: #47
Signed-off-by: Marius Feldmann <marius.feldmann@d3tn.com>
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This function is dangerous: if the resulting string is longer than the
buffer, no null-termination is added to it. Also, it always fills the
remaining buffer length with zeroes.
snprintf is fast and can always be used as replacement (and sometimes
there are better substitutes).
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Commit b07a653389 was not properly
rebased, so it still used the old variable name `time`, not `time_ms`
that was introduced in 3cd89eb6a5.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
See the added description in the AAP documentation - this adds an
internal format to the 64 bit integer value returned as "bundle ID" in
the `SENDCONFIRM` AAP message to uniquely identify the created bundle in
conformance to RFC 9171.
Closes: #60
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 removes the need to send them via the queue which might result in a
deadlock as described in #115. The bundle processor context is passed as
an opaque pointer that can be used for calling BP functions from agent
callbacks (which run inside the BP thread).
Fixes: #115
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This may cause a deadlock which we observed sometimes in the routing
integration test in CI as one slot in the BP queue is always needed to
finish processing the Bundle in the BP (that causes `agent_forward` in
this case).
This makes the config agent directly invoke the BP function.
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>
The `task` field in the communication task config was set by the main
task _after_ the creation of the comm. task. This may lead to
synchronization issues as the comm. task needs to access the field to
de-allocate it upon termination.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
`strerror()` is not thread-safe, thus, we have to use an alternative. If
we want to prevent allocating a temporary buffer (e.g., for
`strerror_r`), we need to use `perror()`. To allow writing stored
`errno` values, the function sets `errno` from an argument passed to it,
which should be safe according to the manual.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
The BIBE CLA allocated a buffer the size of sizeof(struct aap_message)
but then serialized an AAP message into it. It should have used
aap_get_serialized_size(), though, this change directly removes the
unnecessary buffer in between and directly writes out the data.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This refactors the Router Task into synchronous functions called by the
BP, preventing the need of circular notifications between them.
The router queue is replaced by new signals in the BP queue.
This additionally removes the global state in the bundle processor.
Closes: #11
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
The probability-based routing was never used productively. It implied
that we store all the contacts for which a bundle was scheduled (as
there may be more than one) and keep it, doing reference counting before
we drop the data structure, and so on. This change removes everything
probability-related. The field in the config commands is kept to ensure
backwards compatibility if this is specified.
The removal of struct routed_bundle allows for a major simplification of
all routing-related code.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
For BPv6 we had a "bundle quota" check, which is not present for BPv7
anymore and not possible after the removal of the bundle storage manager.
The AAP parser had an equivalent function, which was, however, not used
by the Application Agent.
A more flexible implementation and a new "bundle quota" check are
tracked by issue #105.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Use the proper types for conversion of ssize_t and the bundle pointer so
we ensure that there are no issues with their range.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This removes the unnecessary bundle storage manager that was built for
persistent storage but never used for that purpose. We will implement a
proper persistent storage in the new Rust version. For simplifying the
following adaptations this removes everything storage-related and
replaces the used bundle ID by the pointer.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This implements what we have as aap_echo.py tool in an agent that runs
within uD3TN itself. This makes it easier to check availability of uD3TN
also if the runtime environment does not provide a Python implementation.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This moves the functions to create bundles from within agents from the
application agent to a dedicated utility module, ready to be re-used by
other agents.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We adapted this to also provide the `allow_remote_configuration` flag,
but did not adapt the variable that is passed.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Former releases of uD3TN have included support for STM32/FreeRTOS.
Having this support from the first moment on was a good thing in
order to optimize for platforms with limited resources. As this
platform is not used in current uD3TN setups and as it results in quite
some maintenance work, it is removed with this commit. The removed parts
cover the implementation itself, tests, tools, documentation, parts of
the build/make scripts as well as licensing information.
Signed-off-by: Marius Feldmann <marius.feldmann@d3tn.com>
ud3tn is available under multiple licenses and we want to reflect this in
our source code. But which license information should appear first and how
can we manage this efficiently in the future? The Linux Kernel uses SPDX
expressions instead of boilerplate sections. This seems to be a great
approach, so we do the same here.
Signed-off-by: Georg Alexander Murzik <georg.murzik@d3tn.com>
Our current router implementation searches for the EID returned by
get_node_id(destination). This might differ, e.g., by a slash added
at the end of a `dtn` scheme EID. Thus, we want to ensure that this
value is added to the routing table if we can determine it.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This matches bundles with ipn source EIDs properly against the local
node ID by retrieving the node ID first.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
We don't want raw memcmp if we have utility functions.
This further exposes the function to parse and validate ipn EID node and
service numbers to replace error-prone checks for those.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
-> https://datatracker.ietf.org/doc/html/draft-ietf-dtn-bpbis-31#section-4.2.5
The previous validation methods were not sufficient to check validity of
dtn as well as ipn EIDs. This adds further functions to easily detect
the EID scheme and validate dtn plus ipn EIDs. Tests for the most common
cases where validity checks should be successful and where they might
fail are added as well.
Due to this change the default EID of uD3TN gets a slash appended, as
dtn EIDs always have to contain the name delimiter '/'.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Previously uD3TN implicitly assumed string EID in many places such as
the agent manager. This adds proper handling for ipn-scheme EIDs,
using numerical service numbers as agent IDs in case uD3TN is started
with an ipn-scheme EID. If the ipn scheme is used, uD3TN always has to
be configured with the service number 0. The config and management agent
IDs can be configured in config.h and are 9000 and 9001, respectively,
to keep the lower range of service numbers free. It is intentional that
agents can register with a service number of zero - uD3TN does not
provide specific functionality under this service number.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This removes some code duplication in handling the two types of AAP
messages by performing the additional processing for BIBE BPDUs
optionally before proceeding to process the bundle ADU.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
In order to have SENDBIBE and RECVBIBE messages have the same kind of
payload data (BPDUs) the creation of the administrative record needed
for BIBE bundles was moved from the bibe_proto.c file to the application
agent.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
Log messages pertaining to BIBE bundles are now clearly labeling
these bundles as BIBE bundles.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
This commit adds an automated interoperability test between µD3TN and
ION. In this test a BIBE bundle is sent to a µD3TN BIBE node which
processes and forwards the encapsulated bundle to an ION instance.
This ION instance discards the encapsulating bundle, encapsulates the
inner bundle again and forwards it to a second µD3TN BIBE node, on which
the receiving bundlesink is running.
This commit also adds "-" to the characters permitted in the CLA string
used to inform the BIBE CLA which node the encapsulating bundle should
be addressed to. This is necessary, as ION uses the "hostname" command
when establishing the administrative endpoint of a node thus creating
an endpoint using the hostname of the machine the node's running on as
EID. This hostname could naturally contain a dash.
Before running the test pyd3tn/bundle7.py has to be modified, as ION uses
administrative record type code 7 to identify BIBE bundles, whereas µD3TN
uses the more recently specified type code 3. In order for the test to
work, the RecordType BIBE_PROTOCOL_DATA_UNIT on line 83 in bundle7.py has
thus to be changed to 7 instead of 3.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
In case of a SENDBIBE message generated by the BIBE CLA, the payload
must not be serialized when the rest of the message is serialized.
To make this possible, the serialize_pl parameter was added to the
aap_serializer. If serialize_pl is false, the serializer will skip the
payload and just serialize the rest of the AAP message.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
Due to adding the next hop EID directly to the CLA address passed
to the BIBE CLA, the config_parser needs to work with the symbols
'#' and '/'.
This commit adds support for these symbols to the config_parser.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
Previously, we had a build-time flag for enabling configuration via
bundles received from other nodes. Thus, changing the flag required a
re-build. As we are depending on it also for our integration tests and
it is often handy in further setups, this change makes it a command
line argument "--allow-remote-config".
As the STM32 platform does not support command line arguments, remote
configuration is enabled by default there via config.h.
See also: !13, #32
Signed-off-by: Felix Walter <felix.walter@d3tn.com>