ud3tn/test/unit
Felix Walter bae84adcdd bundle_processor, RX: Properly handle LocalNode ipn EIDs
This was implemented using Claude Code. Prompts:

- > According to RFC 9758, there is the concept of LocalNode ipn URIs, which should be handled properly. This means ipn EIDs with allocator `0` and node number `0xFFFFFFFFF` should resolve to the local node when dispatching bundles in `bundle_processor`. Note from the RFC: "Because a LocalNode ipn EID only has meaning on the local bundle node, any such EID MUST be considered non-routable. This means that any bundle using a LocalNode ipn EID as a bundle source or bundle destination MUST NOT be allowed to leave the local node. Equally, all externally received bundles featuring LocalNode EIDs as a bundle source or bundle destination MUST be discarded as invalid." I propose to:
	- Add this special handling for the bundle destination in `endpoint_is_local` and `get_agent_id` in `bundle_processor.c`, e.g., by prefix-matching the string representation. As we do EID normalization in the parser, we only need to match the 2-element representation. This change will moreover ensure that such bundles do not leave the local node.
	- Reject incoming bundles with such EIDs in the source or destination field early-on: add a check after the `bundle_is_valid` check in `components/cla/cla_contact_rx_task.c` (we cannot extend `bundle_is_valid` as it may also be used for checking the validity of locally-injected bundles).
- (Note: We cannot reject it in the parsers as we are using them for our persistent storage.)
- > Check the EID normalization in `components/ud3tn/eid.c`, lines 317--368, again. We perform this for every bundle upon reception and local creation. It seems you were missing some context. Also, ipn:0.4294967295 is NOT a valid EID, as in the 2-element representation the first number is the node number and the second the service number, and ipn:0.0 is the NULL endpoint and any other service number there is invalid.
- > Do not forget to include the EID normalization in `components/ud3tn/eid.c`, lines 317--368, in your context.
- > The correct format is ipn:4294967295.*, as the node number 0xFFFFFFFFF determines it is a LocalNode URI and we represent it in decimal. As we do normalization, we do not need to care about the allocator id (which is 0 but is dropped due to normalization). You do not need to touch validation or normalization. Just implement proper prefix matching for "ipn:4294967295." in the mentioned places in `bundle_processor.c` and properly determine the local agent id there (which is equal to the service number when dealing with an ipn EID). Additionally, implement the rejection in `cla_contact_rx_task.c` as mentioned by prefix-matching the source and destination EID of the incoming bundle.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2025-11-12 09:52:03 +01:00
..
bundle7Data.c Insert SPDX license expression comments into our .c, .h, .py, and .sh code 2022-02-20 16:24:38 +01:00
main.c test/unit: Disable logging during tests 2024-06-17 13:33:31 +02:00
test.c bundle_processor: Add test for local EID handling 2025-11-12 09:49:23 +01:00
test_aap.c Move definition of _POSIX_C_SOURCE and _DEFAULT_SOURCE to posix.mk 2023-10-25 15:56:57 +02:00
test_aap_parser.c test: Remove the Unity wrappers for memory allocation functions 2023-05-15 11:39:29 +02:00
test_aap_serializer.c test: Remove the Unity wrappers for memory allocation functions 2023-05-15 11:39:29 +02:00
test_agent_manager.c Refactor FIB: Separate node entry from CLA link 2024-08-23 11:59:02 +02:00
test_bibe_encoder.c test: Remove the Unity wrappers for memory allocation functions 2023-05-15 11:39:29 +02:00
test_bibe_parser.c style: Spacing, indentation, long lines, continuations 2023-07-25 13:15:05 +02:00
test_bibe_validation.c Use BIBE AR type code 64443 by default 2025-09-05 10:57:59 +02:00
test_bundle.c test_bundle: Add tests for extended BPv7 validations 2025-07-15 10:45:21 +02:00
test_bundle6Create.c Implement status report support in AAP 2.0 2025-06-05 17:13:17 +02:00
test_bundle6Fragmentation.c Implement status report support in AAP 2.0 2025-06-05 17:13:17 +02:00
test_bundle6ParserSerializer.c bundle6, bundle7, python: Implement ipn update (RFC 9758) 2025-11-12 09:49:23 +01:00
test_bundle7Create.c Implement status report support in AAP 2.0 2025-06-05 17:13:17 +02:00
test_bundle7Fragmentation.c bundle_fragmenter: Always create new fragments with offset + length 2024-06-21 10:36:30 +02:00
test_bundle7Parser.c bundle6, bundle7, python: Implement ipn update (RFC 9758) 2025-11-12 09:49:23 +01:00
test_bundle7Reports.c test: Remove the Unity wrappers for memory allocation functions 2023-05-15 11:39:29 +02:00
test_bundle7Serializer.c bundle6, bundle7, python: Implement ipn update (RFC 9758) 2025-11-12 09:49:23 +01:00
test_bundle_processor.c bundle_processor, RX: Properly handle LocalNode ipn EIDs 2025-11-12 09:52:03 +01:00
test_crc.c test: Remove the Unity wrappers for memory allocation functions 2023-05-15 11:39:29 +02:00
test_eid.c eid: Properly handle the ipn NULL endpoint and zero-allocator EIDs 2025-11-12 09:51:52 +01:00
test_fib.c Refactor FIB: Separate node entry from CLA link 2024-08-23 11:59:02 +02:00
test_json_config.c routing/compat: Implement JSON configuration parser 2025-06-05 17:03:39 +02:00
test_node.c Re-integrate v0.13.0 routing code as "integrated default BDM" 2024-07-15 00:46:14 +02:00
test_routingTable.c Re-integrate v0.13.0 routing code as "integrated default BDM" 2024-07-15 00:46:14 +02:00
test_sdnv.c test: Remove the Unity wrappers for memory allocation functions 2023-05-15 11:39:29 +02:00
test_simple_queue.c style: Spacing, indentation, long lines, continuations 2023-07-25 13:15:05 +02:00
test_simplehtab.c test: Add unit tests for htab_get_pair 2025-07-24 08:30:29 +02:00
test_spp.c style: Spacing, indentation, long lines, continuations 2023-07-25 13:15:05 +02:00
test_spp_parser.c test: Remove the Unity wrappers for memory allocation functions 2023-05-15 11:39:29 +02:00
test_spp_timecodes.c style: Spacing, indentation, long lines, continuations 2023-07-25 13:15:05 +02:00
testud3tn_unity.h test: Remove the Unity wrappers for memory allocation functions 2023-05-15 11:39:29 +02:00