![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Defines functions for virtual_server initialisation. More...
#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/server/command.h>
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/dl_module.h>
#include <freeradius-devel/server/global_lib.h>
#include <freeradius-devel/server/modpriv.h>
#include <freeradius-devel/server/process.h>
#include <freeradius-devel/server/protocol.h>
#include <freeradius-devel/server/section.h>
#include <freeradius-devel/server/virtual_servers.h>
#include <freeradius-devel/unlang/compile.h>
#include <freeradius-devel/unlang/function.h>
#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/master.h>
#include <freeradius-devel/io/listen.h>
Go to the source code of this file.
Data Structures | |
struct | fr_virtual_listen_t |
struct | virtual_server_s |
Functions | |
static int | _virtual_servers_atexit (UNUSED void *uctx) |
static int | add_compile_list (virtual_server_t *vs, CONF_SECTION *cs, virtual_server_compile_t const *compile_list, char const *name) |
static int | cmd_show_server_list (FILE *fp, UNUSED FILE *fp_err, UNUSED void *ctx, UNUSED fr_cmd_info_t const *info) |
static int | define_server_attrs (CONF_SECTION *cs, fr_dict_t *dict, fr_dict_attr_t *parent, fr_dict_attr_t const *root) |
static int | define_server_values (CONF_SECTION *cs, fr_dict_attr_t *parent) |
static int8_t | listen_addr_cmp (void const *one, void const *two) |
Compare listeners by app_io_addr. | |
fr_listen_t * | listen_find_any (fr_listen_t *li) |
See if another global listener is using a particular IP / port. | |
static int | listen_parse (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
static int | listen_parse (UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule) |
dl_open a proto_* module | |
bool | listen_record (fr_listen_t *li) |
Record that we're listening on a particular IP / port. | |
static int | namespace_on_read (TALLOC_CTX *ctx, UNUSED void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule) |
Parse a "namespace" parameter. | |
static int | namespace_on_read (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
static int | namespace_parse (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
static int | namespace_parse (UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule) |
dl_open a process_* module | |
static int | server_parse (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule) |
static int | server_parse (UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule) |
Callback to validate the server section. | |
static unlang_action_t | server_remove_log_destination (UNUSED rlm_rcode_t *p_result, UNUSED int *priority, request_t *request, void *uctx) |
static void | server_signal_remove_log_destination (request_t *request, UNUSED fr_signal_t action, void *uctx) |
virtual_server_t const * | virtual_server_by_child (CONF_ITEM const *ci) |
Find a virtual server using one of its sections. | |
int | virtual_server_cf_parse (UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule) |
Wrapper for the config parser to allow pass1 resolution of virtual servers. | |
static int8_t | virtual_server_compile_name_cmp (void const *a, void const *b) |
int | virtual_server_compile_sections (virtual_server_t const *vs, tmpl_rules_t const *rules) |
Compile sections for a virtual server. | |
CONF_SECTION * | virtual_server_cs (virtual_server_t const *vs) |
Return the configuration section for a virtual server. | |
fr_dict_t const * | virtual_server_dict_by_child_ci (CONF_ITEM const *ci) |
Return the namespace for a given virtual server specified by a CONF_ITEM within the virtual server. | |
fr_dict_t const * | virtual_server_dict_by_cs (CONF_SECTION const *server_cs) |
Return the namespace for the virtual server specified by a config section. | |
fr_dict_t const * | virtual_server_dict_by_name (char const *virtual_server) |
Return the namespace for the named virtual server. | |
virtual_server_t const * | virtual_server_find (char const *name) |
Return virtual server matching the specified name. | |
int | virtual_server_has_namespace (CONF_SECTION **out, char const *virtual_server, fr_dict_t const *namespace, CONF_ITEM *ci) |
Verify that a given virtual_server exists and is of a particular namespace. | |
void | virtual_server_listen_debug (void) |
Print all the loaded listener instances. | |
int | virtual_server_listen_transport_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule) |
Generic conf_parser_t func for loading drivers. | |
module_instance_t * | virtual_server_listener_by_data (void const *data) |
Resolve proto data to a module instance. | |
static fr_dict_t const * | virtual_server_local_dict (CONF_SECTION *server_cs, fr_dict_t const *dict_def) |
void | virtual_server_process_debug (void) |
Print all the loaded process module instances. | |
unlang_action_t | virtual_server_push (request_t *request, CONF_SECTION *server_cs, bool top_frame) |
Set the request processing function. | |
int | virtual_server_section_attribute_define (CONF_SECTION *server_cs, char const *subcs_name, fr_dict_attr_t const *da) |
Define a values for Auth-Type attributes by the sections present in a virtual-server. | |
section_name_t const ** | virtual_server_section_methods (virtual_server_t const *vs, section_name_t const *section) |
Find the component for a section. | |
int | virtual_server_section_register (virtual_server_t *vs, virtual_server_compile_t const *entry) |
Register name1 / name2 as allowed processing sections. | |
int | virtual_servers_bootstrap (CONF_SECTION *config) |
Load protocol modules and call their bootstrap methods. | |
int | virtual_servers_free (void) |
int | virtual_servers_init (void) |
Performs global initialisation for the virtual server code. | |
int | virtual_servers_instantiate (void) |
Instantiate all the virtual servers. | |
int | virtual_servers_open (fr_schedule_t *sc) |
Open all the listen sockets. | |
void | virtual_servers_thread_detach (void) |
Free thread-specific data for all process modules and listeners. | |
int | virtual_servers_thread_instantiate (TALLOC_CTX *ctx, fr_event_list_t *el) |
Perform thread instantiation for all process modules and listeners. | |
Variables | |
static fr_dict_attr_t const * | attr_auth_type |
static fr_cmd_table_t | cmd_table [] |
static fr_dict_t const * | dict_freeradius |
static fr_rb_tree_t * | listen_addr_root = NULL |
static module_list_t * | process_modules |
List of process modules we've loaded. | |
static module_list_t * | proto_modules |
List of proto modules we've loaded. | |
static const conf_parser_t | server_config [] |
static const conf_parser_t | server_on_read_config [] |
fr_dict_attr_autoload_t | virtual_server_dict_attr_autoload [] |
fr_dict_autoload_t | virtual_server_dict_autoload [] |
static CONF_SECTION * | virtual_server_root |
CONF_SECTION holding all the virtual servers. | |
static virtual_server_t ** | virtual_servers |
Top level structure holding all virtual servers. | |
const conf_parser_t | virtual_servers_config [] |
const conf_parser_t | virtual_servers_on_read_config [] |
Defines functions for virtual_server initialisation.
Definition in file virtual_servers.c.
struct fr_virtual_listen_t |
Definition at line 49 of file virtual_servers.c.
Data Fields | ||
---|---|---|
module_instance_t * | proto_mi | The proto_* module for a listen section. |
fr_app_t const * | proto_module |
Public interface to the proto_mi. cached for convenience. |
struct virtual_server_s |
Definition at line 55 of file virtual_servers.c.
Data Fields | ||
---|---|---|
fr_virtual_listen_t ** | listeners | Listeners in this virtual server. |
fr_log_t * | log | log destination |
char const * | log_name | name of log destination |
module_instance_t * | process_mi |
The process_* module for a virtual server. Contains the dictionary used by the virtual server and the entry point for the state machine. |
fr_process_module_t const * | process_module |
Public interface to the process_mi. cached for convenience. |
fr_rb_tree_t * | sections | List of sections that need to be compiled. |
CONF_SECTION * | server_cs | The server section. |
|
static |
Definition at line 1725 of file virtual_servers.c.
|
inlinestatic |
Definition at line 284 of file virtual_servers.c.
|
static |
|
static |
Definition at line 1328 of file virtual_servers.c.
|
static |
Definition at line 1231 of file virtual_servers.c.
|
static |
Compare listeners by app_io_addr.
Only works for IP addresses, and will blow up on file names
Definition at line 766 of file virtual_servers.c.
fr_listen_t * listen_find_any | ( | fr_listen_t * | li | ) |
See if another global listener is using a particular IP / port.
Definition at line 838 of file virtual_servers.c.
|
static |
|
static |
dl_open a proto_* module
[in] | ctx | to allocate data in. |
[out] | out | Where to our listen configuration. Is a fr_virtual_listen_t structure. |
[in] | parent | Base structure address. |
[in] | ci | CONF_SECTION containing the listen section. |
[in] | rule | unused. |
Definition at line 381 of file virtual_servers.c.
bool listen_record | ( | fr_listen_t * | li | ) |
Record that we're listening on a particular IP / port.
Definition at line 849 of file virtual_servers.c.
|
static |
Parse a "namespace" parameter.
We need to load the process module before continuing to parse the virtual server contents as we need to know the namespace so that we can resolve attribute names.
We also need the compilation list from the proto module to figure out which sections we need to compile.
[in] | ctx | to allocate data in. |
[out] | out | always NULL |
[in] | parent | Base structure address. |
[in] | ci | CONF_SECTION containing the listen section. |
[in] | rule | unused. |
Definition at line 228 of file virtual_servers.c.
|
static |
|
static |
|
static |
dl_open a process_* module
[in] | ctx | to allocate data in. |
[out] | out | Where to our listen configuration. Is a fr_virtual_listen_t structure. |
[in] | parent | Base structure address. |
[in] | ci | CONF_SECTION containing the listen section. |
[in] | rule | unused. |
Definition at line 325 of file virtual_servers.c.
|
static |
|
static |
Callback to validate the server section.
[in] | ctx | to allocate data in. |
[out] | out | Where to our listen configuration. Is a virtual_server_t structure. |
[in] | parent | Base structure address. |
[in] | ci | CONF_SECTION containing the listen section. |
[in] | rule | unused. |
Definition at line 510 of file virtual_servers.c.
|
static |
Definition at line 655 of file virtual_servers.c.
|
static |
Definition at line 665 of file virtual_servers.c.
virtual_server_t const * virtual_server_by_child | ( | CONF_ITEM const * | ci | ) |
Find a virtual server using one of its sections.
[in] | ci | to find parent virtual server for. |
Definition at line 900 of file virtual_servers.c.
int virtual_server_cf_parse | ( | UNUSED TALLOC_CTX * | ctx, |
void * | out, | ||
UNUSED void * | parent, | ||
CONF_ITEM * | ci, | ||
UNUSED conf_parser_t const * | rule | ||
) |
Wrapper for the config parser to allow pass1 resolution of virtual servers.
Definition at line 923 of file virtual_servers.c.
|
static |
Definition at line 491 of file virtual_servers.c.
int virtual_server_compile_sections | ( | virtual_server_t const * | vs, |
tmpl_rules_t const * | rules | ||
) |
Compile sections for a virtual server.
When the "proto_foo" module calls fr_app_process_instantiate(), it loads the compile list from the fr_app_worker_t, and calls this function.
This function walks down the registration table, compiling each named section.
[in] | vs | to to compile sections for. |
[in] | rules | to apply for pass1. |
Definition at line 951 of file virtual_servers.c.
CONF_SECTION * virtual_server_cs | ( | virtual_server_t const * | vs | ) |
Return the configuration section for a virtual server.
[in] | vs | to return conf section for |
Definition at line 866 of file virtual_servers.c.
Return the namespace for a given virtual server specified by a CONF_ITEM within the virtual server.
[in] | ci | to look for namespace in. |
Definition at line 585 of file virtual_servers.c.
fr_dict_t const * virtual_server_dict_by_cs | ( | CONF_SECTION const * | server_cs | ) |
Return the namespace for the virtual server specified by a config section.
[in] | server_cs | to look for namespace in. |
Definition at line 564 of file virtual_servers.c.
fr_dict_t const * virtual_server_dict_by_name | ( | char const * | virtual_server | ) |
Return the namespace for the named virtual server.
[in] | virtual_server | to look for namespace in. |
Definition at line 547 of file virtual_servers.c.
virtual_server_t const * virtual_server_find | ( | char const * | name | ) |
Return virtual server matching the specified name.
[in] | name | of virtual server. |
Definition at line 880 of file virtual_servers.c.
int virtual_server_has_namespace | ( | CONF_SECTION ** | out, |
char const * | virtual_server, | ||
fr_dict_t const * | namespace, | ||
CONF_ITEM * | ci | ||
) |
Verify that a given virtual_server exists and is of a particular namespace.
Mostly used by modules to check virtual servers specified by their configs.
[out] | out | we found. May be NULL if just checking for existence. |
[in] | virtual_server | to check. |
[in] | namespace | the virtual server must belong to. |
[in] | ci | to log errors against. May be NULL if caller doesn't want errors logged. |
Definition at line 613 of file virtual_servers.c.
void virtual_server_listen_debug | ( | void | ) |
Print all the loaded listener instances.
Definition at line 173 of file virtual_servers.c.
int virtual_server_listen_transport_parse | ( | TALLOC_CTX * | ctx, |
void * | out, | ||
void * | parent, | ||
CONF_ITEM * | ci, | ||
conf_parser_t const * | rule | ||
) |
Generic conf_parser_t func for loading drivers.
Definition at line 201 of file virtual_servers.c.
module_instance_t * virtual_server_listener_by_data | ( | void const * | data | ) |
Resolve proto data to a module instance.
[in] | data | Pointer to the proto data. |
Definition at line 193 of file virtual_servers.c.
|
static |
Definition at line 1434 of file virtual_servers.c.
void virtual_server_process_debug | ( | void | ) |
Print all the loaded process module instances.
Definition at line 181 of file virtual_servers.c.
unlang_action_t virtual_server_push | ( | request_t * | request, |
CONF_SECTION * | server_cs, | ||
bool | top_frame | ||
) |
Set the request processing function.
Short-term hack
Definition at line 676 of file virtual_servers.c.
int virtual_server_section_attribute_define | ( | CONF_SECTION * | server_cs, |
char const * | subcs_name, | ||
fr_dict_attr_t const * | da | ||
) |
Define a values for Auth-Type attributes by the sections present in a virtual-server.
The.name2 value of any sections found will be converted into values of the specified da.
[in] | server_cs | The virtual server containing the sections. |
[in] | subcs_name | of the subsection to search for. |
[in] | da | to add enumeration values for. |
Definition at line 1188 of file virtual_servers.c.
section_name_t const ** virtual_server_section_methods | ( | virtual_server_t const * | vs, |
section_name_t const * | section | ||
) |
Find the component for a section.
Definition at line 1149 of file virtual_servers.c.
int virtual_server_section_register | ( | virtual_server_t * | vs, |
virtual_server_compile_t const * | entry | ||
) |
Register name1 / name2 as allowed processing sections.
This function is called from the virtual server bootstrap routine, which happens before module_bootstrap();
Definition at line 1104 of file virtual_servers.c.
int virtual_servers_bootstrap | ( | CONF_SECTION * | config | ) |
Load protocol modules and call their bootstrap methods.
[in] | config | section containing the virtual servers to bootstrap. |
Definition at line 1691 of file virtual_servers.c.
int virtual_servers_free | ( | void | ) |
Definition at line 1712 of file virtual_servers.c.
int virtual_servers_init | ( | void | ) |
Performs global initialisation for the virtual server code.
This has to be done separately and explicitly, because the above code makes use of "onread" callbacks.
Will automatically free module lists on exit, but all modules should have been removed from this list by the point that happens.
Definition at line 1738 of file virtual_servers.c.
int virtual_servers_instantiate | ( | void | ) |
Instantiate all the virtual servers.
Definition at line 1561 of file virtual_servers.c.
int virtual_servers_open | ( | fr_schedule_t * | sc | ) |
Open all the listen sockets.
[in] | sc | Scheduler to add I/O paths to. |
Definition at line 1467 of file virtual_servers.c.
void virtual_servers_thread_detach | ( | void | ) |
Free thread-specific data for all process modules and listeners.
Definition at line 1536 of file virtual_servers.c.
int virtual_servers_thread_instantiate | ( | TALLOC_CTX * | ctx, |
fr_event_list_t * | el | ||
) |
Perform thread instantiation for all process modules and listeners.
Definition at line 1545 of file virtual_servers.c.
|
static |
Definition at line 73 of file virtual_servers.c.
|
static |
Definition at line 742 of file virtual_servers.c.
|
static |
Definition at line 71 of file virtual_servers.c.
|
static |
Definition at line 114 of file virtual_servers.c.
|
static |
List of process modules we've loaded.
This is global for all virtual servers. Must be initialised before the configuration is loaded.
Definition at line 93 of file virtual_servers.c.
|
static |
List of proto modules we've loaded.
This is global for all virtual servers. Must be initialised before the configuration is loaded.
Definition at line 100 of file virtual_servers.c.
|
static |
Definition at line 142 of file virtual_servers.c.
|
static |
Definition at line 122 of file virtual_servers.c.
fr_dict_attr_autoload_t virtual_server_dict_attr_autoload |
Definition at line 82 of file virtual_servers.c.
fr_dict_autoload_t virtual_server_dict_autoload |
Definition at line 76 of file virtual_servers.c.
|
static |
CONF_SECTION holding all the virtual servers.
Set during the call to virtual_server_bootstrap and used by other virtual server functions.
Definition at line 112 of file virtual_servers.c.
|
static |
Top level structure holding all virtual servers.
Definition at line 105 of file virtual_servers.c.
const conf_parser_t virtual_servers_config[] |
Definition at line 157 of file virtual_servers.c.
const conf_parser_t virtual_servers_on_read_config[] |
Definition at line 129 of file virtual_servers.c.