From: Nick Porter Date: Fri, 29 Aug 2025 17:03:20 +0000 (+0100) Subject: Pass trigger_args to trunk_alloc X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c08dca20c72500f4e052272b80b87c7230df8a22;p=thirdparty%2Ffreeradius-server.git Pass trigger_args to trunk_alloc --- diff --git a/src/lib/ldap/connection.c b/src/lib/ldap/connection.c index 5ebb19a827..fbcd793e20 100644 --- a/src/lib/ldap/connection.c +++ b/src/lib/ldap/connection.c @@ -956,7 +956,7 @@ fr_ldap_thread_trunk_t *fr_thread_ldap_trunk_get(fr_ldap_thread_t *thread, char .request_fail = ldap_request_fail, }, thread->trunk_conf, - "rlm_ldap", found, false); + "rlm_ldap", found, false, thread->trigger_args); if (!found->trunk) { error: @@ -1313,7 +1313,7 @@ fr_ldap_thread_trunk_t *fr_thread_ldap_bind_trunk_get(fr_ldap_thread_t *thread) .request_fail = ldap_trunk_bind_auth_fail, }, thread->bind_trunk_conf, - "rlm_ldap bind auth", ttrunk, false); + "rlm_ldap bind auth", ttrunk, false, thread->bind_trigger_args); if (!ttrunk->trunk) { ERROR("Unable to create LDAP connection"); diff --git a/src/lib/server/trunk.c b/src/lib/server/trunk.c index a776b6d812..f10ff42eed 100644 --- a/src/lib/server/trunk.c +++ b/src/lib/server/trunk.c @@ -4961,7 +4961,7 @@ static int _trunk_free(trunk_t *trunk) */ trunk_t *trunk_alloc(TALLOC_CTX *ctx, fr_event_list_t *el, trunk_io_funcs_t const *funcs, trunk_conf_t const *conf, - char const *log_prefix, void const *uctx, bool delay_start) + char const *log_prefix, void const *uctx, bool delay_start, fr_pair_list_t *trigger_args) { trunk_t *trunk; size_t i; @@ -4974,6 +4974,7 @@ trunk_t *trunk_alloc(TALLOC_CTX *ctx, fr_event_list_t *el, MEM(trunk = talloc_zero(ctx, trunk_t)); trunk->el = el; trunk->log_prefix = talloc_strdup(trunk, log_prefix); + trunk->trigger_args = trigger_args; memcpy(&trunk->funcs, funcs, sizeof(trunk->funcs)); if (!trunk->funcs.connection_prioritise) { diff --git a/src/lib/server/trunk.h b/src/lib/server/trunk.h index 2d9c9d92eb..6f1466b589 100644 --- a/src/lib/server/trunk.h +++ b/src/lib/server/trunk.h @@ -911,9 +911,10 @@ void trunk_connection_manage_stop(trunk_t *trunk) CC_HINT(nonnull); int trunk_connection_manage_schedule(trunk_t *trunk) CC_HINT(nonnull); -trunk_t *trunk_alloc(TALLOC_CTX *ctx, fr_event_list_t *el, +trunk_t *trunk_alloc(TALLOC_CTX *ctx, fr_event_list_t *el, trunk_io_funcs_t const *funcs, trunk_conf_t const *conf, - char const *log_prefix, void const *uctx, bool delay_start) CC_HINT(nonnull(2, 3, 4)); + char const *log_prefix, void const *uctx, bool delay_start, + fr_pair_list_t *trigger_args) CC_HINT(nonnull(2, 3, 4)); /** @} */ /** @name Watchers diff --git a/src/lib/server/trunk_tests.c b/src/lib/server/trunk_tests.c index b8458efbbd..8756827668 100644 --- a/src/lib/server/trunk_tests.c +++ b/src/lib/server/trunk_tests.c @@ -372,7 +372,7 @@ static trunk_t *test_setup_trunk(TALLOC_CTX *ctx, fr_event_list_t *el, trunk_con */ if (with_cancel_mux) io_funcs.request_cancel_mux = test_cancel_mux; - return trunk_alloc(ctx, el, &io_funcs, conf, "test_socket_pair", uctx, false); + return trunk_alloc(ctx, el, &io_funcs, conf, "test_socket_pair", uctx, false, NULL); } static void test_socket_pair_alloc_then_free(void) @@ -397,7 +397,7 @@ static void test_socket_pair_alloc_then_free(void) fr_timer_list_set_time_func(el->tl, test_time); - trunk = trunk_alloc(ctx, el, &io_funcs, &conf, "test_socket_pair", NULL, false); + trunk = trunk_alloc(ctx, el, &io_funcs, &conf, "test_socket_pair", NULL, false, NULL); TEST_CHECK(trunk != NULL); if (!trunk) return; @@ -439,7 +439,7 @@ static void test_socket_pair_alloc_then_reconnect_then_free(void) fr_timer_list_set_time_func(el->tl, test_time); - trunk = trunk_alloc(ctx, el, &io_funcs, &conf, "test_socket_pair", NULL, false); + trunk = trunk_alloc(ctx, el, &io_funcs, &conf, "test_socket_pair", NULL, false, NULL); TEST_CHECK(trunk != NULL); if (!trunk) return; @@ -528,7 +528,7 @@ static void test_socket_pair_alloc_then_connect_timeout(void) fr_timer_list_set_time_func(el->tl, test_time); - trunk = trunk_alloc(ctx, el, &io_funcs, &conf, "test_socket_pair", NULL, false); + trunk = trunk_alloc(ctx, el, &io_funcs, &conf, "test_socket_pair", NULL, false, NULL); TEST_CHECK(trunk != NULL); if (!trunk) return; @@ -608,7 +608,7 @@ static void test_socket_pair_alloc_then_reconnect_check_delay(void) el = fr_event_list_alloc(ctx, NULL, NULL); fr_timer_list_set_time_func(el->tl, test_time); - trunk = trunk_alloc(ctx, el, &io_funcs, &conf, "test_socket_pair", NULL, false); + trunk = trunk_alloc(ctx, el, &io_funcs, &conf, "test_socket_pair", NULL, false, NULL); TEST_CHECK(trunk != NULL); if (!trunk) return; diff --git a/src/modules/rlm_radius/bio.c b/src/modules/rlm_radius/bio.c index 6d7179322f..e81346458b 100644 --- a/src/modules/rlm_radius/bio.c +++ b/src/modules/rlm_radius/bio.c @@ -2702,7 +2702,7 @@ static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx) } thread->ctx.trunk = trunk_alloc(thread, mctx->el, &io_funcs, - &inst->trunk_conf, inst->name, thread, false); + &inst->trunk_conf, inst->name, thread, false, inst->trigger_args); if (!thread->ctx.trunk) return -1; return 0; @@ -2713,7 +2713,7 @@ static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx) if (inst->fd_config.socket_type == SOCK_DGRAM) break; thread->ctx.trunk = trunk_alloc(thread, mctx->el, &io_replicate_funcs, - &inst->trunk_conf, inst->name, thread, false); + &inst->trunk_conf, inst->name, thread, false, inst->trigger_args); if (!thread->ctx.trunk) return -1; return 0; @@ -2976,7 +2976,7 @@ static xlat_action_t xlat_radius_client(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcurso * Allocate the trunk and start it up. */ home->ctx.trunk = trunk_alloc(home, unlang_interpret_event_list(request), &io_funcs, - &inst->trunk_conf, inst->name, home, false); + &inst->trunk_conf, inst->name, home, false, inst->trigger_args); if (!home->ctx.trunk) { fail: talloc_free(home); diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index 2b9838d690..e8fec97366 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -2408,7 +2408,7 @@ static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx) t->inst = inst; t->trunk = trunk_alloc(t, mctx->el, &inst->driver->trunk_io_funcs, - &inst->config.trunk_conf, inst->name, t, false); + &inst->config.trunk_conf, inst->name, t, false, inst->trigger_args); if (!t->trunk) return -1; return 0; diff --git a/src/modules/rlm_tacacs/rlm_tacacs_tcp.c b/src/modules/rlm_tacacs/rlm_tacacs_tcp.c index 29d35c3387..6d88be9981 100644 --- a/src/modules/rlm_tacacs/rlm_tacacs_tcp.c +++ b/src/modules/rlm_tacacs/rlm_tacacs_tcp.c @@ -1463,7 +1463,7 @@ static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx) thread->el = mctx->el; thread->inst = inst; thread->trunk = trunk_alloc(thread, mctx->el, &io_funcs, - &inst->parent->trunk_conf, inst->parent->name, thread, false); + &inst->parent->trunk_conf, inst->parent->name, thread, false, inst->trigger_args); if (!thread->trunk) return -1; return 0;