Merge branch 'chore/ci-python-clang-3.14-trixie' into 'master'

Bump python:3.14-trixie docker image

See merge request d3tn/ud3tn!262
This commit is contained in:
Felix Walter 2026-05-20 18:25:03 +02:00
commit aebb31940a
20 changed files with 187 additions and 95 deletions

View file

@ -5,7 +5,7 @@ stages:
- code_quality_test
- publish
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.9-bookworm
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie
variables:
GIT_SUBMODULE_STRATEGY: recursive
@ -84,22 +84,22 @@ test-nix-x86_64-linux:
build-posix-arm64-debug:
extends: build-posix-debug
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.9-bookworm-arm64
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
build-posix-arm64-release:
extends: build-posix-release
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.9-bookworm-arm64
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
build-clang-posix-arm64-debug:
extends: build-clang-posix-debug
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.9-bookworm-arm64
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
build-clang-posix-arm64-release:
extends: build-clang-posix-release
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.9-bookworm-arm64
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
build-posix-macos-debug:
extends: build-posix-debug
@ -152,7 +152,7 @@ unit-test-posix-release:
unit-test-posix-arm64:
extends: unit-test-posix-debug
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.9-bookworm-arm64
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
unit-test-posix-macos:
stage: functional_test
@ -195,9 +195,9 @@ integration-test-posix:
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
integration-test-posix-python-3.13:
integration-test-posix-python-3.14:
extends: integration-test-posix
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.13-bookworm
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.14-trixie
integration-test-posix-thread-sanitizer:
stage: functional_test
@ -264,7 +264,7 @@ integration-test-posix-release:
integration-test-posix-arm64:
extends: integration-test-posix
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.9-bookworm-arm64
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
integration-test-posix-macos:
stage: functional_test
@ -787,14 +787,19 @@ cppcheck-static-analyzer:
stage: code_quality_test
when: always
script:
- cppcheck --enable=warning --error-exitcode=2 --inline-suppr -I include -I external/tinycbor/src -I external/util/include components
- cppcheck --version
- cppcheck
--enable=warning --force --check-level=exhaustive --error-exitcode=2 --inline-suppr
-I include -I external/tinycbor/src -I external/util/include components
cppcheck-stylecheck:
stage: code_quality_test
when: always
script:
# NOTE: When updating cppcheck, add the following arguments: --check-level=exhaustive --suppress=constParameterCallback
- cppcheck --enable=style --error-exitcode=2 --inline-suppr --suppress=knownConditionTrueFalse
- cppcheck --version
- cppcheck
--enable=style --force --check-level=exhaustive --error-exitcode=2 --inline-suppr
--suppress=knownConditionTrueFalse --suppress=constParameterCallback
-I include -I external/tinycbor/src -I external/util/include components
publish-docker-image:

View file

@ -733,6 +733,12 @@ static aap2_ResponseStatus process_adu_msg(
const size_t ar_size = payload_length + ar_typecode_size + 1;
uint8_t *const ar_bytes = malloc(ar_size);
if (!ar_bytes) {
free(payload_data);
LOG_WARN("AAP2Agent: Memory allocation failed!");
return aap2_ResponseStatus_RESPONSE_STATUS_ERROR;
}
ar_bytes[0] = 0x82; // CBOR array of length 2
CborEncoder encoder;

View file

@ -73,6 +73,11 @@ int echo_agent_setup(struct bundle_agent_interface *const bai,
sizeof(struct echo_agent_params)
);
if (!params) {
LOG_WARN("EchoAgent: Memory allocation failed!");
return -1;
}
params->is_ipn = bai->local_admin_endpoint.scheme == EID_SCHEME_IPN;
params->local_admin_endpoint = eid_dup(bai->local_admin_endpoint);
params->lifetime_ms = lifetime_ms;

View file

@ -317,6 +317,12 @@ static int16_t process_aap_message(
const size_t ar_size = msg.payload_length + ar_typecode_size + 1;
uint8_t *const ar_bytes = malloc(ar_size);
if (!ar_bytes) {
LOG_ERROR("AppAgent: Memory allocation failed!");
response.type = AAP_MESSAGE_NACK;
break;
}
ar_bytes[0] = 0x82; // CBOR array of length 2
CborEncoder encoder;

View file

@ -200,7 +200,7 @@ static enum ud3tn_result storage_operation_delete_bundles(sqlite3 *db, StorageCa
static enum ud3tn_result storage_operation_push_bundles(
sqlite3 *db,
QueueIdentifier_t cla_queue,
StorageCall *storage_call)
const StorageCall *storage_call)
{
(void)db;

View file

@ -118,10 +118,13 @@ static void write_to_buffer(
memcpy(&buffer[position], data, length);
}
struct bibe_header bibe_encode_header(const char *const dest_eid,
const size_t payload_len)
int bibe_encode_header(
const char *const dest_eid,
const size_t payload_len,
struct bibe_header *hdr)
{
struct bibe_header hdr;
ASSERT(hdr != NULL);
const size_t eid_len = strlen(dest_eid);
// len == 8 bytes + 1 byte header
const size_t CBOR_MAX_UINT_LENGTH = 9;
@ -130,6 +133,9 @@ struct bibe_header bibe_encode_header(const char *const dest_eid,
uint8_t *temp_buffer = malloc(CBOR_MAX_UINT_LENGTH);
CborEncoder encoder;
if (!temp_buffer)
return -1;
cbor_encoder_init(&encoder, temp_buffer, CBOR_MAX_UINT_LENGTH, 0);
cbor_encode_uint(&encoder, (uint64_t)payload_len);
const size_t bpdu_size = cbor_encoder_get_buffer_size(
@ -141,6 +147,11 @@ struct bibe_header bibe_encode_header(const char *const dest_eid,
/* Encoding the BPDU */
uint8_t *bibe_bytes = malloc(bpdu_size);
if (!bibe_bytes) {
free(temp_buffer);
return -1;
}
bibe_bytes[0] = 0x83; // 83 (100|00011) -> Array of length 3
bibe_bytes[1] = 0x00; // 00 -> Integer 0 (transm. ID)
bibe_bytes[2] = 0x00; // 00 -> Integer 0 (retr. time)
@ -163,22 +174,27 @@ struct bibe_header bibe_encode_header(const char *const dest_eid,
};
// NOTE: bpdu_size is still included here
hdr.hdr_len = aap_get_serialized_size(&msg) - payload_len;
hdr.data = malloc(hdr.hdr_len);
hdr->hdr_len = aap_get_serialized_size(&msg) - payload_len;
hdr->data = malloc(hdr->hdr_len);
ASSERT(hdr.data);
ASSERT(hdr.hdr_len != 0);
if (!hdr->data) {
free(bibe_bytes);
return -1;
}
aap_serialize_into(hdr.data, &msg, false);
ASSERT(hdr->data);
ASSERT(hdr->hdr_len != 0);
aap_serialize_into(hdr->data, &msg, false);
/* Appending the BPDU to the AAP message */
write_to_buffer(
hdr.data,
hdr->data,
bibe_bytes,
hdr.hdr_len - bpdu_size,
hdr->hdr_len - bpdu_size,
bpdu_size
);
free(bibe_bytes);
return hdr;
return 0;
}

View file

@ -128,6 +128,10 @@ enum ud3tn_result cla_initialize_all(
return UD3TN_FAIL;
char *const cla_config_str_dup = strdup(cla_config_str);
if (!cla_config_str_dup)
return UD3TN_FAIL;
char *cur_cla_config = cla_config_str_dup;
char *comma = strchr(cur_cla_config, ';');
enum ud3tn_result result = UD3TN_FAIL;
@ -242,14 +246,18 @@ enum ud3tn_result cla_link_init(struct cla_link *link,
// Notify the BP task of the newly established connection...
const struct bundle_agent_interface *bundle_agent_interface =
config->bundle_agent_interface;
char *peer_cla_addr = cla_get_cla_addr_from_link(link);
if (!peer_cla_addr) {
LOG_ERROR("CLA: Failed to get CLA address from link.");
goto fail_rx_task;
}
bundle_processor_inform(
bundle_agent_interface->bundle_signaling_queue,
(struct bundle_processor_signal) {
.type = BP_SIGNAL_NEW_LINK_ESTABLISHED,
.peer_cla_addr = cla_get_cla_addr_from_link(
link
),
.peer_cla_addr = peer_cla_addr,
}
);
}
@ -291,13 +299,18 @@ void cla_link_cleanup(struct cla_link *link)
const struct bundle_agent_interface *bundle_agent_interface =
link->config->bundle_agent_interface;
bundle_processor_inform(
bundle_agent_interface->bundle_signaling_queue,
(struct bundle_processor_signal) {
.type = BP_SIGNAL_LINK_DOWN,
.peer_cla_addr = cla_get_cla_addr_from_link(link),
}
);
char *peer_cla_addr = cla_get_cla_addr_from_link(link);
if (peer_cla_addr)
bundle_processor_inform(
bundle_agent_interface->bundle_signaling_queue,
(struct bundle_processor_signal) {
.type = BP_SIGNAL_LINK_DOWN,
.peer_cla_addr = peer_cla_addr,
}
);
else
LOG_ERROR("CLA: Failed to get CLA address from link.");
// Clean up semaphores
hal_semaphore_delete(link->rx_task_sem);
@ -358,18 +371,24 @@ char *cla_get_cla_addr_from_link(const struct cla_link *const link)
const size_t result_len = cla_name_len + 1 + addr_len + 1;
char *const result = malloc(result_len);
ASSERT(
snprintf(result, result_len, "%s", cla_name) ==
(int64_t)cla_name_len
);
if (!result)
return NULL;
int written;
written = snprintf(result, result_len, "%s", cla_name);
ASSERT(written == (int64_t)cla_name_len);
result[cla_name_len] = ':';
if (addr)
ASSERT(snprintf(
if (addr) {
written = snprintf(
result + cla_name_len + 1,
result_len - 1 - cla_name_len,
"%s",
addr
) == (int64_t)addr_len);
);
ASSERT(written == (int64_t)addr_len);
}
result[result_len - 1] = '\0';
return result;

View file

@ -566,7 +566,11 @@ enum cla_begin_packet_result bibe_begin_packet(struct cla_link *link,
struct bibe_header hdr;
hdr = bibe_encode_header(dest_eid, length);
if (bibe_encode_header(dest_eid, length, &hdr) == -1) {
LOG_ERROR("BIBE: Header encoding failed.");
link->config->vtable->cla_disconnect_handler(link);
return CLA_BEGIN_PACKET_FAIL;
}
if (tcp_send_all(tcp_link->connection_socket,
hdr.data, hdr.hdr_len) == -1) {

View file

@ -264,6 +264,9 @@ static void handle_established_connection(
ASSERT(struct_size >= sizeof(struct cla_tcp_link));
struct cla_tcp_link *link = malloc(struct_size);
if (!link)
return;
ASSERT(!config->link);
config->link = link;
@ -275,15 +278,18 @@ static void handle_established_connection(
const struct bundle_agent_interface *bundle_agent_interface =
config->base.base.bundle_agent_interface;
bundle_processor_inform(
bundle_agent_interface->bundle_signaling_queue,
(struct bundle_processor_signal) {
.type = BP_SIGNAL_NEW_LINK_ESTABLISHED,
.peer_cla_addr = cla_get_cla_addr_from_link(
&link->base
),
}
);
char *peer_cla_addr = cla_get_cla_addr_from_link(&link->base);
if (peer_cla_addr)
bundle_processor_inform(
bundle_agent_interface->bundle_signaling_queue,
(struct bundle_processor_signal) {
.type = BP_SIGNAL_NEW_LINK_ESTABLISHED,
.peer_cla_addr = peer_cla_addr,
}
);
else
LOG_ERROR("CLA: Failed to get CLA address from link.");
cla_link_wait_cleanup(&link->base);
}

View file

@ -70,6 +70,11 @@ char *cla_tcp_sockaddr_to_cla_addr(struct sockaddr *const sockaddr,
);
char *const result = malloc(result_len);
if (!result) {
LOG_WARN("TCP: Memory allocation failed.");
return NULL;
}
snprintf(
result,
result_len,

View file

@ -70,6 +70,12 @@ Queue_t *queueCreate(unsigned int queue_length, unsigned int item_size)
// allocate enough memory to store the actual items
queue->abs_start = malloc(queue->item_length * queue->item_size);
if (!queue->abs_start) {
free(queue);
return NULL;
}
queue->abs_end = queue->abs_start + (
queue->item_length * queue->item_size);

View file

@ -37,8 +37,17 @@ static void begin_read_data_eid(
struct config_parser *parser, struct endpoint_list **target)
{
struct endpoint_list *new_entry = malloc(sizeof(struct endpoint_list));
if (!new_entry)
return;
char *new_eid = malloc(DEFAULT_EID_BUFFER_SIZE * sizeof(char));
if (!new_eid) {
free(new_entry);
return;
}
new_eid[0] = '\0';
new_entry->eid = new_eid;
new_entry->next = NULL;
@ -141,6 +150,9 @@ static void begin_read_contact(struct config_parser *parser)
{
struct contact_list *new_entry = malloc(sizeof(struct contact_list));
if (!new_entry)
return;
new_entry->next = NULL;
new_entry->data = contact_create(parser->router_command->data);
if (parser->current_contact == NULL)

View file

@ -301,6 +301,9 @@ struct bundle_block *bundle_block_dup(const struct bundle_block *b)
while (cur_ref != NULL) {
struct eid_list *new = malloc(sizeof(struct eid_list));
if (!new)
goto err;
new->eid = eid_dup(cur_ref->eid);
new->next = dup->eid_refs;
dup->eid_refs = new;
@ -495,7 +498,7 @@ struct bundle_unique_identifier bundle_get_unique_identifier(
};
}
void bundle_free_unique_identifier(struct bundle_unique_identifier *id)
void bundle_free_unique_identifier(const struct bundle_unique_identifier *id)
{
eid_free(id->source);
}

View file

@ -453,7 +453,7 @@ static void inform_link_status_change(
cla_addr
);
if (status == FIB_LINK_STATUS_DOWN) {
struct fib_link *const link = fib_lookup_cla_addr(ctx->fib, cla_addr);
const struct fib_link *const link = fib_lookup_cla_addr(ctx->fib, cla_addr);
const struct fib_entry entry = { .cla_addr = cla_addr };
// After Link deletion (by request), there is no node mapping anymore, but we need

View file

@ -125,25 +125,26 @@ char *eid_to_string2(const struct eid eid, const bool force_ipn_2_element)
if (ipn_eid == NULL)
return NULL;
if (localnode)
ASSERT(
snprintf(
ipn_eid,
ipn_len,
"ipn:!.%" PRIu64,
eid.ipn_eid.service_number
) + 1 == (ssize_t)ipn_len
int written;
if (localnode) {
written = snprintf(
ipn_eid,
ipn_len,
"ipn:!.%" PRIu64,
eid.ipn_eid.service_number
);
else
ASSERT(
snprintf(
ipn_eid,
ipn_len,
"ipn:%" PRIu64 ".%" PRIu64,
eid.ipn_eid.fully_qualified_node_number,
eid.ipn_eid.service_number
) + 1 == (ssize_t)ipn_len
ASSERT(written + 1 == (ssize_t)ipn_len);
} else {
written = snprintf(
ipn_eid,
ipn_len,
"ipn:%" PRIu64 ".%" PRIu64,
eid.ipn_eid.fully_qualified_node_number,
eid.ipn_eid.service_number
);
ASSERT(written + 1 == (ssize_t)ipn_len);
}
return ipn_eid;
} else if (eid.scheme == EID_SCHEME_IPN) {
// ipn 3-element format
@ -165,16 +166,15 @@ char *eid_to_string2(const struct eid eid, const bool force_ipn_2_element)
if (ipn_eid == NULL)
return NULL;
ASSERT(
snprintf(
ipn_eid,
ipn_len,
"ipn:%" PRIu32 ".%" PRIu32 ".%" PRIu64,
ipn_eid_allocator(eid.ipn_eid),
ipn_eid_node(eid.ipn_eid),
eid.ipn_eid.service_number
) + 1 == (ssize_t)ipn_len
const int written = snprintf(
ipn_eid,
ipn_len,
"ipn:%" PRIu32 ".%" PRIu32 ".%" PRIu64,
ipn_eid_allocator(eid.ipn_eid),
ipn_eid_node(eid.ipn_eid),
eid.ipn_eid.service_number
);
ASSERT(written + 1 == (ssize_t)ipn_len);
return ipn_eid;
} else if (eid.scheme == EID_SCHEME_UNKNOWN) {
return NULL;
@ -426,14 +426,13 @@ char *eid_get_agent_id_str(const struct eid eid)
result = malloc(result_len + 1); // + '\0'
if (!result)
return NULL;
ASSERT(
snprintf(
result,
result_len + 1,
"%" PRIu64,
eid.ipn_eid.service_number
) == (ssize_t)result_len
int written = snprintf(
result,
result_len + 1,
"%" PRIu64,
eid.ipn_eid.service_number
);
ASSERT(written == (ssize_t)result_len);
return result;
case EID_SCHEME_UNKNOWN:
return NULL;

View file

@ -15,6 +15,6 @@ struct bibe_header {
size_t bibe_parser_parse(const uint8_t *buffer, size_t length,
struct bibe_protocol_data_unit *bpdu);
struct bibe_header bibe_encode_header(const char *dest_eid, size_t payload_len);
int bibe_encode_header(const char *dest_eid, size_t payload_len, struct bibe_header *hdr);
#endif // CLA_BIBE_PROTO_H

View file

@ -472,7 +472,7 @@ enum ud3tn_result bundle_serialize(
struct bundle_unique_identifier bundle_get_unique_identifier(
const struct bundle *bundle);
void bundle_free_unique_identifier(struct bundle_unique_identifier *id);
void bundle_free_unique_identifier(const struct bundle_unique_identifier *id);
bool bundle_is_equal(
const struct bundle *bundle, const struct bundle_unique_identifier *id);
bool bundle_is_equal_parent(

View file

@ -38,13 +38,13 @@ docker build . \
docker build . \
--file test/dockerfiles/ci-python-clang \
--build-arg IMAGE=python:3.9-bookworm \
--tag ci-python-clang:3.9-bookworm
--build-arg IMAGE=python:3.10-trixie \
--tag ci-python-clang:3.10-trixie
docker build . \
--file test/dockerfiles/ci-python-clang \
--build-arg IMAGE=python:3.13-bookworm \
--tag ci-python-clang:3.13-bookworm
--build-arg IMAGE=python:3.14-trixie \
--tag ci-python-clang:3.14-trixie
echo "You may now push the images to the registry:"
echo "\$ docker tag ud3tn-ion-interop:<tag> registry.gitlab.com/d3tn/ud3tn-docker-images/ion-interop:<tag>"

View file

@ -6,7 +6,7 @@ FROM $IMAGE
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y clang clang-tidy-13 netcat-openbsd cppcheck valgrind sqlite3 libjansson-dev && \
apt-get install -y clang clang-tidy netcat-openbsd cppcheck valgrind sqlite3 libjansson-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

View file

@ -28,7 +28,7 @@ TEST(bibe_header_encoder, get_encoded_size)
{
struct bibe_header hdr;
hdr = bibe_encode_header("dtn://ud3tn.dtn", 90);
bibe_encode_header("dtn://ud3tn.dtn", 90, &hdr);
TEST_ASSERT_EQUAL(EXPECTED_HEADER_LENGTH, hdr.hdr_len);
@ -39,7 +39,7 @@ TEST(bibe_header_encoder, encode_header)
{
struct bibe_header hdr;
hdr = bibe_encode_header("dtn://ud3tn.dtn", 90);
bibe_encode_header("dtn://ud3tn.dtn", 90, &hdr);
TEST_ASSERT_EQUAL_UINT8_ARRAY(
valid_header_bytes,