From: Alan T. DeKok Date: Mon, 24 Feb 2020 15:21:14 +0000 (-0500) Subject: pass udp_thread_t instead of other ctx X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dffc5fe4c540bbd015b893b11e33fb799b23facd;p=thirdparty%2Ffreeradius-server.git pass udp_thread_t instead of other ctx --- diff --git a/src/modules/rlm_radius/rlm_radius_udp.c b/src/modules/rlm_radius/rlm_radius_udp.c index 698b2959d4b..89f4d58ee72 100644 --- a/src/modules/rlm_radius/rlm_radius_udp.c +++ b/src/modules/rlm_radius/rlm_radius_udp.c @@ -217,10 +217,6 @@ fr_dict_attr_autoload_t rlm_radius_udp_dict_attr[] = { { NULL } }; -typedef struct { - rlm_radius_udp_t const *inst; - udp_thread_t *thread; -} udp_conn_uctx_t; /** Initialise a new outbound connection * @@ -232,13 +228,13 @@ static fr_connection_state_t conn_init(void **h_out, fr_connection_t *conn, void { int fd; udp_handle_t *h; - udp_conn_uctx_t *our_ctx = uctx; + udp_thread_t *thread = talloc_get_type_abort(uctx, udp_thread_t); h = talloc_zero(conn, udp_handle_t); if (!h) return FR_CONNECTION_STATE_FAILED; - h->inst = our_ctx->inst; - h->thread = our_ctx->thread; + h->thread = thread; + h->inst = thread->inst; h->module_name = h->inst->parent->name; h->src_ipaddr = h->inst->src_ipaddr; h->src_port = 0; @@ -503,7 +499,6 @@ static fr_connection_t *thread_conn_alloc(fr_trunk_connection_t *tconn, fr_event { udp_connection_t *c; udp_thread_t *thread = talloc_get_type_abort(uctx, udp_thread_t); - udp_handle_t *h; c = talloc_zero(tconn, udp_connection_t); if (!c) return NULL; @@ -519,16 +514,13 @@ static fr_connection_t *thread_conn_alloc(fr_trunk_connection_t *tconn, fr_event }, conf, log_prefix, - &(udp_conn_uctx_t){ .inst = thread->inst, .thread = thread }); + thread); if (!c->conn) { talloc_free(c); PERROR("Failed allocating state handler for new connection"); return NULL; } - h = c->conn->h; - h->c = c; //!< REMOVE - return c->conn; }