From: Arran Cudbard-Bell Date: Sun, 12 May 2024 19:58:42 +0000 (-0600) Subject: migrate/combine proto module bootstrance and instantiate functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dff3cb9e2a12b90bdb1dd0e888e72148a5492aa9;p=thirdparty%2Ffreeradius-server.git migrate/combine proto module bootstrance and instantiate functions --- diff --git a/src/listen/arp/proto_arp.c b/src/listen/arp/proto_arp.c index 68de97f4b7c..324a6b621fd 100644 --- a/src/listen/arp/proto_arp.c +++ b/src/listen/arp/proto_arp.c @@ -222,27 +222,6 @@ static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf * - -1 on failure. */ static int mod_instantiate(module_inst_ctx_t const *mctx) -{ - proto_arp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_arp_t); - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - return 0; -} - - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) { proto_arp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_arp_t); CONF_SECTION *conf = mctx->mi->conf; @@ -253,6 +232,11 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->server_cs = cf_item_to_section(cf_parent(conf)); inst->cs = conf; + if (!inst->num_messages) inst->num_messages = 256; + + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + return 0; } @@ -278,7 +262,6 @@ fr_app_t proto_arp = { .inst_size = sizeof(proto_arp_t), .onload = mod_load, .unload = mod_unload, - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .dict = &dict_arp, diff --git a/src/listen/arp/proto_arp_ethernet.c b/src/listen/arp/proto_arp_ethernet.c index 61df2da0572..63b09eddaf4 100644 --- a/src/listen/arp/proto_arp_ethernet.c +++ b/src/listen/arp/proto_arp_ethernet.c @@ -216,7 +216,7 @@ static char const *mod_name(fr_listen_t *li) } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_arp_ethernet_t *inst = talloc_get_type_abort(mctx->mi->data, proto_arp_ethernet_t); @@ -225,7 +225,6 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) return 0; } - fr_app_io_t proto_arp_ethernet = { .common = { .magic = MODULE_MAGIC_INIT, @@ -233,7 +232,7 @@ fr_app_io_t proto_arp_ethernet = { .config = arp_listen_config, .inst_size = sizeof(proto_arp_ethernet_t), .thread_inst_size = sizeof(proto_arp_ethernet_thread_t), - .bootstrap = mod_bootstrap, + .bootstrap = mod_instantiate }, .default_message_size = FR_ARP_PACKET_SIZE, diff --git a/src/listen/bfd/proto_bfd.c b/src/listen/bfd/proto_bfd.c index f8a2f428cfe..e4e609d1718 100644 --- a/src/listen/bfd/proto_bfd.c +++ b/src/listen/bfd/proto_bfd.c @@ -307,44 +307,6 @@ static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf inst->max_packet_size, inst->num_messages); } -/** Instantiate the application - * - * Instantiate I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_instantiate(module_inst_ctx_t const *mctx) -{ - proto_bfd_t *inst = talloc_get_type_abort(mctx->mi->data, proto_bfd_t); - - /* - * No IO module, it's an empty listener. - */ - if (!inst->io.submodule) return 0; - - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); - - /* - * Instantiate the master io submodule - */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - - /** Bootstrap the application * * Bootstrap I/O and type submodules. @@ -353,7 +315,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) * - 0 on success. * - -1 on failure. */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_bfd_t *inst = talloc_get_type_abort(mctx->mi->data, proto_bfd_t); CONF_SECTION *server; @@ -481,9 +443,23 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) } /* - * Bootstrap the master IO handler. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. + */ + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + + if (!inst->num_messages) inst->num_messages = 256; + + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + + /* + * Instantiate the master io submodule */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); } static int mod_load(void) @@ -508,7 +484,6 @@ fr_app_t proto_bfd = { .inst_size = sizeof(proto_bfd_t), .onload = mod_load, .unload = mod_unload, - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .dict = &dict_bfd, diff --git a/src/listen/bfd/proto_bfd_udp.c b/src/listen/bfd/proto_bfd_udp.c index ca5d9db8dc8..14d7211c313 100644 --- a/src/listen/bfd/proto_bfd_udp.c +++ b/src/listen/bfd/proto_bfd_udp.c @@ -353,7 +353,7 @@ static char const *mod_name(fr_listen_t *li) } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_bfd_udp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_bfd_udp_t); CONF_SECTION *conf = mctx->mi->conf; @@ -520,7 +520,7 @@ fr_app_io_t proto_bfd_udp = { .config = udp_listen_config, .inst_size = sizeof(proto_bfd_udp_t), .thread_inst_size = sizeof(proto_bfd_udp_thread_t), - .bootstrap = mod_bootstrap + .instantiate = mod_instantiate }, .default_message_size = FR_BFD_HEADER_LENGTH + 64, /* enough for some auth packets */ .track_duplicates = false, diff --git a/src/listen/control/proto_control.c b/src/listen/control/proto_control.c index 16fc75749c5..25816f62839 100644 --- a/src/listen/control/proto_control.c +++ b/src/listen/control/proto_control.c @@ -95,41 +95,6 @@ static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_control_t *inst = talloc_get_type_abort(mctx->mi->data, proto_control_t); - - fr_assert(inst->io.submodule != NULL); - - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); - - /* - * Instantiate the master io submodule - */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_control_t *inst = talloc_get_type_abort(mctx->mi->data, proto_control_t); CONF_SECTION *conf = mctx->mi->conf; /* @@ -166,9 +131,23 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->io.mi = mctx->mi; /* - * Bootstrap the master IO handler. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + + if (!inst->num_messages) inst->num_messages = 256; + + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + + /* + * Instantiate the master io submodule + */ + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); } fr_app_t proto_control = { @@ -177,7 +156,6 @@ fr_app_t proto_control = { .name = "control", .config = proto_control_config, .inst_size = sizeof(proto_control_t), - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .open = mod_open, diff --git a/src/listen/control/proto_control_unix.c b/src/listen/control/proto_control_unix.c index 17d06e1d835..d6b9bbf91db 100644 --- a/src/listen/control/proto_control_unix.c +++ b/src/listen/control/proto_control_unix.c @@ -578,7 +578,7 @@ static char const *mod_name(fr_listen_t *li) } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_control_unix_t *inst = talloc_get_type_abort(mctx->mi->data, proto_control_unix_t); CONF_SECTION *conf = mctx->mi->conf; @@ -681,7 +681,7 @@ fr_app_io_t proto_control_unix = { .config = unix_listen_config, .inst_size = sizeof(proto_control_unix_t), .thread_inst_size = sizeof(proto_control_unix_thread_t), - .bootstrap = mod_bootstrap, + .instantiate = mod_instantiate }, .default_message_size = 4096, diff --git a/src/listen/cron/cron.c b/src/listen/cron/cron.c index 84f673ce2f4..786073cf8c8 100644 --- a/src/listen/cron/cron.c +++ b/src/listen/cron/cron.c @@ -398,6 +398,15 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf) FILE *fp; bool done; + /* + * The listener is inside of a virtual server. + */ + inst->server_cs = cf_item_to_section(cf_parent(conf)); + inst->cs = conf; + inst->self = &proto_cron; + + virtual_server_dict_set(inst->server_cs, inst->dict, false); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); @@ -424,40 +433,12 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf) return 0; } - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @param[in] instance Ctx data for this application. - * @param[in] conf Listen section parsed to give us instance. - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(void *instance, CONF_SECTION *conf) -{ - proto_cron_t *inst = talloc_get_type_abort(instance, proto_cron_t); - - /* - * The listener is inside of a virtual server. - */ - inst->server_cs = cf_item_to_section(cf_parent(conf)); - inst->cs = conf; - inst->self = &proto_cron; - - virtual_server_dict_set(inst->server_cs, inst->dict, false); - - return 0; -} - fr_app_t proto_cron = { .magic = RLM_MODULE_INIT, .name = "cron", .config = proto_cron_config, .inst_size = sizeof(proto_cron_t), - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, .open = mod_open, }; diff --git a/src/listen/cron/proto_cron.c b/src/listen/cron/proto_cron.c index 62fa54a7311..05f5c7c9490 100644 --- a/src/listen/cron/proto_cron.c +++ b/src/listen/cron/proto_cron.c @@ -177,40 +177,6 @@ static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_cron_t *inst = talloc_get_type_abort(mctx->mi->data, proto_cron_t); - - fr_assert(inst->io.submodule); - - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); - - /* - * Instantiate the master io submodule - */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_cron_t *inst = talloc_get_type_abort(mctx->mi->data, proto_cron_t); CONF_SECTION *conf = mctx->mi->conf; /* @@ -245,11 +211,24 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->io.mi = mctx->mi; /* - * Bootstrap the master IO handler. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); -} + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + if (!inst->num_messages) inst->num_messages = 256; + + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + + /* + * Instantiate the master io submodule + */ + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); +} fr_app_t proto_cron = { .common = { @@ -257,8 +236,6 @@ fr_app_t proto_cron = { .name = "cron", .config = proto_cron_config, .inst_size = sizeof(proto_cron_t), - - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .open = mod_open, diff --git a/src/listen/cron/proto_cron_crontab.c b/src/listen/cron/proto_cron_crontab.c index 3c1278c6f0a..44dafff1e85 100644 --- a/src/listen/cron/proto_cron_crontab.c +++ b/src/listen/cron/proto_cron_crontab.c @@ -677,17 +677,6 @@ static char const *mod_name(fr_listen_t *li) return thread->name; } - -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_cron_crontab_t *inst = talloc_get_type_abort(mctx->mi->data, proto_cron_crontab_t); - - inst->parent = talloc_get_type_abort(mctx->mi->parent->data, proto_cron_t); - inst->cs = mctx->mi->conf; - - return 0; -} - static fr_client_t *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) { proto_cron_crontab_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_cron_crontab_t); @@ -695,7 +684,6 @@ static fr_client_t *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *i return inst->client; } - static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_cron_crontab_t *inst = talloc_get_type_abort(mctx->mi->data, proto_cron_crontab_t); @@ -705,6 +693,9 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) FILE *fp; bool done = false; + inst->parent = talloc_get_type_abort(mctx->mi->parent->data, proto_cron_t); + inst->cs = mctx->mi->conf; + fr_pair_list_init(&inst->pair_list); inst->client = client = talloc_zero(inst, fr_client_t); if (!inst->client) return 0; @@ -745,7 +736,6 @@ fr_app_io_t proto_cron_crontab = { .config = crontab_listen_config, .inst_size = sizeof(proto_cron_crontab_t), .thread_inst_size = sizeof(proto_cron_crontab_thread_t), - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .default_message_size = 4096, diff --git a/src/listen/detail/proto_detail.c b/src/listen/detail/proto_detail.c index c5ed83013a8..7fe5890b888 100644 --- a/src/listen/detail/proto_detail.c +++ b/src/listen/detail/proto_detail.c @@ -33,7 +33,9 @@ #include "lib/server/module.h" extern fr_app_t proto_detail; + static int type_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule); +static int transport_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule); #if 0 /* @@ -52,7 +54,7 @@ static conf_parser_t const proto_detail_config[] = { { FR_CONF_OFFSET_TYPE_FLAGS("type", FR_TYPE_VOID, CONF_FLAG_NOT_EMPTY | CONF_FLAG_REQUIRED, proto_detail_t, type), .func = type_parse }, { FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_detail_t, io_submodule), - .func = virtual_sever_listen_transport_parse, .dflt = "file" }, + .func = transport_parse, .dflt = "file" }, /* * Add this as a synonym so normal humans can understand it. @@ -147,6 +149,63 @@ static int type_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM return 0; } +static int transport_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule) +{ + proto_detail_t *inst = talloc_get_type_abort(parent, proto_detail_t); + + if (unlikely(virtual_sever_listen_transport_parse(ctx, out, parent, ci, rule) < 0)) { + return -1; + } + + /* + * If we're not loading the work submodule directly, then try to load it here. + */ + if (strcmp(inst->io_submodule->module->dl->name, "proto_detail_work") != 0) { + CONF_SECTION *transport_cs; + module_instance_t *parent_inst; + + inst->work_submodule = NULL; + + transport_cs = cf_section_find(inst->cs, "work", NULL); + parent_inst = cf_data_value(cf_data_find(inst->cs, module_instance_t, "proto_detail")); + fr_assert(parent_inst); + + if (!transport_cs) { + transport_cs = cf_section_dup(inst->cs, inst->cs, inst->app_io_conf, + "work", NULL, false); + if (!transport_cs) { + cf_log_err(inst->cs, "Failed to create configuration for worker"); + return -1; + } + } + + /* + * This *should* get bootstrapped at some point after this module + * as it's inserted into the three the caller is iterating over. + * + * We might want to revisit this, and use a linked list of modules + * to iterate over instead of a tree, so we can add this to the end + * of that list. + */ + inst->work_submodule = module_instance_alloc(parent_inst->ml, parent_inst, DL_MODULE_TYPE_SUBMODULE, + "work", module_instance_name_from_conf(transport_cs), 0); + if (inst->work_submodule == NULL) { + error: + cf_log_perr(inst->cs, "Failed to load proto_detail_work"); + TALLOC_FREE(inst->work_submodule); + return -1; + } + + if (module_instance_conf_parse(inst->work_submodule, transport_cs) < 0) goto error; + + inst->work_io = (fr_app_io_t const *) inst->work_submodule->exported; + inst->work_io_instance = inst->work_submodule->data; + inst->work_io_conf = inst->work_submodule->conf; + } + + return 0; +} + /** Decode the packet, and set the request->process function * */ @@ -460,59 +519,6 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) proto_detail_t *inst = talloc_get_type_abort(mctx->mi->data, proto_detail_t); CONF_SECTION *conf = mctx->mi->conf; - /* - * Instantiate the I/O module. But DON'T instantiate the - * work submodule. We leave that until later. - */ - if (inst->app_io->common.instantiate && - (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->io_submodule)) < 0)) { - cf_log_err(conf, "Instantiation failed for \"%s\"", inst->app_io->common.name); - return -1; - } - - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size) inst->max_packet_size = inst->app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 2; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 2); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65536); - - if (!inst->priority) inst->priority = PRIORITY_NORMAL; - - /* - * If the IO is "file" and not the worker, instantiate the worker now. - */ - if (strcmp(inst->io_submodule->module->dl->name, "proto_detail_work") != 0) { - if (inst->work_io->common.instantiate && - (inst->work_io->common.instantiate(MODULE_INST_CTX(inst->work_submodule)) < 0)) { - cf_log_err(inst->work_io_conf, "Instantiation failed for \"%s\"", inst->work_io->common.name); - return -1; - } - } - - return 0; -} - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_detail_t *inst = talloc_get_type_abort(mctx->mi->data, proto_detail_t); - CONF_SECTION *conf = mctx->mi->conf; - /* * The listener is inside of a virtual server. */ @@ -537,55 +543,24 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->app_io_conf = inst->io_submodule->conf; /* - * If we're not loading the work submodule directly, then try to load it here. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. */ - if (strcmp(inst->io_submodule->module->dl->name, "proto_detail_work") != 0) { - CONF_SECTION *transport_cs; - module_instance_t *parent_inst; - - inst->work_submodule = NULL; - - transport_cs = cf_section_find(inst->cs, "work", NULL); - parent_inst = cf_data_value(cf_data_find(inst->cs, module_instance_t, "proto_detail")); - fr_assert(parent_inst); + if (!inst->max_packet_size) inst->max_packet_size = inst->app_io->default_message_size; - if (!transport_cs) { - transport_cs = cf_section_dup(inst->cs, inst->cs, inst->app_io_conf, - "work", NULL, false); - if (!transport_cs) { - cf_log_err(inst->cs, "Failed to create configuration for worker"); - return -1; - } - } + if (!inst->num_messages) inst->num_messages = 2; - /* - * This *should* get bootstrapped at some point after this module - * as it's inserted into the three the caller is iterating over. - * - * We might want to revisit this, and use a linked list of modules - * to iterate over instead of a tree, so we can add this to the end - * of that list. - */ - inst->work_submodule = module_instance_alloc(parent_inst->ml, parent_inst, DL_MODULE_TYPE_SUBMODULE, - "work", module_instance_name_from_conf(transport_cs), 0); - if (inst->work_submodule == NULL) { - error: - cf_log_perr(inst->cs, "Failed to load proto_detail_work"); - TALLOC_FREE(inst->work_submodule); - return -1; - } + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 2); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - if (module_instance_conf_parse(inst->work_submodule, transport_cs) < 0) goto error; + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65536); - inst->work_io = (fr_app_io_t const *) inst->work_submodule->exported; - inst->work_io_instance = inst->work_submodule->data; - inst->work_io_conf = inst->work_submodule->conf; - } + if (!inst->priority) inst->priority = PRIORITY_NORMAL; return 0; } - fr_app_t proto_detail = { .common = { .magic = MODULE_MAGIC_INIT, @@ -593,7 +568,6 @@ fr_app_t proto_detail = { .config = proto_detail_config, .inst_size = sizeof(proto_detail_t), - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, }, .open = mod_open, diff --git a/src/listen/detail/proto_detail_file.c b/src/listen/detail/proto_detail_file.c index 2f46154f2e5..663ba8cb66b 100644 --- a/src/listen/detail/proto_detail_file.c +++ b/src/listen/detail/proto_detail_file.c @@ -622,10 +622,30 @@ static char const *mod_name(fr_listen_t *li) } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static fr_rb_tree_t *detail_file_tree = NULL; +static pthread_mutex_t detail_file_mutex = PTHREAD_MUTEX_INITIALIZER; + +/** Compare two thread instances based on node pointer + * + * @param[in] one First thread specific xlat expansion instance. + * @param[in] two Second thread specific xlat expansion instance. + * @return CMP(one, two) + */ +static int8_t _detail_file_cmp(void const *one, void const *two) +{ + proto_detail_file_t const *a = one, *b = two; + + return CMP(strcmp(a->filename, b->filename), 0); +} + +/* + * Check for multiple readers on the same set of files. + */ +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_detail_file_t *inst = talloc_get_type_abort(mctx->mi->data, proto_detail_file_t); CONF_SECTION *conf = mctx->mi->conf; + module_instance_t const *mi; char *p; @@ -693,33 +713,6 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->parent->exit_when_done = false; } - return 0; -} - -static fr_rb_tree_t *detail_file_tree = NULL; -static pthread_mutex_t detail_file_mutex = PTHREAD_MUTEX_INITIALIZER; - -/** Compare two thread instances based on node pointer - * - * @param[in] one First thread specific xlat expansion instance. - * @param[in] two Second thread specific xlat expansion instance. - * @return CMP(one, two) - */ -static int8_t _detail_file_cmp(void const *one, void const *two) -{ - proto_detail_file_t const *a = one, *b = two; - - return CMP(strcmp(a->filename, b->filename), 0); -} - -/* - * Check for multiple readers on the same set of files. - */ -static int mod_instantiate(module_inst_ctx_t const *mctx) -{ - proto_detail_file_t *inst = talloc_get_type_abort(mctx->mi->data, proto_detail_file_t); - CONF_SECTION *conf = mctx->mi->conf; - pthread_mutex_lock(&detail_file_mutex); if (!detail_file_tree) { detail_file_tree = fr_rb_inline_talloc_alloc(conf, proto_detail_file_t, filename_node, _detail_file_cmp, NULL); @@ -790,7 +783,6 @@ fr_app_io_t proto_detail_file = { .config = file_listen_config, .inst_size = sizeof(proto_detail_file_t), .thread_inst_size = sizeof(proto_detail_file_thread_t), - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate, }, .default_message_size = 65536, diff --git a/src/listen/detail/proto_detail_work.c b/src/listen/detail/proto_detail_work.c index f5af01f7652..f2a5a39a9f5 100644 --- a/src/listen/detail/proto_detail_work.c +++ b/src/listen/detail/proto_detail_work.c @@ -846,23 +846,6 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_detail_work_t *inst = talloc_get_type_abort(mctx->mi->data, proto_detail_work_t); fr_client_t *client; - - client = inst->client = talloc_zero(inst, fr_client_t); - if (!inst->client) return 0; - - client->ipaddr.af = AF_INET; - client->ipaddr.addr.v4.s_addr = htonl(INADDR_NONE); - client->src_ipaddr = client->ipaddr; - - client->longname = client->shortname = client->secret = inst->filename; - client->nas_type = talloc_strdup(client, "other"); - - return 0; -} - -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_detail_work_t *inst = talloc_get_type_abort(mctx->mi->data, proto_detail_work_t); CONF_SECTION *cs = mctx->mi->conf; module_instance_t const *mi = mctx->mi; @@ -894,10 +877,19 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) FR_INTEGER_BOUND_CHECK("limit.max_outstanding", inst->max_outstanding, >=, 1); + client = inst->client = talloc_zero(inst, fr_client_t); + if (!inst->client) return 0; + + client->ipaddr.af = AF_INET; + client->ipaddr.addr.v4.s_addr = htonl(INADDR_NONE); + client->src_ipaddr = client->ipaddr; + + client->longname = client->shortname = client->secret = inst->filename; + client->nas_type = talloc_strdup(client, "other"); + return 0; } - /** Private interface for use by proto_detail_file * */ @@ -909,7 +901,6 @@ fr_app_io_t proto_detail_work = { .config = file_listen_config, .inst_size = sizeof(proto_detail_work_t), .thread_inst_size = sizeof(proto_detail_work_thread_t), - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .default_message_size = 65536, diff --git a/src/listen/dhcpv4/proto_dhcpv4.c b/src/listen/dhcpv4/proto_dhcpv4.c index 7b70406f96d..10e9900af76 100644 --- a/src/listen/dhcpv4/proto_dhcpv4.c +++ b/src/listen/dhcpv4/proto_dhcpv4.c @@ -366,55 +366,36 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) proto_dhcpv4_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dhcpv4_t); /* - * No IO module, it's an empty listener. + * Ensure that the server CONF_SECTION is always set. */ - if (!inst->io.submodule) return 0; + inst->io.server_cs = cf_item_to_section(cf_parent(mctx->mi->conf)); + + fr_assert(dict_dhcpv4 != NULL); + fr_assert(attr_message_type != NULL); /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. + * No IO module, it's an empty listener. */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + if (!inst->io.submodule) return 0; /* - * Instantiate the master io submodule + * Tell the master handler about the main protocol instance. */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_dhcpv4_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dhcpv4_t); + inst->io.app = &proto_dhcpv4; + inst->io.app_instance = inst; /* - * Ensure that the server CONF_SECTION is always set. + * We will need this for dynamic clients and connected sockets. */ - inst->io.server_cs = cf_item_to_section(cf_parent(mctx->mi->conf)); - - fr_assert(dict_dhcpv4 != NULL); - fr_assert(attr_message_type != NULL); + inst->io.mi = mctx->mi; /* - * No IO module, it's an empty listener. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. */ - if (!inst->io.submodule) return 0; + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + + if (!inst->num_messages) inst->num_messages = 256; /* * These timers are usually protocol specific. @@ -428,21 +409,16 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) FR_TIME_DELTA_BOUND_CHECK("cleanup_delay", inst->io.cleanup_delay, <=, fr_time_delta_from_sec(30)); FR_TIME_DELTA_BOUND_CHECK("cleanup_delay", inst->io.cleanup_delay, >, fr_time_delta_from_sec(0)); - /* - * Tell the master handler about the main protocol instance. - */ - inst->io.app = &proto_dhcpv4; - inst->io.app_instance = inst; + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - /* - * We will need this for dynamic clients and connected sockets. - */ - inst->io.mi = mctx->mi; + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); /* - * Bootstrap the master IO handler. + * Instantiate the master io submodule */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); } static int mod_load(void) @@ -470,7 +446,6 @@ fr_app_t proto_dhcpv4 = { .onload = mod_load, .unload = mod_unload, - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .dict = &dict_dhcpv4, diff --git a/src/listen/dhcpv4/proto_dhcpv4_udp.c b/src/listen/dhcpv4/proto_dhcpv4_udp.c index 5bcbb91a32d..ba1598399df 100644 --- a/src/listen/dhcpv4/proto_dhcpv4_udp.c +++ b/src/listen/dhcpv4/proto_dhcpv4_udp.c @@ -669,7 +669,7 @@ static char const *mod_name(fr_listen_t *li) } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_dhcpv4_udp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dhcpv4_udp_t); CONF_SECTION *conf = mctx->mi->conf; @@ -824,7 +824,7 @@ fr_app_io_t proto_dhcpv4_udp = { .config = udp_listen_config, .inst_size = sizeof(proto_dhcpv4_udp_t), .thread_inst_size = sizeof(proto_dhcpv4_udp_thread_t), - .bootstrap = mod_bootstrap, + .instantiate = mod_instantiate, }, .default_message_size = 4096, .track_duplicates = true, diff --git a/src/listen/dhcpv6/proto_dhcpv6.c b/src/listen/dhcpv6/proto_dhcpv6.c index bcc6c7a6fa4..e000980eb9b 100644 --- a/src/listen/dhcpv6/proto_dhcpv6.c +++ b/src/listen/dhcpv6/proto_dhcpv6.c @@ -346,43 +346,6 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_dhcpv6_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dhcpv6_t); - /* - * No IO module, it's an empty listener. - */ - if (!inst->io.submodule) return 0; - - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); - - /* - * Instantiate the master io submodule - */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_dhcpv6_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dhcpv6_t); - /* * Ensure that the server CONF_SECTION is always set. */ @@ -420,9 +383,23 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->io.mi = mctx->mi; /* - * Bootstrap the master IO handler. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. + */ + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + + if (!inst->num_messages) inst->num_messages = 256; + + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + + /* + * Instantiate the master io submodule */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); } static int mod_load(void) @@ -449,7 +426,6 @@ fr_app_t proto_dhcpv6 = { .onload = mod_load, .unload = mod_unload, - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .dict = &dict_dhcpv6, diff --git a/src/listen/dhcpv6/proto_dhcpv6_udp.c b/src/listen/dhcpv6/proto_dhcpv6_udp.c index dba46e651f5..8703c3b60c7 100644 --- a/src/listen/dhcpv6/proto_dhcpv6_udp.c +++ b/src/listen/dhcpv6/proto_dhcpv6_udp.c @@ -467,7 +467,7 @@ static char const *mod_name(fr_listen_t *li) } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_dhcpv6_udp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dhcpv6_udp_t); size_t num; @@ -670,7 +670,7 @@ fr_app_io_t proto_dhcpv6_udp = { .config = udp_listen_config, .inst_size = sizeof(proto_dhcpv6_udp_t), .thread_inst_size = sizeof(proto_dhcpv6_udp_thread_t), - .bootstrap = mod_bootstrap + .instantiate = mod_instantiate }, .default_message_size = 4096, .track_duplicates = true, diff --git a/src/listen/dns/proto_dns.c b/src/listen/dns/proto_dns.c index c1f1fb016e3..00885468edb 100644 --- a/src/listen/dns/proto_dns.c +++ b/src/listen/dns/proto_dns.c @@ -295,43 +295,6 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_dns_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dns_t); - /* - * No IO module, it's an empty listener. - */ - if (!inst->io.submodule) return 0; - - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 64); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); - - /* - * Instantiate the master io submodule - */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_dns_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dns_t); - /* * Ensure that the server CONF_SECTION is always set. */ @@ -363,9 +326,23 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->io.mi = mctx->mi; /* - * Bootstrap the master IO handler. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + + if (!inst->num_messages) inst->num_messages = 256; + + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 64); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + + /* + * Instantiate the master io submodule + */ + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); } static int mod_load(void) @@ -392,8 +369,6 @@ fr_app_t proto_dns = { .onload = mod_load, .unload = mod_unload, - - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .dict = &dict_dns, diff --git a/src/listen/dns/proto_dns_udp.c b/src/listen/dns/proto_dns_udp.c index 307863c3445..46e6b856aec 100644 --- a/src/listen/dns/proto_dns_udp.c +++ b/src/listen/dns/proto_dns_udp.c @@ -338,7 +338,7 @@ static char const *mod_name(fr_listen_t *li) } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_dns_udp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dns_udp_t); CONF_SECTION *conf = mctx->mi->conf; @@ -450,7 +450,7 @@ fr_app_io_t proto_dns_udp = { .config = udp_listen_config, .inst_size = sizeof(proto_dns_udp_t), .thread_inst_size = sizeof(proto_dns_udp_thread_t), - .bootstrap = mod_bootstrap + .instantiate = mod_instantiate }, .default_message_size = 576, .track_duplicates = false, diff --git a/src/listen/ldap_sync/proto_ldap_sync.c b/src/listen/ldap_sync/proto_ldap_sync.c index a8007699898..7cd5157c353 100644 --- a/src/listen/ldap_sync/proto_ldap_sync.c +++ b/src/listen/ldap_sync/proto_ldap_sync.c @@ -253,15 +253,22 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) } }; - /* - * Instantiate the I/O module. - */ - if (inst->app_io->common.instantiate && - (inst->app_io->common.instantiate(MODULE_INST_CTX(inst->io_submodule)) < 0)) { - cf_log_err(conf, "Instantiation failed for \"%s\"", inst->app_io->common.name); + inst->server_cs = cf_item_to_section(cf_parent(conf)); + inst->cs = conf; + inst->self = &proto_ldap_sync; + + if (!inst->io_submodule) { + cf_log_err(conf, "Virtual server for LDAP sync requires a 'transport' configuration"); return -1; } + /* + * Bootstrap the I/O module + */ + inst->app_io = (fr_app_io_t const *) inst->io_submodule->exported; + inst->app_io_instance = inst->io_submodule->data; + inst->app_io_conf = inst->io_submodule->conf; + /* * These configuration items are not printed by default, * because normal people shouldn't be touching them. @@ -365,38 +372,12 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) return 0; } -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_ldap_sync_t *inst = talloc_get_type_abort(mctx->mi->data, proto_ldap_sync_t); - CONF_SECTION *conf = mctx->mi->conf; - - inst->server_cs = cf_item_to_section(cf_parent(conf)); - inst->cs = conf; - inst->self = &proto_ldap_sync; - - if (!inst->io_submodule) { - cf_log_err(conf, "Virtual server for LDAP sync requires a 'transport' configuration"); - return -1; - } - - /* - * Bootstrap the I/O module - */ - inst->app_io = (fr_app_io_t const *) inst->io_submodule->exported; - inst->app_io_instance = inst->io_submodule->data; - inst->app_io_conf = inst->io_submodule->conf; - - return 0; -} - fr_app_t proto_ldap_sync = { .common = { .magic = MODULE_MAGIC_INIT, .name = "ldap_sync", .config = proto_ldap_sync_config, .inst_size = sizeof(proto_ldap_sync_t), - - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, diff --git a/src/listen/ldap_sync/proto_ldap_sync_ldap.c b/src/listen/ldap_sync/proto_ldap_sync_ldap.c index 99c5443c93d..34e0e4df14a 100644 --- a/src/listen/ldap_sync/proto_ldap_sync_ldap.c +++ b/src/listen/ldap_sync/proto_ldap_sync_ldap.c @@ -1288,6 +1288,14 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) */ fr_assert(inst->server); + inst->parent = talloc_get_type_abort(mctx->mi->parent->data, proto_ldap_sync_t); + inst->cs = conf; + + if (inst->recv_buff_is_set) { + FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, >=, 32); + FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, <=, INT_MAX); + } + server = inst->server; inst->handle_config.server = talloc_strdup(inst, ""); @@ -1305,23 +1313,6 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) return 0; } -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_ldap_sync_ldap_t *inst = talloc_get_type_abort(mctx->mi->data, proto_ldap_sync_ldap_t); - CONF_SECTION *conf = mctx->mi->conf; - module_instance_t const *mi = mctx->mi; - - inst->parent = talloc_get_type_abort(mi->parent->data, proto_ldap_sync_t); - inst->cs = conf; - - if (inst->recv_buff_is_set) { - FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, >=, 32); - FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, <=, INT_MAX); - } - - return 0; -} - fr_app_io_t proto_ldap_sync_child = { .common = { .magic = MODULE_MAGIC_INIT, @@ -1342,8 +1333,6 @@ fr_app_io_t proto_ldap_sync_ldap = { .config = proto_ldap_sync_ldap_config, .inst_size = sizeof(proto_ldap_sync_ldap_t), .thread_inst_size = sizeof(proto_ldap_sync_ldap_thread_t), - - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, diff --git a/src/listen/load/proto_load.c b/src/listen/load/proto_load.c index 15403244a91..fc43f3bf1e1 100644 --- a/src/listen/load/proto_load.c +++ b/src/listen/load/proto_load.c @@ -187,40 +187,6 @@ static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_load_t *inst = talloc_get_type_abort(mctx->mi->data, proto_load_t); - - fr_assert(inst->io.submodule); - - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); - - /* - * Instantiate the master io submodule - */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_load_t *inst = talloc_get_type_abort(mctx->mi->data, proto_load_t); CONF_SECTION *conf = mctx->mi->conf; /* @@ -256,11 +222,24 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->io.mi = mctx->mi; /* - * Bootstrap the master IO handler. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); -} + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + + if (!inst->num_messages) inst->num_messages = 256; + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + + /* + * Instantiate the master io submodule + */ + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); +} fr_app_t proto_load = { .common = { @@ -269,7 +248,6 @@ fr_app_t proto_load = { .config = proto_load_config, .inst_size = sizeof(proto_load_t), - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .open = mod_open, diff --git a/src/listen/load/proto_load_step.c b/src/listen/load/proto_load_step.c index f9253823754..f5363df40f7 100644 --- a/src/listen/load/proto_load_step.c +++ b/src/listen/load/proto_load_step.c @@ -336,52 +336,13 @@ static char const *mod_name(fr_listen_t *li) return thread->name; } - -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_load_step_t *inst = talloc_get_type_abort(mctx->mi->data, proto_load_step_t); - CONF_SECTION *conf = mctx->mi->conf; - module_instance_t const *mi = mctx->mi; - - inst->parent = talloc_get_type_abort(mi->parent->data, proto_load_t); - inst->cs = conf; - - FR_INTEGER_BOUND_CHECK("start_pps", inst->load.start_pps, >=, 10); - FR_INTEGER_BOUND_CHECK("start_pps", inst->load.start_pps, <, 400000); - - FR_INTEGER_BOUND_CHECK("step", inst->load.step, >=, 1); - FR_INTEGER_BOUND_CHECK("step", inst->load.step, <, 100000); - - if (inst->load.max_pps > 0) FR_INTEGER_BOUND_CHECK("max_pps", inst->load.max_pps, >, inst->load.start_pps); - FR_INTEGER_BOUND_CHECK("max_pps", inst->load.max_pps, <, 100000); - - FR_TIME_DELTA_BOUND_CHECK("duration", inst->load.duration, >=, fr_time_delta_from_sec(1)); - FR_TIME_DELTA_BOUND_CHECK("duration", inst->load.duration, <, fr_time_delta_from_sec(10000)); - - - FR_INTEGER_BOUND_CHECK("parallel", inst->load.parallel, >=, 1); - FR_INTEGER_BOUND_CHECK("parallel", inst->load.parallel, <, 1000); - - FR_INTEGER_BOUND_CHECK("max_backlog", inst->load.milliseconds, >=, 1); - FR_INTEGER_BOUND_CHECK("max_backlog", inst->load.milliseconds, <, 100000); - - return 0; -} - -static fr_client_t *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) -{ - proto_load_step_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_load_step_t); - - return inst->client; -} - - static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_load_step_t *inst = talloc_get_type_abort(mctx->mi->data, proto_load_step_t); CONF_SECTION *conf = mctx->mi->conf; fr_client_t *client; fr_pair_t *vp; + module_instance_t const *mi = mctx->mi; fr_pair_list_init(&inst->pair_list); inst->client = client = talloc_zero(inst, fr_client_t); @@ -418,9 +379,38 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) vp = fr_pair_find_by_da(&inst->pair_list, NULL, inst->parent->attr_packet_type); if (vp) inst->code = vp->vp_uint32; + inst->parent = talloc_get_type_abort(mi->parent->data, proto_load_t); + inst->cs = conf; + + FR_INTEGER_BOUND_CHECK("start_pps", inst->load.start_pps, >=, 10); + FR_INTEGER_BOUND_CHECK("start_pps", inst->load.start_pps, <, 400000); + + FR_INTEGER_BOUND_CHECK("step", inst->load.step, >=, 1); + FR_INTEGER_BOUND_CHECK("step", inst->load.step, <, 100000); + + if (inst->load.max_pps > 0) FR_INTEGER_BOUND_CHECK("max_pps", inst->load.max_pps, >, inst->load.start_pps); + FR_INTEGER_BOUND_CHECK("max_pps", inst->load.max_pps, <, 100000); + + FR_TIME_DELTA_BOUND_CHECK("duration", inst->load.duration, >=, fr_time_delta_from_sec(1)); + FR_TIME_DELTA_BOUND_CHECK("duration", inst->load.duration, <, fr_time_delta_from_sec(10000)); + + + FR_INTEGER_BOUND_CHECK("parallel", inst->load.parallel, >=, 1); + FR_INTEGER_BOUND_CHECK("parallel", inst->load.parallel, <, 1000); + + FR_INTEGER_BOUND_CHECK("max_backlog", inst->load.milliseconds, >=, 1); + FR_INTEGER_BOUND_CHECK("max_backlog", inst->load.milliseconds, <, 100000); + return 0; } +static fr_client_t *mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) +{ + proto_load_step_t const *inst = talloc_get_type_abort_const(li->app_io_instance, proto_load_step_t); + + return inst->client; +} + fr_app_io_t proto_load_step = { .common = { .magic = MODULE_MAGIC_INIT, @@ -428,7 +418,6 @@ fr_app_io_t proto_load_step = { .config = load_listen_config, .inst_size = sizeof(proto_load_step_t), .thread_inst_size = sizeof(proto_load_step_thread_t), - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .default_message_size = 4096, diff --git a/src/listen/radius/proto_radius.c b/src/listen/radius/proto_radius.c index dfbddfd7bad..488f1f362cf 100644 --- a/src/listen/radius/proto_radius.c +++ b/src/listen/radius/proto_radius.c @@ -415,9 +415,6 @@ static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf { proto_radius_t *inst = talloc_get_type_abort(instance, proto_radius_t); - inst->io.app = &proto_radius; - inst->io.app_instance = instance; - /* * io.app_io should already be set */ @@ -442,49 +439,6 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) */ if (!inst->io.submodule) return 0; - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); - - /* - * Instantiate the master io submodule - */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_radius_t *inst = talloc_get_type_abort(mctx->mi->data, proto_radius_t); - - /* - * Ensure that the server CONF_SECTION is always set. - */ - inst->io.server_cs = cf_item_to_section(cf_parent(mctx->mi->conf)); - - /* - * No IO module, it's an empty listener. - */ - if (!inst->io.submodule) return 0; - /* * These timers are usually protocol specific. */ @@ -506,6 +460,25 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) } #endif + /* + * Ensure that the server CONF_SECTION is always set. + */ + inst->io.server_cs = cf_item_to_section(cf_parent(mctx->mi->conf)); + + /* + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. + */ + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + + if (!inst->num_messages) inst->num_messages = 256; + + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + /* * Tell the master handler about the main protocol instance. */ @@ -518,9 +491,9 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->io.mi = mctx->mi; /* - * Bootstrap the master IO handler. + * Instantiate the master io submodule */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); } /** Get the authentication vector. @@ -577,7 +550,6 @@ fr_app_t proto_radius = { .inst_size = sizeof(proto_radius_t), .onload = mod_load, .unload = mod_unload, - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .dict = &dict_radius, diff --git a/src/listen/radius/proto_radius_tcp.c b/src/listen/radius/proto_radius_tcp.c index 70713aefc1e..fe357e11335 100644 --- a/src/listen/radius/proto_radius_tcp.c +++ b/src/listen/radius/proto_radius_tcp.c @@ -430,8 +430,7 @@ static char const *mod_name(fr_listen_t *li) return thread->name; } - -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_radius_tcp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_radius_tcp_t); CONF_SECTION *conf = mctx->mi->conf; @@ -667,7 +666,7 @@ fr_app_io_t proto_radius_tcp = { .config = tcp_listen_config, .inst_size = sizeof(proto_radius_tcp_t), .thread_inst_size = sizeof(proto_radius_tcp_thread_t), - .bootstrap = mod_bootstrap, + .instantiate = mod_instantiate, }, .default_message_size = 4096, diff --git a/src/listen/radius/proto_radius_udp.c b/src/listen/radius/proto_radius_udp.c index 4f70102d6b7..a7f948ba9a9 100644 --- a/src/listen/radius/proto_radius_udp.c +++ b/src/listen/radius/proto_radius_udp.c @@ -70,7 +70,7 @@ typedef struct { bool dynamic_clients; //!< whether we have dynamic clients bool dedup_authenticator; //!< dedup using the request authenticator - fr_client_list_t *clients; //!< local clients + fr_client_list_t *clients; //!< local clients fr_trie_t *trie; //!< for parsed networks fr_ipaddr_t *allow; //!< allowed networks for dynamic clients @@ -434,7 +434,7 @@ static char const *mod_name(fr_listen_t *li) } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_radius_udp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_radius_udp_t); CONF_SECTION *conf = mctx->mi->conf; @@ -547,7 +547,7 @@ fr_app_io_t proto_radius_udp = { .config = udp_listen_config, .inst_size = sizeof(proto_radius_udp_t), .thread_inst_size = sizeof(proto_radius_udp_thread_t), - .bootstrap = mod_bootstrap + .instantiate = mod_instantiate }, .default_message_size = 4096, .track_duplicates = true, diff --git a/src/listen/tacacs/proto_tacacs.c b/src/listen/tacacs/proto_tacacs.c index 8acae229e6a..bec40e3e917 100644 --- a/src/listen/tacacs/proto_tacacs.c +++ b/src/listen/tacacs/proto_tacacs.c @@ -452,44 +452,6 @@ static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_tacacs_t *inst = talloc_get_type_abort(mctx->mi->data, proto_tacacs_t); - /* - * No IO module, it's an empty listener. - */ - if (!inst->io.submodule) return 0; - - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); - - /* - * Instantiate the master io submodule - */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_tacacs_t *inst = talloc_get_type_abort(mctx->mi->data, proto_tacacs_t); - /* * Ensure that the server CONF_SECTION is always set. */ @@ -523,9 +485,23 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->io.mi = mctx->mi; /* - * Bootstrap the master IO handler. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + + if (!inst->num_messages) inst->num_messages = 256; + + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + + /* + * Instantiate the master io submodule + */ + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); } static int mod_load(void) @@ -552,7 +528,6 @@ fr_app_t proto_tacacs = { .onload = mod_load, .unload = mod_unload, - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .dict = &dict_tacacs, diff --git a/src/listen/tacacs/proto_tacacs_tcp.c b/src/listen/tacacs/proto_tacacs_tcp.c index f02442e3f5e..c0d4caf9d65 100644 --- a/src/listen/tacacs/proto_tacacs_tcp.c +++ b/src/listen/tacacs/proto_tacacs_tcp.c @@ -398,7 +398,7 @@ static char const *mod_name(fr_listen_t *li) return thread->name; } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_tacacs_tcp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_tacacs_tcp_t); CONF_SECTION *conf = mctx->mi->conf; @@ -507,7 +507,7 @@ fr_app_io_t proto_tacacs_tcp = { .config = tcp_listen_config, .inst_size = sizeof(proto_tacacs_tcp_t), .thread_inst_size = sizeof(proto_tacacs_tcp_thread_t), - .bootstrap = mod_bootstrap, + .instantiate = mod_instantiate, }, .default_message_size = 4096, .track_duplicates = false, diff --git a/src/listen/vmps/proto_vmps.c b/src/listen/vmps/proto_vmps.c index 6a775dff662..086e16264fa 100644 --- a/src/listen/vmps/proto_vmps.c +++ b/src/listen/vmps/proto_vmps.c @@ -313,44 +313,6 @@ static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_vmps_t *inst = talloc_get_type_abort(mctx->mi->data, proto_vmps_t); - - /* - * No IO module, it's an empty listener. - */ - if (!inst->io.submodule) return 0; - - /* - * These configuration items are not printed by default, - * because normal people shouldn't be touching them. - */ - if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; - - if (!inst->num_messages) inst->num_messages = 256; - - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); - - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); - FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); - - /* - * Instantiate the master io submodule - */ - return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); -} - - -/** Bootstrap the application - * - * Bootstrap I/O and type submodules. - * - * @return - * - 0 on success. - * - -1 on failure. - */ -static int mod_bootstrap(module_inst_ctx_t const *mctx) -{ - proto_vmps_t *inst = talloc_get_type_abort(mctx->mi->data, proto_vmps_t); CONF_SECTION *conf = mctx->mi->conf; /* @@ -387,9 +349,23 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) inst->io.mi = mctx->mi; /* - * Bootstrap the master IO handler. + * These configuration items are not printed by default, + * because normal people shouldn't be touching them. */ - return fr_master_app_io.common.bootstrap(MODULE_INST_CTX(inst->io.mi)); + if (!inst->max_packet_size && inst->io.app_io) inst->max_packet_size = inst->io.app_io->default_message_size; + + if (!inst->num_messages) inst->num_messages = 256; + + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); + + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); + FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65535); + + /* + * Instantiate the master io submodule + */ + return fr_master_app_io.common.instantiate(MODULE_INST_CTX(inst->io.mi)); } static int mod_load(void) @@ -416,7 +392,6 @@ fr_app_t proto_vmps = { .onload = mod_load, .unload = mod_unload, - .bootstrap = mod_bootstrap, .instantiate = mod_instantiate }, .dict = &dict_vmps, diff --git a/src/listen/vmps/proto_vmps_udp.c b/src/listen/vmps/proto_vmps_udp.c index 40986a5e1ea..e31a9e7d63a 100644 --- a/src/listen/vmps/proto_vmps_udp.c +++ b/src/listen/vmps/proto_vmps_udp.c @@ -388,7 +388,7 @@ static int mod_track_compare(UNUSED void const *instance, UNUSED void *thread_in return (a->opcode < b->opcode) - (a->opcode > b->opcode); } -static int mod_bootstrap(module_inst_ctx_t const *mctx) +static int mod_instantiate(module_inst_ctx_t const *mctx) { proto_vmps_udp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_vmps_udp_t); CONF_SECTION *conf = mctx->mi->conf; @@ -510,7 +510,7 @@ fr_app_io_t proto_vmps_udp = { .config = udp_listen_config, .inst_size = sizeof(proto_vmps_udp_t), .thread_inst_size = sizeof(proto_vmps_udp_thread_t), - .bootstrap = mod_bootstrap, + .instantiate = mod_instantiate, }, .default_message_size = 4096, .track_duplicates = true,