Commit graph

25 commits

Author SHA1 Message Date
Felix Walter
7e810fa4c4 AAPv1: Set the BDM auth. flag if remote config is allowed
This keeps AAPv1 compatible for configuring our BDMs if we set the
additional flag.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-26 13:32:23 +02:00
Felix Walter
261d1b1346 sqlite_agent: Fix inconsistency in function definition
It was adapted in the C file but not in the header.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-21 12:45:02 +02:00
Felix Walter
6d2f204af5 Replace integrated next-hop forwarding with AAP 2.0
This adds functionality to dispatch bundles and control the FIB to AAP
2.0 and the bundle processor, replacing the old "router" completely.
AAP 2.0 is extended slightly to enable fragmentation.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-17 13:33:32 +02:00
Felix Walter
271ff4aa4f agent_manager: Extend by FIB and BDM mgmt., simplify, make testable
- 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>
2024-06-17 13:33:31 +02:00
Felix Walter
332323bed3 Adapt license of new files to AGPL-3.0
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-03 13:45:19 +02:00
Maximilian Nitsch
f22162952f SQLiteAgent: Clean-up on termination
Frees the allocated memory and closes the database connection on exit.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-06-03 13:41:58 +02:00
Maximilian Nitsch
1321c59c22 sqlite_agent: Add an agent to interact with the SQLiteCLA
The SQLiteAgent enables SQLiteCLA to read packages from the database and
return them to μD3TN. For this purpose, the SQLiteAgent writes commands
to the queue that SQLiteCLA is waiting for.

The SQLiteAgent itself can be controlled by protobuf messages that
describe which action is to be applied to which set of bundles.

Currently the operations "Push" and "Delete" are implemented and a
filter based on a destination EID pattern.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-06-03 13:41:58 +02:00
Maximilian Nitsch
de33e8cc51 cla_sqlite: Implementation of the SQLite-based storage back-end
The SQLiteCLA makes it possible to write bundles, that are to be sent
via this CLA, to an SQLite database in order to persist them over a
longer period of time and also a restart of μD3TN.

The bundles are saved together with selected metadata (source EID,
destination EID, creation timestamp) in the "bundles" table. A
combination of source EID and creation timestamp is used as the primary
key.

To return bundles to μD3TN, they are read from the database and injected
via the cla_read() function, just like other CLAs that receive bundles.
To trigger this, commands are read from a queue that specify which
bundles are to be read from the database.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-06-03 13:41:58 +02:00
Felix Walter
c945da6bf6 hal_config.h: Allow for changing AAP and Linux-spefific defs
For two settings previously defined in `hal_config.h` it makes sense to
make them changeable via `config.mk`. The AAP setting is moved to the
appropriate header and the Linux-specific APU define gets a guard so it
can be changed at compile time.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-10-25 15:56:53 +02:00
Felix Walter
26e91ad69e Remove config.h: Move all definitions to individual headers
This moves all definitions from config.h to individual header files and
makes them configurable (i.e., does not define when already defined).

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-09-29 14:43:21 +02:00
Felix Walter
379f09d7af hal_time, agents: Remove the function to set the system time
This should be a function offered by the operating system, not by a
userland process like uD3TN.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-11 16:59:13 +02:00
Felix Walter
3cd89eb6a5 bundle, agents: Switch time unit to milliseconds
...to align with the general decision to make DTN timestamps
millisecond-based.

See: #53

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-11 16:59:13 +02:00
Felix Walter
85f20e8b25 config_agent: Do not send command via BP queue
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>
2023-05-10 17:23:55 +02:00
Felix Walter
93a58ed387 Merge Bundle Processor and Router Task
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>
2022-12-07 21:02:36 +01:00
Felix Walter
be59cc30eb agents: Implement echo functionality as agent in uD3TN
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>
2022-08-26 09:30:43 +02:00
Georg Alexander Murzik
298431c68f Insert SPDX license expression comments into our .c, .h, .py, and .sh code
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>
2022-02-20 16:24:38 +01:00
Felix Walter
3ab90dcffb Make the remote configuration capability a command line flag
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>
2021-11-11 23:00:09 +01:00
Felix Walter
a160433739 config_agent: Move handling of compile flag to source file
This moves handling the CONFIG_AGENT_REMOTE_CONFIGURATION flag from the
header to the respective source file as we do not want the variable to
be present in any file including the config_agent header.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2021-07-27 14:55:21 +02:00
Felix Walter
f61bbde251 management_agent: Prevent remote time configuration
We already have a CONFIG_AGENT_REMOTE_CONFIGURATION build option to
enable remote configuration via the config_agent. However, setting the
time via management_agent is allowed in any case. This change applies
the same restrictions to setting the system time.

Note: Setting the time is important for STM32 as this device does not
manage the time by itself like a POSIX-based system.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2021-07-27 14:55:21 +02:00
Georg Alexander Murzik
5ab07b2ee1 Move agent manager state ownership to bundle processor task
This avoids unsynchronized shared state access between the application agent
and the bundle processor tasks, which could lead to use after free errors.

This commit also removes some unreachable code in the `process_aap_message`
function of `application_agent.c`:

```
// already handled by the previous `aap_message_is_valid` call w/ early return
if (msg.eid == NULL || msg.eid_length == 0) {
	// zero-length EID, only de-registering
	response.type = AAP_MESSAGE_ACK;
}
```

Signed-off-by: Georg Alexander Murzik <georg.murzik@d3tn.com>
2021-01-12 16:31:19 +01:00
Maximilian Nitsch
bbd0900deb config_agent: Only accept config MSGs from local EIDs
To be protected against unauthorized remote configuration, by default
only configuration bundles with a local source EID are processed by the
config agent. This feature can be disabled by setting
CONFIG_AGENT_REMOTE_CONFIGURATION to true at compile time.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2020-12-18 14:27:53 +01:00
Felix Walter
490a312c84 Adapt mentions of uPCN to uD3TN in code files and headers
This updates all remaining references in the code to mention the new
name.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2020-11-17 15:51:10 +01:00
Felix Walter
288b99069c Replace enum upcn_result by enum ud3tn_result
This renames the enum and its two constants `UPCN_OK` and `UPCN_FAIL`
accordingly.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2020-11-17 15:51:10 +01:00
Felix Walter
fb4238a97d Adapt core include path from upcn/ to ud3tn/
This moves all headers from upcn/ to ud3tn/ and adapts the #include
statements accordingly.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2020-11-17 15:51:10 +01:00
Felix Walter
0ce4bee910
Initial import of uPCN v0.8.0 source code
This is the initial commit for uD3TN. uD3TN is a fork of uPCN v0.8.0,
which will be developed and maintained in a public Git repository.

For questions concerning the history of and code provided with uPCN,
please get in touch with us via: contact <at> d3tn <dot> com

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2020-11-14 11:56:40 +01:00