29 RCSID(
"$Id: a9150ac497fb48719805801cc2ce1d9e4898437e $")
31 #include <freeradius-devel/server/base.h>
32 #include <freeradius-devel/server/cf_file.h>
33 #include <freeradius-devel/server/global_lib.h>
34 #include <freeradius-devel/server/modpriv.h>
35 #include <freeradius-devel/server/module_rlm.h>
36 #include <freeradius-devel/server/radmin.h>
37 #include <freeradius-devel/server/request_data.h>
38 #include <freeradius-devel/server/module.h>
39 #include <freeradius-devel/util/strerror.h>
40 #include <freeradius-devel/util/talloc.h>
41 #include <freeradius-devel/unlang/xlat_func.h>
72 .help =
"Show the status of a particular module.",
77 .parent =
"show module",
81 .help =
"Show configuration for a module",
87 .parent =
"set module",
90 .syntax =
"(alive|disallow|fail|reject|handled|invalid|notfound|noop|ok|updated)",
92 .help =
"Change module status to fixed value.",
103 .help =
"Show information about modules.",
110 .parent =
"show module",
113 .help =
"Show the list of modules loaded in the server.",
120 .help =
"Change module settings.",
141 fr_cmd_info_t *info,
int max_expansions,
char const **expansions)
146 if (info->
argc <= 0)
return 0;
154 if (
count >= max_expansions) {
171 fprintf(fp,
"\t%s\n", mi->
name);
182 fprintf(fp,
"alive\n");
196 if (strcmp(info->
argv[0],
"alive") == 0) {
203 fprintf(fp_err,
"Unknown status '%s'\n", info->
argv[0]);
217 [
'-'] =
true, [
'/'] =
true, [
'_'] =
true, [
'.'] =
true,
218 [
'0'] =
true, [
'1'] =
true, [
'2'] =
true, [
'3'] =
true, [
'4'] =
true,
219 [
'5'] =
true, [
'6'] =
true, [
'7'] =
true, [
'8'] =
true, [
'9'] =
true,
220 [
'A'] =
true, [
'B'] =
true, [
'C'] =
true, [
'D'] =
true, [
'E'] =
true,
221 [
'F'] =
true, [
'G'] =
true, [
'H'] =
true, [
'I'] =
true, [
'J'] =
true,
222 [
'K'] =
true, [
'L'] =
true, [
'M'] =
true, [
'N'] =
true, [
'O'] =
true,
223 [
'P'] =
true, [
'Q'] =
true, [
'R'] =
true, [
'S'] =
true, [
'T'] =
true,
224 [
'U'] =
true, [
'V'] =
true, [
'W'] =
true, [
'X'] =
true, [
'Y'] =
true,
226 [
'a'] =
true, [
'b'] =
true, [
'c'] =
true, [
'd'] =
true, [
'e'] =
true,
227 [
'f'] =
true, [
'g'] =
true, [
'h'] =
true, [
'i'] =
true, [
'j'] =
true,
228 [
'k'] =
true, [
'l'] =
true, [
'm'] =
true, [
'n'] =
true, [
'o'] =
true,
229 [
'p'] =
true, [
'q'] =
true, [
'r'] =
true, [
's'] =
true, [
't'] =
true,
230 [
'u'] =
true, [
'v'] =
true, [
'w'] =
true, [
'x'] =
true, [
'y'] =
true,
375 if (ret != 0)
return 0;
422 ERROR(
"Failed inserting into global module index");
447 size_t i, len = talloc_array_length(til);
448 unsigned int found = 0;
450 for (i = 0; i < len; i++)
if (til[i]) found++;
453 "Thread local array has %u non-null elements remaining on exit. This is a leak",
499 "module instance index %u must be <= thread local array %zu",
503 "mismatch between global module heap (%u entries) and thread local (%zu entries)",
515 fr_assert_msg(ti->
mi == mi,
"thread/module mismatch thread %s (%p), module %s (%p)",
653 static inline CC_HINT(always_inline)
656 if ((pool->start == NULL) || !mi->ml->write_protect)
return 0;
658 DEBUG3(
"Protecting data for module \"%s\" %p-%p",
659 mi->name, pool->start, ((
uint8_t *)pool->start + pool->len - 1));
661 if (
unlikely(mprotect(pool->start, pool->len, PROT_READ) < 0)) {
676 static inline CC_HINT(always_inline)
679 if ((pool->start == NULL) || !mi->ml->write_protect)
return 0;
681 DEBUG3(
"Unprotecting data for module \"%s\" %p-%p",
682 mi->name, pool->start, ((
uint8_t *)pool->start + pool->len - 1));
684 if (
unlikely(mprotect(pool->start, pool->len, PROT_READ | PROT_WRITE) < 0)) {
738 char const *inst_name;
776 cf_log_err(mi->
conf,
"Failed evaluating configuration for module \"%s\"",
795 int a_depth = 0, b_depth = 0;
798 #ifdef STATIC_ANALYZER
808 for (mi = a; mi; mi = mi->
parent) a_depth++;
809 for (mi = b; mi; mi = mi->
parent) b_depth++;
811 ret =
CMP(a_depth, b_depth);
812 if (ret != 0)
return ret;
815 if (ret != 0)
return ret;
877 cf_log_err(submodule_cs,
"Failed loading submodule");
882 cf_log_err(submodule_cs,
"Failed parsing submodule config");
905 char const *inst_name;
915 inst_name = asked_name;
916 if (inst_name[0] ==
'-') inst_name++;
920 .parent = UNCONST(module_instance_t *, parent),
923 if (!
inst)
return NULL;
963 .data = UNCONST(void *, data)
965 if (!mi)
return NULL;
984 if (!mi)
return NULL;
1053 DEBUG4(
"Cleaning up %s thread instance data (%p/%p)",
1118 talloc_set_name(ti->
data,
"%s_%s_thread_t",
1127 PERROR(
"Failed adding thread data for module \"%s\"", mi->
name);
1142 PERROR(
"Thread instantiation failed for module \"%s\"", mi->
name);
1226 PERROR(
"Failed registering radmin commands for module %s", mi->
name);
1236 mi->
conf) < 0))
return -1;
1286 DEBUG2(
"#### Instantiating %s modules ####", ml->
name);
1377 DEBUG2(
"#### Bootstrapping %s modules ####", ml->
name);
1496 ret = pthread_mutex_trylock(&mi->
mutex);
1498 pthread_mutex_unlock(&mi->
mutex);
1500 pthread_mutex_destroy(&mi->
mutex);
1521 talloc_free_children(mi);
1538 inst_name ? inst_name : src->
name, 0);
1539 if (!mi)
return NULL;
1553 static inline CC_HINT(always_inline)
1570 &pool_out->start, &pool_out->len,
1574 talloc_set_name(
data,
"%s_t", module->
dl->
name ? module->
dl->
name :
"config");
1600 size_t len = strlen(inst_name);
1602 for (
size_t i = 0; i < len; i++) {
1605 "Valid characters are [0-9a-zA-Z/_-]", inst_name);
1656 char *qual_inst_name = NULL;
1669 ERROR(
"Module name too long");
1683 ERROR(
"Duplicate %s_%s instance \"%s\", previous instance defined at %s[%d]",
1691 ERROR(
"Duplicate %s_%s instance \"%s\"",
1705 talloc_set_name_const(mi,
"module_instance_t");
1711 mi->
state = init_state;
1729 ERROR(
"Missing public structure for \"%s\"", qual_inst_name);
1858 char const *
name,
bool write_protect)
#define fr_atexit_thread_local(_name, _free, _uctx)
#define fr_atexit_global_once(_init, _free, _uctx)
#define UNCONST(_type, _ptr)
Remove const qualification from a pointer.
#define CMP(_a, _b)
Same as CMP_PREFER_SMALLER use when you don't really care about ordering, you just want an ordering.
int cf_section_write(FILE *fp, CONF_SECTION *cs, int depth)
int cf_section_parse(TALLOC_CTX *ctx, void *base, CONF_SECTION *cs)
Parse a configuration section into user-supplied variables.
int cf_section_parse_pass2(void *base, CONF_SECTION *cs)
Fixup xlat expansions and attributes.
void const * uctx
User data accessible by the cf_parse_t func.
#define cf_section_rules_push(_cs, _rule)
Defines a CONF_PAIR to C data type mapping.
Common header for all CONF_* types.
A section grouping multiple CONF_PAIR.
CONF_PAIR * cf_item_to_pair(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_PAIR.
CONF_SECTION * cf_section_find(CONF_SECTION const *cs, char const *name1, char const *name2)
Find a CONF_SECTION with name1 and optionally name2.
char const * cf_section_name2(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
char const * cf_pair_value(CONF_PAIR const *pair)
Return the value of a CONF_PAIR.
CONF_SECTION * cf_item_to_section(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_SECTION.
char const * cf_section_name1(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
#define cf_log_err(_cf, _fmt,...)
#define cf_data_add(_cf, _data, _name, _free)
#define cf_log_perr(_cf, _fmt,...)
#define cf_section_alloc(_ctx, _parent, _name1, _name2)
#define cf_log_debug(_cf, _fmt,...)
fr_command_register_hook_t fr_command_register_hook
bool fr_command_strncmp(const char *word, const char *name)
int argc
current argument count
char const * parent
e.g. "show module"
char const ** argv
text version of commands
fr_dcursor_eval_t void const * uctx
#define fr_cond_assert(_x)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
#define fr_assert_msg(_x, _msg,...)
Calls panic_action ifndef NDEBUG, else logs error and causes the server to exit immediately with code...
#define FR_FAULT_LOG(_fmt,...)
#define fr_cond_assert_msg(_x, _fmt,...)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
char const * name
Name of the module e.g. sql.
fr_table_num_sorted_t const dl_module_type_prefix[]
Name prefixes matching the types of loadable module.
dl_module_loader_t * dl_module_loader_init(char const *lib_dir)
Initialise structures needed by the dynamic linker.
dl_module_t * dl_module_alloc(dl_module_t const *parent, char const *name, dl_module_type_t type)
Load a module library using dlopen() or return a previously loaded module from the cache.
int dl_module_free(dl_module_t *dl_module)
Free a dl_module (when there are no more references to it)
Wrapper struct around dl_loader_t.
dl_t *_CONST dl
Dynamic loader handle.
dl_module_common_t * exported
Symbol exported by the module, containing its public functions, name and behaviour control flags.
dl_module_type_t _CONST type
of this module.
@ DL_MODULE_TYPE_PROTO
Protocol module.
@ DL_MODULE_TYPE_SUBMODULE
Driver (or method in the case of EAP)
@ DL_MODULE_TYPE_MODULE
Standard loadable module.
@ DL_MODULE_TYPE_PROCESS
protocol processor.
char const *_CONST name
Name of the module. The name passed to dl_module_alloc.
int global_lib_init(void)
Initialise the global list of external libraries.
int fr_heap_insert(fr_heap_t **hp, void *data)
Insert a new element into the heap.
int fr_heap_extract(fr_heap_t **hp, void *data)
Remove a node from the heap.
unsigned int fr_heap_index_t
#define fr_heap_alloc(_ctx, _cmp, _type, _field, _init)
Creates a heap that can be used with non-talloced elements.
static bool fr_heap_entry_inserted(fr_heap_index_t heap_idx)
Check if an entry is inserted into a heap.
static unsigned int fr_heap_num_elements(fr_heap_t *h)
Return the number of elements in the heap.
#define fr_heap_foreach(_heap, _type, _data)
Iterate over the contents of a heap.
Stores all information relating to an event list.
static char const * mod_name(fr_listen_t *li)
#define MODULE_DETACH_CTX(_mi)
Wrapper to create a module_detach_ctx_t as a compound literal.
#define MODULE_THREAD_INST_CTX(_mi, _thread, _el)
Wrapper to create a module_thread_inst_ctx_t as a compound literal.
#define MODULE_INST_CTX(_mi)
Wrapper to create a module_inst_ctx_t as a compound literal.
Temporary structure to hold arguments for thread_instantiation calls.
void fr_rb_iter_delete_inorder(fr_rb_iter_inorder_t *iter)
Remove the current node from the tree.
void * fr_rb_iter_next_inorder(fr_rb_iter_inorder_t *iter)
Return the next node.
void * fr_rb_iter_init_inorder(fr_rb_iter_inorder_t *iter, fr_rb_tree_t *tree)
Initialise an in-order iterator.
#define fr_rb_inline_alloc(_ctx, _type, _field, _data_cmp, _data_free)
Allocs a red black tree.
static bool fr_rb_node_inline_in_tree(fr_rb_node_t const *node)
Check to see if an item is in a tree by examining its inline fr_rb_node_t.
bool fr_rb_insert(fr_rb_tree_t *tree, void const *data)
bool fr_rb_delete(fr_rb_tree_t *tree, void const *data)
void * fr_rb_find(fr_rb_tree_t const *tree, void const *data)
Iterator structure for in-order traversal of an rbtree.
fr_table_num_sorted_t const rcode_table[]
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_NOT_SET
Error resolving rcode (should not be returned by modules).
#define fr_sbuff_start(_sbuff_or_marker)
#define FR_SBUFF_IN_CHAR_RETURN(_sbuff,...)
#define fr_sbuff_used(_sbuff_or_marker)
#define FR_SBUFF_IN_STRCPY_RETURN(...)
#define FR_SBUFF_TALLOC_THREAD_LOCAL(_out, _init, _max)
module_thread_instance_t *(* module_list_thread_data_get_t)(module_instance_t const *mi)
Callback to retrieve thread-local data for a module.
module_instance_t * mi
As opposed to the thread local inst.
char const * name
Instance name e.g. user_database.
@ MODULE_TYPE_DYNAMIC_UNSAFE
Instances of this module cannot be created at runtime.
@ MODULE_TYPE_THREAD_UNSAFE
Module is not threadsafe.
module_flags_t flags
Flags that control how a module starts up and how a module is called.
static module_thread_instance_t * module_thread(module_instance_t const *mi)
Retrieve module/thread specific instance for a module.
fr_rb_node_t name_node
Entry in the name tree.
CONF_SECTION * conf
Module's instance configuration.
size_t inst_size
Size of the module's instance data.
module_detach_t detach
Clean up module resources from the instantiation pahses.
bool force
Force the module to return a specific code.
void * data
Module's instance data.
module_instance_state_t state
What's been done with this module so far.
module_instance_t const * parent
Parent module's instance (if any).
module_thread_instantiate_t thread_instantiate
Callback to populate a new module thread instance data.
module_instantiate_t instantiate
Callback to allow the module to register any per-instance resources like sockets and file handles.
void * boot
Data allocated during the boostrap phase.
module_instance_state_t mask
Prevent phases from being executed.
dl_module_t * module
Dynamic loader handle.
#define MODULE_INSTANCE_LEN_MAX
The maximum size of a module instance.
void * data
Thread specific instance data.
module_data_pool_t inst_pool
Data to allow mprotect state toggling for instance data.
bool write_protect
If true, pages containing module boot or instance data will be write protected after bootstrapping an...
rlm_rcode_t code
Code module will return when 'force' has has been set to true.
char const * boot_type
talloc type to assign to bootstrap data.
char const * inst_type
talloc type to assign to instance data.
module_data_pool_t boot_pool
Data to allow mprotect state toggling for bootstrap data.
module_detach_t unstrap
Clean up module resources from both the bootstrap phase.
module_instance_state_t
What state the module instance is currently in.
@ MODULE_INSTANCE_INSTANTIATED
Module instance has been bootstrapped and instantiated.
@ MODULE_INSTANCE_NO_THREAD_INSTANTIATE
Not set internally, but can be used to prevent thread instantiation for certain modules.
@ MODULE_INSTANCE_BOOTSTRAPPED
Module instance has been bootstrapped, but not yet instantiated.
fr_rb_tree_t * data_tree
Modules indexed by data.
uint32_t number
Unique module number.
module_list_thread_data_get_t thread_data_get
Callback to get thread-specific data.
char const * thread_inst_type
talloc type to assign to thread instance data.
module_instantiate_t bootstrap
Callback to allow the module to register any global resources like xlat functions and attributes.
fr_rb_node_t data_node
Entry in the data tree.
module_thread_detach_t thread_detach
Callback to free thread-specific resources associated < with a module.
void * uctx
Extra data passed to module_instance_alloc.
size_t boot_size
Size of the module's bootstrap data.
module_list_t * ml
Module list this instance belongs to.
size_t thread_inst_size
Size of the module's thread-specific instance data.
conf_parser_t const * config
How to convert a CONF_SECTION to a module instance.
char const * name
Friendly list identifier.
fr_event_list_t * el
Event list associated with this thread.
module_list_type_t const * type
Type of module list.
uint32_t last_number
Last identifier assigned to a module instance.
fr_rb_tree_t * name_tree
Modules indexed by name.
module_t * exported
Public module structure.
pthread_mutex_t mutex
Used prevent multiple threads entering a thread unsafe module simultaneously.
Struct exported by a rlm_* module.
Per thread per instance data.
module_instance_t * module_instance_copy(module_list_t *dst, module_instance_t const *src, char const *inst_name)
Duplicate a module instance, placing it in a new module list.
static int mltl_thread_data_add(module_thread_instance_t *ti)
int module_instance_data_protect(module_instance_t const *mi)
Mark module data as read only.
static void module_thread_detach(module_thread_instance_t *ti)
void module_list_debug(module_list_t const *ml)
Print the contents of a module list.
module_list_type_t const module_list_type_thread_local
Callbacks for a thread local list.
void modules_init(char const *lib_dir)
Perform global initialisation for modules.
bool module_instance_skip_thread_instantiate(module_instance_t *mi)
Should we instantiate this module instance in a new thread?
module_instance_t * module_instance_by_name(module_list_t const *ml, module_instance_t const *parent, char const *asked_name)
Find an existing module instance by its name and parent.
static int module_data_unprotect(module_instance_t const *mi, module_data_pool_t const *pool)
Unprotect module data.
static int mlg_init(UNUSED module_list_t *ml)
Global initialisation for index heap and module array.
static int _module_dl_loader_free(UNUSED void *uctx)
module_list_free_t free
Free any global structures required for thread-local lookups.
static int _module_list_free(module_list_t *ml)
Free all modules loaded by the server.
module_thread_instance_t * ti
Thread-specific data.
char const * module_instance_root_prefix_str(module_instance_t const *mi)
Return the prefix string for the deepest module.
static int _module_instance_free(module_instance_t *mi)
Free module's instance data, and any xlats or paircmps.
module_instance_t * module_instance_root(module_instance_t const *child)
Find the module's shallowest parent.
static int module_data_protect(module_instance_t *mi, module_data_pool_t *pool)
Protect module data.
static void module_detach_parent(module_instance_t *mi)
Detach the shallowest parent first.
static int _module_thread_inst_list_free(void *tilp)
Free the thread local heap on exit.
void(* module_list_free_t)(module_list_t *ml)
Callback to free any global structures associated with the module list.
void module_list_mask_set(module_list_t *ml, module_instance_state_t mask)
Set a new bootstrap/instantiate state for a list.
static module_thread_instance_t * mlg_thread_data_get(module_instance_t const *mi)
Retrieve the thread-specific data for a module from the thread-local array of instance data.
static int cmd_show_module_status(FILE *fp, UNUSED FILE *fp_err, void *ctx, UNUSED fr_cmd_info_t const *info)
static int8_t module_instance_data_cmp(void const *one, void const *two)
Compare module's by their private instance data.
struct module_list_type_s::@65 thread
Callbacks to manage thread-local data.
fr_slen_t module_instance_name_from_conf(char const **name, CONF_SECTION *conf)
Avoid boilerplate when setting the module instance name.
static int8_t module_instance_name_cmp(void const *one, void const *two)
Compare module instances by parent and name.
void modules_thread_detach(module_list_t *ml)
Remove thread-specific data for a given module list.
static int mlg_data_add(module_instance_t *mi)
Add the unique index value so we can do thread local lookups.
module_list_data_add_t data_add
Record that module data has been added.
module_list_init_t init
Initialise any global structures required for thread-local lookups.
int modules_thread_instantiate(TALLOC_CTX *ctx, module_list_t const *ml, fr_event_list_t *el)
Creates per-thread instance data for modules which need it.
bool module_instance_skip_instantiate(module_instance_t *mi)
Should we instantiate this module instance?
static int cmd_show_module_list(FILE *fp, UNUSED FILE *fp_err, UNUSED void *uctx, UNUSED fr_cmd_info_t const *info)
static int module_name_tab_expand(UNUSED TALLOC_CTX *talloc_ctx, UNUSED void *uctx, fr_cmd_info_t *info, int max_expansions, char const **expansions)
void(* module_list_data_del_t)(module_instance_t *mi)
Callback to del data for a module.
size_t inst_size
Size of talloc chunk to allocate for the module_instance_t.
int(* module_list_thread_data_add_t)(module_thread_instance_t *ti)
Callback to add thread-local data for a module.
static void module_instance_data_alloc(TALLOC_CTX *ctx, module_data_pool_t *pool_out, void **out, module_instance_t *mi, size_t size, char const *type)
Allocate module instance data.
int modules_instantiate(module_list_t const *ml)
Completes instantiation of modules.
module_instance_t * module_instance_by_data(module_list_t const *ml, void const *data)
Find an existing module instance by its private instance data.
int(* module_list_init_t)(module_list_t *ml)
Callback to initialise any global structures required for the module list.
static void mlg_thread_data_del(module_thread_instance_t *ti)
static int mlg_thread_data_add(module_thread_instance_t *ti)
static int cmd_set_module_status(UNUSED FILE *fp, FILE *fp_err, void *ctx, fr_cmd_info_t const *info)
static int _module_dl_loader_init(void *uctx)
static module_thread_instance_t * mltl_thread_data_get(module_instance_t const *mi)
void(* module_list_thread_free_t)(module_list_t *ml)
Callback to free thread-local structures, called once per thread as the thread is being destroyed.
void module_instance_uctx_set(module_instance_t *mi, void *uctx)
Set the uctx pointer for a module instance.
static fr_slen_t module_instance_name(TALLOC_CTX *ctx, char **out, module_instance_t const *parent, char const *inst_name)
Generate a module name from the module's name and its parents.
module_thread_instance_t * module_thread_by_data(module_list_t const *ml, void const *data)
Retrieve module/thread specific instance data for a module.
static int cmd_show_module_config(FILE *fp, UNUSED FILE *fp_err, void *ctx, UNUSED fr_cmd_info_t const *info)
void(* module_list_thread_data_del_t)(module_thread_instance_t *ti)
Callback to remove thread-local data for a module.
fr_slen_t module_instance_name_valid(char const *inst_name)
Check to see if a module instance name is valid.
int module_instance_data_unprotect(module_instance_t const *mi)
Mark module data as read/write.
static int _module_thread_inst_free(module_thread_instance_t *ti)
Callback to free thread local data.
static int _mlg_global_free(UNUSED void *uctx)
Free the global module index.
int module_thread_instantiate(TALLOC_CTX *ctx, module_instance_t *mi, fr_event_list_t *el)
Allocate thread-local instance data for a module.
module_list_data_del_t data_del
Record that module data has been removed.
module_list_type_t const module_list_type_global
Callbacks for a global module list.
static dl_module_loader_t * dl_modules
dl module tracking
fr_cmd_table_t module_cmd_list_table[]
fr_heap_index_t inst_idx
Entry in the bootstrap/instantiation heap.
int(* module_list_thread_init_t)(TALLOC_CTX **ctx, module_list_t const *ml)
Callback to initialise a list for thread-local data, called once per thread.
int modules_bootstrap(module_list_t const *ml)
Bootstrap any modules which have not been bootstrapped already.
fr_cmd_table_t module_cmd_table[]
module_instance_t mi
Common module instance fields. Must come first.
static _Thread_local module_thread_instance_t ** mlg_thread_inst_list
An array of thread-local module lists.
int module_instantiate(module_instance_t *instance)
Manually complete module setup by calling its instantiate function.
static int mlg_thread_init(UNUSED TALLOC_CTX **ctx, UNUSED module_list_t const *ml)
Allocate a thread-local array to hold thread data for each module thats been instantiated.
bool module_instance_skip_bootstrap(module_instance_t *mi)
Should we bootstrap this module instance?
module_instance_t mi
Common module instance fields. Must come first.
static int _mlg_global_init(UNUSED void *uctx)
Initialise the global module index.
int module_submodule_parse(UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Generic callback for conf_parser_t to load a submodule.
int(* module_list_data_add_t)(module_instance_t *mi)
Callback to add data for a module.
size_t list_size
Size of talloc_chunk to allocate for the module_list_t.
static void mlg_data_del(module_instance_t *mi)
static void mltl_thread_data_del(module_thread_instance_t *ti)
bool const module_instance_allowed_chars[UINT8_MAX+1]
Chars that are allowed in a module instance name.
static void mltl_mlg_data_del(module_instance_t *mi)
int module_instance_conf_parse(module_instance_t *mi, CONF_SECTION *conf)
Covert a CONF_SECTION into parsed module instance data.
static fr_heap_t * mlg_index
Heap of all lists/modules used to get a common index with mlg_thread->inst_list.
module_instance_t * module_instance_alloc(module_list_t *ml, module_instance_t const *parent, dl_module_type_t type, char const *mod_name, char const *inst_name, module_instance_state_t init_state)
Allocate a new module and add it to a module list for later bootstrap/instantiation.
module_list_t * module_list_alloc(TALLOC_CTX *ctx, module_list_type_t const *type, char const *name, bool write_protect)
Allocate a new module list.
static int8_t _mlg_module_instance_cmp(void const *one, void const *two)
Sort module instance data first by list then by number.
int module_bootstrap(module_instance_t *mi)
Manually complete module bootstrap by calling its instantiate function.
void module_instance_debug(module_instance_t const *mi)
Print debugging information for a module.
A slightly larger module_instance structure to hold the module instance and thread instance.
Structure to hold callbacks for a module list type.
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
eap_aka_sim_process_conf_t * inst
fr_aka_sim_id_type_t type
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
#define fr_table_value_by_str(_table, _name, _def)
Convert a string to a value using a sorted or ordered table.
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
char * talloc_typed_strdup(TALLOC_CTX *ctx, char const *p)
Call talloc_strdup, setting the type on the new chunk correctly.
char * talloc_bstrndup(TALLOC_CTX *ctx, char const *in, size_t inlen)
Binary safe strndup function.
TALLOC_CTX * talloc_page_aligned_pool(TALLOC_CTX *ctx, void **start, size_t *end_len, unsigned int headers, size_t size)
Return a page aligned talloc memory pool.
Functions which we wish were included in the standard talloc distribution.
#define talloc_get_type_abort_const
static fr_event_list_t * el
void fr_strerror_clear(void)
Clears all pending messages from the talloc pools.
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
static size_t char ** out
void xlat_func_unregister_module(module_instance_t const *inst)
void xlat_func_unregister(char const *name)
Unregister an xlat function.