Commit graph

19 commits

Author SHA1 Message Date
Felix Walter
030b0bf75a routing/compat: Implement JSON configuration parser
This adds the JSON parser logic as an alternative to the custom legacy
format and also adds necessary tests.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2025-06-05 17:03:39 +02:00
Felix Walter
868bac67b6 router_agent, mk: Add stub of JSON configuration feature
This adds a function to decode JSON configuration via Jansson to the
router agent. The JSON functionality and, thus, the dependency on
Jansson, can be disabled during the build process by setting the
`DISABLE_JSON` compile-time flag (see `config.mk.example` for details).

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2025-06-05 17:03:39 +02:00
Felix Walter
58aee16e7d routing/compat: Set pointer to previous element properly
Previously we did not update the pointer to the previous element when
*not* removing the current element. This may result in memory being
leaked if the following element is removed and the removal code assumes
that it is the first element in the list, setting the list head to the
element that follows.

The update of `prev->next` is removed as it should be set properly
anyway.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-11 10:16:22 +02:00
Felix Walter
9533f72f91 routing/compat: Remove unused struct
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-11 10:15:34 +02:00
Felix Walter
553cb23bdd Fix constParameter and constVariable warnings by cppcheck
This improves const correctness, at least for pointers (making the
pointed-to data const where possible).

Some suppressions are added for false positive warnings, such as in
`simple_queue.c` where an arithmethic operation is used on the pointer
to calculate a non-const pointer that is returned (thus, the passed
pointer should also not point to const).

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-11 10:13:21 +02:00
Felix Walter
b58f137313 Fix unsignedLessThanZero warning by cppcheck
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-11 10:13:21 +02:00
Felix Walter
742d0d3c5f Fix variableScope warnings by cppcheck
This reduces the scope of several variables.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-11 10:12:44 +02:00
Felix Walter
daf80c7155 routing/compat: Handle NULL pointers in release builds
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-11 10:12:43 +02:00
Felix Walter
96be0594ff routing/compat: Address memleaks pointed out by clang-tidy
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-11 10:12:43 +02:00
Felix Walter
c965894a27 style: Add blank linkes after all declarations
For consistency and to silence the stylecheck (`WARNING:LINE_SPACING`).

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-11 10:10:43 +02:00
Maximilian Nitsch
4b145c847e contact_manager: Add new contacts to the current_contacts when processing added_contacts
To prevent additional occupancy of a `contact_info_list` entry, new
contacts are first added to the list of added contacts and only later
shifted to the list of all current_contacts.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-09-02 10:13:28 +02:00
Maximilian Nitsch
86d29433f2 contact_manager: Use linked list for added and removed contacts
In addition to the previous commit, the local variables `added_contacts`
and `removed_contacts` are now also represented by a linked list to
eliminate limitations of a static array.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-08-30 16:26:04 +02:00
Maximilian Nitsch
cf0a43cb11 contact_manager: Use linked list for current_contacts
To eliminate the limitation of a statically allocated array to store
current contacts its replaced by a linked list.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-08-30 16:20:10 +02:00
Felix Walter
8f442b8f6b Adjust log levels of some common unimportant messages to DEBUG
Three messages that are printed quite often but are barely relevant,
either because there is another INFO-level message about the same thing
and they only confirm processing or because the behavior can be expected
anyway, are downgraded to DEBUG level, so they are not shown by default
and disabled in release builds.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-08-30 13:58:43 +02:00
Felix Walter
78bef1a089 Refactor FIB: Separate node entry from CLA link
The FIB fulfils two purposes: 1) map node IDs to next-hop CLA addresses
and 2) store the current status of a link associated with a given CLA
address.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-08-23 11:59:02 +02:00
Felix Walter
281b3ec248 config_parser: Remove unused parser stage
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-07-15 00:46:14 +02:00
Felix Walter
ccbeac91f3 Unify and document compile-time options of compat. router
This prefixes all compile-time options of the compat. router with
`ROUTER_` and adds them to config.mk.example so they can be easily
discovered and adapted.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-07-15 00:46:14 +02:00
Felix Walter
87be9749af Re-integrate v0.13.0 routing code as "integrated default BDM"
This makes µD3TN behave the same as v0.13.0 when executed without an
additional commandline argument. A new commandline argument `-d` /
`--external-dispatch` is added, which enables the use of external BDMs.
The default forwarding implementation is now again provided using the
v0.13 code, extracted from e1621765a4 and
adapted to the new agent-based forwarding implementation.

Central changes to the old code include:

- A new "Routing Agent" that handles incoming configuration commands,
  FIB updates, and BDM dispatch requests.
- The use of the BDM authorization flag to authorize contact
  configuration commands.
- The Contact Manager now only triggers the creation and removal of
  links / FIB entries; bundle dispatch is triggered through the FIB and
  BDM callback functions of the Routing Agent.
- The fragmentation logic is adapted to store the original bundle along
  with an offset and length value, instead of pre-creating and storing
  the fragments.
- The bundle re-scheduling logic integrated into the Routing Agent is
  simplified and does not support changing the fragmentation parameters.
  A new function is added to the Router that searches for a new route
  for such fragments that were already scheduled at some point,
  considering them as un-fragmentable bundle with overridden fragment
  offset and length.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-07-15 00:46:14 +02:00
Felix Walter
ad4f56b62d Re-import v0.13.0 router code
This adds the code from e1621765a4 back
into the tree unchanged, but moved into two new directories, in
preparation of the following commit, which adds a routing agent on this
basis, to make it possible to review the diff properly.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-07-15 00:46:14 +02:00