The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
virtual_servers.c File Reference

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/process_types.h>
#include <freeradius-devel/server/virtual_servers.h>
#include <freeradius-devel/server/cf_util.h>
#include <freeradius-devel/unlang/compile.h>
#include <freeradius-devel/unlang/function.h>
#include <freeradius-devel/unlang/finally.h>
#include <freeradius-devel/unlang/interpret.h>
#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/master.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/util/pair.h>
#include <freeradius-devel/util/talloc.h>
#include <freeradius-devel/util/types.h>
#include <freeradius-devel/util/value.h>
+ Include dependency graph for virtual_servers.c:

Go to the source code of this file.

Data Structures

struct  virtual_server_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_tlisten_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 unlang_result_t *p_result, 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 int virtual_server_compile_finally_sections (virtual_server_t *vs, tmpl_rules_t const *rules, int *found)
 
static int8_t virtual_server_compile_name_cmp (void const *a, void const *b)
 
static int virtual_server_compile_sections (virtual_server_t *vs, tmpl_rules_t const *rules)
 Compile sections for a virtual server.
 
CONF_SECTIONvirtual_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.
 
virtual_server_t const * virtual_server_from_cs (CONF_SECTION *server_cs)
 Resolve a CONF_SECTION to a virtual server.
 
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_tvirtual_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 (unlang_result_t *p_result, request_t *request, virtual_server_t const *vs, bool top_frame)
 Set the request processing function.
 
static int virtual_server_push_finally (request_t *request, virtual_server_t const *vs, bool *top_frame)
 Push a finally section onto the stack.
 
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_tlisten_addr_root = NULL
 
static module_list_tprocess_modules
 List of process modules we've loaded.
 
static module_list_tproto_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_SECTIONvirtual_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 []
 

Detailed Description

Defines functions for virtual_server initialisation.

Id
4c1f8290e401818c18817b5426e4a4bd3e0a58df

Definition in file virtual_servers.c.


Data Structure Documentation

◆ virtual_server_listen_t

struct virtual_server_listen_t

Definition at line 51 of file virtual_servers.c.

+ Collaboration diagram for virtual_server_listen_t:
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.

◆ virtual_server_s

struct virtual_server_s

Definition at line 57 of file virtual_servers.c.

+ Collaboration diagram for virtual_server_s:
Data Fields
void ** finally_by_packet_type Finalise instruction by packet type.
void * finally_default Default finally instruction.
virtual_server_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.

Function Documentation

◆ _virtual_servers_atexit()

static int _virtual_servers_atexit ( UNUSED void *  uctx)
static

Definition at line 2005 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_compile_list()

static int add_compile_list ( virtual_server_t vs,
CONF_SECTION cs,
virtual_server_compile_t const *  compile_list,
char const *  name 
)
inlinestatic

Definition at line 289 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cmd_show_server_list()

static int cmd_show_server_list ( FILE *  fp,
UNUSED FILE *  fp_err,
UNUSED void *  ctx,
UNUSED fr_cmd_info_t const *  info 
)
static

Definition at line 803 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ define_server_attrs()

static int define_server_attrs ( CONF_SECTION cs,
fr_dict_t dict,
fr_dict_attr_t parent,
fr_dict_attr_t const *  root 
)
static

Definition at line 1599 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ define_server_values()

static int define_server_values ( CONF_SECTION cs,
fr_dict_attr_t parent 
)
static

Definition at line 1502 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_addr_cmp()

static int8_t listen_addr_cmp ( void const *  one,
void const *  two 
)
static

Compare listeners by app_io_addr.

Only works for IP addresses, and will blow up on file names

Definition at line 841 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_find_any()

fr_listen_t * listen_find_any ( fr_listen_t li)

See if another global listener is using a particular IP / port.

Definition at line 913 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listen_parse() [1/2]

static int listen_parse ( TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
conf_parser_t const *  rule 
)
static

◆ listen_parse() [2/2]

static int listen_parse ( UNUSED TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
UNUSED conf_parser_t const *  rule 
)
static

dl_open a proto_* module

Parameters
[in]ctxto allocate data in.
[out]outWhere to our listen configuration. Is a #fr_virtual_listen_t structure.
[in]parentBase structure address.
[in]ciCONF_SECTION containing the listen section.
[in]ruleunused.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 386 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ listen_record()

bool listen_record ( fr_listen_t li)

Record that we're listening on a particular IP / port.

Definition at line 924 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ namespace_on_read() [1/2]

static int namespace_on_read ( TALLOC_CTX *  ctx,
UNUSED void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
UNUSED conf_parser_t const *  rule 
)
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.

Parameters
[in]ctxto allocate data in.
[out]outalways NULL
[in]parentBase structure address.
[in]ciCONF_SECTION containing the listen section.
[in]ruleunused.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 233 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ namespace_on_read() [2/2]

static int namespace_on_read ( TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
conf_parser_t const *  rule 
)
static

◆ namespace_parse() [1/2]

static int namespace_parse ( TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
conf_parser_t const *  rule 
)
static

◆ namespace_parse() [2/2]

static int namespace_parse ( UNUSED TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
UNUSED conf_parser_t const *  rule 
)
static

dl_open a process_* module

Parameters
[in]ctxto allocate data in.
[out]outWhere to our listen configuration. Is a #fr_virtual_listen_t structure.
[in]parentBase structure address.
[in]ciCONF_SECTION containing the listen section.
[in]ruleunused.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 330 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ server_parse() [1/2]

static int server_parse ( TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
UNUSED conf_parser_t const *  rule 
)
static

◆ server_parse() [2/2]

static int server_parse ( UNUSED TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
UNUSED conf_parser_t const *  rule 
)
static

Callback to validate the server section.

Parameters
[in]ctxto allocate data in.
[out]outWhere to our listen configuration. Is a virtual_server_t structure.
[in]parentBase structure address.
[in]ciCONF_SECTION containing the listen section.
[in]ruleunused.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 539 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ server_remove_log_destination()

static unlang_action_t server_remove_log_destination ( UNUSED unlang_result_t p_result,
request_t request,
void *  uctx 
)
static

Definition at line 684 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ server_signal_remove_log_destination()

static void server_signal_remove_log_destination ( request_t request,
UNUSED fr_signal_t  action,
void *  uctx 
)
static

Definition at line 694 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_by_child()

virtual_server_t const * virtual_server_by_child ( CONF_ITEM const *  ci)

Find a virtual server using one of its sections.

Parameters
[in]cito find parent virtual server for.
Returns
  • The virtual server section on success.
  • NULL if the child isn't associated with any virtual server section.

Definition at line 991 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ virtual_server_cf_parse()

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 1014 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ virtual_server_compile_finally_sections()

static int virtual_server_compile_finally_sections ( virtual_server_t vs,
tmpl_rules_t const *  rules,
int *  found 
)
inlinestatic

Definition at line 1077 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_compile_name_cmp()

static int8_t virtual_server_compile_name_cmp ( void const *  a,
void const *  b 
)
static

Definition at line 520 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_compile_sections()

static int virtual_server_compile_sections ( virtual_server_t vs,
tmpl_rules_t const *  rules 
)
static

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.

Parameters
[in]vsto to compile sections for.
[in]rulesto apply for pass1.

Definition at line 1198 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_cs()

CONF_SECTION * virtual_server_cs ( virtual_server_t const *  vs)

Return the configuration section for a virtual server.

Parameters
[in]vsto return conf section for
Returns
  • The CONF_SECTION of the virtual server.

Definition at line 941 of file virtual_servers.c.

+ Here is the caller graph for this function:

◆ virtual_server_dict_by_child_ci()

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.

Parameters
[in]cito look for namespace in.
Returns
  • NULL on error.
  • Namespace on success.

Definition at line 614 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_dict_by_cs()

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.

Parameters
[in]server_csto look for namespace in.
Returns
  • NULL on error.
  • Namespace on success.

Definition at line 593 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_dict_by_name()

fr_dict_t const * virtual_server_dict_by_name ( char const *  virtual_server)

Return the namespace for the named virtual server.

Parameters
[in]virtual_serverto look for namespace in.
Returns
  • NULL on error.
  • Namespace on success.

Definition at line 576 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_find()

virtual_server_t const * virtual_server_find ( char const *  name)

Return virtual server matching the specified name.

Note
May be called in bootstrap or instantiate as all servers should be present.
Parameters
[in]nameof virtual server.
Returns
  • NULL if no virtual server was found.
  • The CONF_SECTION of the named virtual server.

Definition at line 971 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_from_cs()

virtual_server_t const * virtual_server_from_cs ( CONF_SECTION server_cs)

Resolve a CONF_SECTION to a virtual server.

Definition at line 949 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_has_namespace()

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.

Parameters
[out]outwe found. May be NULL if just checking for existence.
[in]virtual_serverto check.
[in]namespacethe virtual server must belong to.
[in]cito log errors against. May be NULL if caller doesn't want errors logged.
Returns
  • 0 on success.
  • -1 if no virtual server could be found.
  • -2 if virtual server is not of the correct namespace.

Definition at line 642 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ virtual_server_listen_debug()

void virtual_server_listen_debug ( void  )

Print all the loaded listener instances.

Definition at line 178 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ virtual_server_listen_transport_parse()

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 206 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_listener_by_data()

module_instance_t * virtual_server_listener_by_data ( void const *  data)

Resolve proto data to a module instance.

Parameters
[in]dataPointer to the proto data.
Returns
  • The module instance for the proto data.
  • NULL if no data matches.

Definition at line 198 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_local_dict()

static fr_dict_t const * virtual_server_local_dict ( CONF_SECTION server_cs,
fr_dict_t const *  dict_def 
)
static

Definition at line 1705 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_process_debug()

void virtual_server_process_debug ( void  )

Print all the loaded process module instances.

Definition at line 186 of file virtual_servers.c.

+ Here is the call graph for this function:

◆ virtual_server_push()

unlang_action_t virtual_server_push ( unlang_result_t p_result,
request_t request,
virtual_server_t const *  vs,
bool  top_frame 
)

Set the request processing function.

Short-term hack

Definition at line 755 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_push_finally()

static int virtual_server_push_finally ( request_t request,
virtual_server_t const *  vs,
bool top_frame 
)
inlinestatic

Push a finally section onto the stack.

The finally instruction cannot be cancelled and will always execute as the stack is unwound.

Parameters
[in]requestrequest to push the finally section onto.
[in]vsvirtual server to push the finally section for.
[in,out]top_framemutate the top frame value to indicate that future pushes should be subframes.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 713 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_section_attribute_define()

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.

Parameters
[in]server_csThe virtual server containing the sections.
[in]subcs_nameof the subsection to search for.
[in]dato add enumeration values for.
Returns
  • 0 all values added successfully.
  • -1 an error occurred.

Definition at line 1459 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_section_methods()

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 1420 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_server_section_register()

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 1375 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_servers_bootstrap()

int virtual_servers_bootstrap ( CONF_SECTION config)

Load protocol modules and call their bootstrap methods.

Parameters
[in]configsection containing the virtual servers to bootstrap.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1971 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_servers_free()

int virtual_servers_free ( void  )

Definition at line 1992 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_servers_init()

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 2018 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_servers_instantiate()

int virtual_servers_instantiate ( void  )

Instantiate all the virtual servers.

Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1839 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_servers_open()

int virtual_servers_open ( fr_schedule_t sc)

Open all the listen sockets.

Parameters
[in]scScheduler to add I/O paths to.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1738 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_servers_thread_detach()

void virtual_servers_thread_detach ( void  )

Free thread-specific data for all process modules and listeners.

Definition at line 1814 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtual_servers_thread_instantiate()

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 1823 of file virtual_servers.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ attr_auth_type

fr_dict_attr_t const* attr_auth_type
static

Definition at line 78 of file virtual_servers.c.

◆ cmd_table

fr_cmd_table_t cmd_table[]
static
Initial value:
= {
{
.parent = "show",
.name = "server",
.help = "Show virtual server settings.",
.read_only = true,
},
{
.parent = "show server",
.name = "list",
.help = "Show the list of virtual servers loaded in the server.",
.read_only = true,
},
}
#define CMD_TABLE_END
Definition command.h:62
static int cmd_show_server_list(FILE *fp, UNUSED FILE *fp_err, UNUSED void *ctx, UNUSED fr_cmd_info_t const *info)

Definition at line 817 of file virtual_servers.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 76 of file virtual_servers.c.

◆ listen_addr_root

fr_rb_tree_t* listen_addr_root = NULL
static

Definition at line 119 of file virtual_servers.c.

◆ process_modules

module_list_t* process_modules
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 98 of file virtual_servers.c.

◆ proto_modules

module_list_t* proto_modules
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 105 of file virtual_servers.c.

◆ server_config

const conf_parser_t server_config[]
static
Initial value:
= {
.func = namespace_parse },
virtual_server_t, listeners),
.name2 = CF_IDENT_ANY,
.subcs_size = sizeof(virtual_server_listen_t), .subcs_type = "virtual_server_listen_t",
.func = listen_parse },
{ FR_CONF_OFFSET("log", virtual_server_t, log_name), },
}
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:662
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:284
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition cf_parse.h:434
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
Definition cf_parse.h:451
@ CONF_FLAG_OK_MISSING
OK if it's missing.
Definition cf_parse.h:459
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition cf_parse.h:428
#define FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:241
#define CF_IDENT_ANY
Definition cf_util.h:78
@ FR_TYPE_VOID
User data.
static int listen_parse(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)

Definition at line 147 of file virtual_servers.c.

◆ server_on_read_config

const conf_parser_t server_on_read_config[]
static
Initial value:
= {
.on_read = namespace_on_read },
}
static int namespace_on_read(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)

Definition at line 127 of file virtual_servers.c.

◆ virtual_server_dict_attr_autoload

fr_dict_attr_autoload_t virtual_server_dict_attr_autoload
Initial value:
= {
{ .out = &attr_auth_type, .name = "Auth-Type", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
{ NULL }
}
@ FR_TYPE_UINT32
32 Bit unsigned integer.
static fr_dict_t const * dict_freeradius
static fr_dict_attr_t const * attr_auth_type

Definition at line 87 of file virtual_servers.c.

◆ virtual_server_dict_autoload

fr_dict_autoload_t virtual_server_dict_autoload
Initial value:
= {
{ .out = &dict_freeradius, .proto = "freeradius" },
{ NULL }
}

Definition at line 81 of file virtual_servers.c.

◆ virtual_server_root

CONF_SECTION* virtual_server_root
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 117 of file virtual_servers.c.

◆ virtual_servers

virtual_server_t** virtual_servers
static

Top level structure holding all virtual servers.

Definition at line 110 of file virtual_servers.c.

◆ virtual_servers_config

const conf_parser_t virtual_servers_config[]
Initial value:
= {
.subcs_size = sizeof(virtual_server_t), .subcs_type = "virtual_server_t",
.subcs = (void const *) server_config, .name2 = CF_IDENT_ANY,
.func = server_parse },
}
char const * name2
Second identifier for CONF_SECTION.
Definition cf_parse.h:601
#define FR_CONF_POINTER(_name, _type, _flags, _res_p)
conf_parser_t which parses a single CONF_PAIR producing a single global result
Definition cf_parse.h:339
static int server_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
static const conf_parser_t server_config[]
static virtual_server_t ** virtual_servers
Top level structure holding all virtual servers.
struct virtual_server_s virtual_server_t

Definition at line 162 of file virtual_servers.c.

◆ virtual_servers_on_read_config

const conf_parser_t virtual_servers_on_read_config[]
Initial value:
= {
.subcs_size = sizeof(virtual_server_t), .subcs_type = "virtual_server_t",
.subcs = (void const *) server_on_read_config, .name2 = CF_IDENT_ANY,
.on_read = cf_null_on_read },
}
int cf_null_on_read(UNUSED TALLOC_CTX *ctx, UNUSED void *out, UNUSED void *parent, UNUSED CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
NULL callback for sections.
Definition cf_parse.c:1747
static const conf_parser_t server_on_read_config[]

Definition at line 134 of file virtual_servers.c.