The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
Functions | Variables
fd_config.c File Reference

BIO abstractions for configuring file descriptors. More...

#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/util/perm.h>
#include <freeradius-devel/bio/fd_priv.h>
+ Include dependency graph for fd_config.c:

Go to the source code of this file.

Functions

static int client_transport_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
 Parse "transport" and then set the subconfig.
 
static int common_transport_parse (UNUSED TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule, conf_parser_t const *transport_table[FR_BIO_FD_TRANSPORT_SIZE])
 Parse "transport" and then set the subconfig.
 
static int mode_parse (UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
 
static int send_recv_buf_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
 Parse a socket buffer size, and check that it fits into the "int" taken by setsockopt()
 
static int server_transport_parse (TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
 Parse "transport" and then set the subconfig.
 

Variables

static conf_parser_t const client_file_config []
 
static const conf_parser_t client_file_sub_config []
 
static conf_parser_t const client_tcp_config []
 
static const conf_parser_t client_tcp_sub_config []
 
static conf_parser_t const * client_transport_configs [FR_BIO_FD_TRANSPORT_SIZE]
 
static conf_parser_t const client_udp_config []
 
static const conf_parser_t client_udp_sub_config []
 
static conf_parser_t const client_udp_unconnected_config []
 
static const conf_parser_t client_udp_unconnected_sub_config []
 
static conf_parser_t const client_unix_config []
 
static const conf_parser_t client_unix_sub_config []
 
const conf_parser_t fr_bio_fd_client_config []
 
const conf_parser_t fr_bio_fd_server_config []
 
static fr_table_num_sorted_t mode_names []
 
static size_t mode_names_len = NUM_ELEMENTS(mode_names)
 
static conf_parser_t const server_file_config []
 
static const conf_parser_t server_file_sub_config []
 
static const conf_parser_t server_peercred_config []
 
static conf_parser_t const server_tcp_config []
 
static const conf_parser_t server_tcp_sub_config []
 
static conf_parser_t const * server_transport_configs [FR_BIO_FD_TRANSPORT_SIZE]
 
static conf_parser_t const server_udp_config []
 
static const conf_parser_t server_udp_sub_config []
 
static conf_parser_t const server_unix_config []
 
static const conf_parser_t server_unix_sub_config []
 
static fr_table_num_sorted_t transport_types []
 Mapping table of transport names to the transport types/.
 
static size_t transport_types_len = NUM_ELEMENTS(transport_types)
 

Detailed Description

BIO abstractions for configuring file descriptors.

Id
33a753a7af2635d087c4f332373d30d0f47ceba3

Definition in file fd_config.c.

Function Documentation

◆ client_transport_parse()

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

Parse "transport" and then set the subconfig.

Definition at line 278 of file fd_config.c.

+ Here is the call graph for this function:

◆ common_transport_parse()

static int common_transport_parse ( UNUSED TALLOC_CTX *  ctx,
void *  out,
void *  parent,
CONF_ITEM *  ci,
UNUSED conf_parser_t const *  rule,
conf_parser_t const *  transport_table[FR_BIO_FD_TRANSPORT_SIZE] 
)
static

Parse "transport" and then set the subconfig.

Definition at line 92 of file fd_config.c.

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

◆ mode_parse()

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

Definition at line 41 of file fd_config.c.

+ Here is the call graph for this function:

◆ send_recv_buf_parse()

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

Parse a socket buffer size, and check that it fits into the "int" taken by setsockopt()

Note that this function parses a plain integer. cf_table_parse_uint32() looks the value up in a table taken from rule->uctx, and these rules have no uctx.

Definition at line 62 of file fd_config.c.

+ Here is the call graph for this function:

◆ server_transport_parse()

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

Parse "transport" and then set the subconfig.

Definition at line 437 of file fd_config.c.

+ Here is the call graph for this function:

Variable Documentation

◆ client_file_config

conf_parser_t const client_file_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("file", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) client_file_sub_config },
}
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:712
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition cf_parse.h:460
#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:350
static const conf_parser_t client_file_sub_config[]
Definition fd_config.c:240

Definition at line 250 of file fd_config.c.

◆ client_file_sub_config

const conf_parser_t client_file_sub_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("permissions", fr_bio_fd_config_t, perm), .dflt = "0600", .func = cf_parse_permissions },
{ FR_CONF_OFFSET("mode", fr_bio_fd_config_t, flags), .dflt = "read-write", .func = mode_parse },
}
int cf_parse_permissions(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
Generic function for resolving permissions to a mode-t.
Definition cf_parse.c:1867
#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:280
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition cf_parse.h:466
#define FR_CONF_OFFSET_FLAGS(_name, _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:268
Configuration for sockets.
Definition fd.h:92
static int mode_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
Definition fd_config.c:41

Definition at line 240 of file fd_config.c.

◆ client_tcp_config

conf_parser_t const client_tcp_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("tcp", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) client_tcp_sub_config },
}
static const conf_parser_t client_tcp_sub_config[]
Definition fd_config.c:209

Definition at line 234 of file fd_config.c.

◆ client_tcp_sub_config

const conf_parser_t client_tcp_sub_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("port", fr_bio_fd_config_t, dst_port) },
{ FR_CONF_OFFSET_TYPE_FLAGS("src_ipv4addr", FR_TYPE_IPV4_ADDR, 0, fr_bio_fd_config_t, src_ipaddr) },
{ FR_CONF_OFFSET_TYPE_FLAGS("src_ipv6addr", FR_TYPE_IPV6_ADDR, 0, fr_bio_fd_config_t, src_ipaddr) },
{ FR_CONF_OFFSET("src_port", fr_bio_fd_config_t, src_port) },
{ FR_CONF_OFFSET("src_port_start", fr_bio_fd_config_t, src_port_start) },
{ FR_CONF_OFFSET("src_port_end", fr_bio_fd_config_t, src_port_end) },
{ FR_CONF_OFFSET("interface", fr_bio_fd_config_t, interface) },
{ FR_CONF_OFFSET("delay_tcp_writes", fr_bio_fd_config_t, tcp_delay) },
}
#define FR_CONF_OFFSET_IS_SET(_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:294
#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:238
static int send_recv_buf_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Parse a socket buffer size, and check that it fits into the "int" taken by setsockopt()
Definition fd_config.c:62
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.

Definition at line 209 of file fd_config.c.

◆ client_transport_configs

conf_parser_t const* client_transport_configs[FR_BIO_FD_TRANSPORT_SIZE]
static
Initial value:
= {
}
@ FR_BIO_FD_TRANSPORT_TCP
TCP over IPv4 or IPv6.
Definition fd.h:79
@ FR_BIO_FD_TRANSPORT_UDP
UDP over IPv4 or IPv6.
Definition fd.h:80
@ FR_BIO_FD_TRANSPORT_UNIX
Unix domain socket, named by 'path'.
Definition fd.h:81
@ FR_BIO_FD_TRANSPORT_FILE
regular file, named by 'filename'
Definition fd.h:78
static conf_parser_t const client_file_config[]
Definition fd_config.c:250
static conf_parser_t const client_udp_config[]
Definition fd_config.c:175
static conf_parser_t const client_unix_config[]
Definition fd_config.c:262
static conf_parser_t const client_tcp_config[]
Definition fd_config.c:234

Definition at line 268 of file fd_config.c.

◆ client_udp_config

conf_parser_t const client_udp_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("udp", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) client_udp_sub_config },
}
static const conf_parser_t client_udp_sub_config[]
Definition fd_config.c:148

Definition at line 175 of file fd_config.c.

◆ client_udp_sub_config

const conf_parser_t client_udp_sub_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("port", fr_bio_fd_config_t, dst_port) },
{ FR_CONF_OFFSET_TYPE_FLAGS("src_ipv4addr", FR_TYPE_IPV4_ADDR, 0, fr_bio_fd_config_t, src_ipaddr) },
{ FR_CONF_OFFSET_TYPE_FLAGS("src_ipv6addr", FR_TYPE_IPV6_ADDR, 0, fr_bio_fd_config_t, src_ipaddr) },
{ FR_CONF_OFFSET("src_port", fr_bio_fd_config_t, src_port) },
{ FR_CONF_OFFSET("src_port_start", fr_bio_fd_config_t, src_port_start) },
{ FR_CONF_OFFSET("src_port_end", fr_bio_fd_config_t, src_port_end) },
{ FR_CONF_OFFSET("interface", fr_bio_fd_config_t, interface) },
}

Definition at line 148 of file fd_config.c.

◆ client_udp_unconnected_config

conf_parser_t const client_udp_unconnected_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("udp", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) client_udp_unconnected_sub_config },
}
static const conf_parser_t client_udp_unconnected_sub_config[]
Definition fd_config.c:182

Definition at line 202 of file fd_config.c.

◆ client_udp_unconnected_sub_config

const conf_parser_t client_udp_unconnected_sub_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET_TYPE_FLAGS("src_ipv4addr", FR_TYPE_IPV4_ADDR, 0, fr_bio_fd_config_t, src_ipaddr) },
{ FR_CONF_OFFSET_TYPE_FLAGS("src_ipv6addr", FR_TYPE_IPV6_ADDR, 0, fr_bio_fd_config_t, src_ipaddr) },
{ FR_CONF_OFFSET("interface", fr_bio_fd_config_t, interface) },
{ FR_CONF_OFFSET("src_port_start", fr_bio_fd_config_t, src_port_start) },
{ FR_CONF_OFFSET("src_port_end", fr_bio_fd_config_t, src_port_end) },
}

Definition at line 182 of file fd_config.c.

◆ client_unix_config

conf_parser_t const client_unix_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("unix", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) client_unix_sub_config },
}
static const conf_parser_t client_unix_sub_config[]
Definition fd_config.c:256

Definition at line 262 of file fd_config.c.

◆ client_unix_sub_config

const conf_parser_t client_unix_sub_config[]
static
Initial value:

Definition at line 256 of file fd_config.c.

◆ fr_bio_fd_client_config

const conf_parser_t fr_bio_fd_client_config[]
Initial value:
= {
{ FR_CONF_OFFSET("transport", fr_bio_fd_config_t, transport), .func = client_transport_parse },
{ FR_CONF_OFFSET("async", fr_bio_fd_config_t, async), .dflt = "true" },
}
static int client_transport_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Parse "transport" and then set the subconfig.
Definition fd_config.c:278

Definition at line 314 of file fd_config.c.

◆ fr_bio_fd_server_config

const conf_parser_t fr_bio_fd_server_config[]
Initial value:
= {
{ FR_CONF_OFFSET("transport", fr_bio_fd_config_t, transport), .func = server_transport_parse },
{ FR_CONF_OFFSET("async", fr_bio_fd_config_t, async), .dflt = "true" },
}
static int server_transport_parse(TALLOC_CTX *ctx, void *out, void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Parse "transport" and then set the subconfig.
Definition fd_config.c:437

Definition at line 485 of file fd_config.c.

◆ mode_names

fr_table_num_sorted_t mode_names[]
static
Initial value:
= {
{ L("read-only"), O_RDONLY },
{ L("read-write"), O_RDWR },
{ L("ro"), O_RDONLY },
{ L("rw"), O_RDWR },
{ L("wo"), O_WRONLY },
{ L("write-only"), O_WRONLY },
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition build.h:245

Definition at line 31 of file fd_config.c.

◆ mode_names_len

size_t mode_names_len = NUM_ELEMENTS(mode_names)
static

Definition at line 39 of file fd_config.c.

◆ server_file_config

conf_parser_t const server_file_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("file", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) server_file_sub_config },
}
static const conf_parser_t server_file_sub_config[]
Definition fd_config.c:381

Definition at line 391 of file fd_config.c.

◆ server_file_sub_config

const conf_parser_t server_file_sub_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("permissions", fr_bio_fd_config_t, perm), .dflt = "0600", .func = cf_parse_permissions },
{ FR_CONF_OFFSET("mkdir", fr_bio_fd_config_t, mkdir) },
}

Definition at line 381 of file fd_config.c.

◆ server_peercred_config

const conf_parser_t server_peercred_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("uid", fr_bio_fd_config_t, uid), .func = cf_parse_uid },
{ FR_CONF_OFFSET("gid", fr_bio_fd_config_t, gid), .func = cf_parse_gid },
}
int cf_parse_gid(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
Generic function for resolving GID strings to uid_t values.
Definition cf_parse.c:1852
int cf_parse_uid(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)

Definition at line 397 of file fd_config.c.

◆ server_tcp_config

conf_parser_t const server_tcp_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("tcp", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) server_tcp_sub_config },
}
static const conf_parser_t server_tcp_sub_config[]
Definition fd_config.c:356

Definition at line 375 of file fd_config.c.

◆ server_tcp_sub_config

const conf_parser_t server_tcp_sub_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("port", fr_bio_fd_config_t, src_port) },
{ FR_CONF_OFFSET("interface", fr_bio_fd_config_t, interface) },
{ FR_CONF_OFFSET("delay_tcp_writes", fr_bio_fd_config_t, tcp_delay) },
}

Definition at line 356 of file fd_config.c.

◆ server_transport_configs

conf_parser_t const* server_transport_configs[FR_BIO_FD_TRANSPORT_SIZE]
static
Initial value:
= {
}
static conf_parser_t const server_unix_config[]
Definition fd_config.c:418
static conf_parser_t const server_file_config[]
Definition fd_config.c:391
static conf_parser_t const server_udp_config[]
Definition fd_config.c:350
static conf_parser_t const server_tcp_config[]
Definition fd_config.c:375

Definition at line 427 of file fd_config.c.

◆ server_udp_config

conf_parser_t const server_udp_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("udp", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) server_udp_sub_config },
}
static const conf_parser_t server_udp_sub_config[]
Definition fd_config.c:331

Definition at line 350 of file fd_config.c.

◆ server_udp_sub_config

const conf_parser_t server_udp_sub_config[]
static
Initial value:

Definition at line 331 of file fd_config.c.

◆ server_unix_config

conf_parser_t const server_unix_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("unix", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) server_unix_sub_config },
}
static const conf_parser_t server_unix_sub_config[]
Definition fd_config.c:404

Definition at line 418 of file fd_config.c.

◆ server_unix_sub_config

const conf_parser_t server_unix_sub_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("permissions", fr_bio_fd_config_t, perm), .dflt = "0600", .func = cf_parse_permissions },
{ FR_CONF_OFFSET("mode", fr_bio_fd_config_t, flags), .dflt = "read-only", .func = mode_parse },
{ FR_CONF_OFFSET("mkdir", fr_bio_fd_config_t, mkdir) },
{ FR_CONF_POINTER("peercred", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) server_peercred_config },
}
static const conf_parser_t server_peercred_config[]
Definition fd_config.c:397

Definition at line 404 of file fd_config.c.

◆ transport_types

fr_table_num_sorted_t transport_types[]
static
Initial value:
= {
}

Mapping table of transport names to the transport types/.

Definition at line 81 of file fd_config.c.

◆ transport_types_len

size_t transport_types_len = NUM_ELEMENTS(transport_types)
static

Definition at line 87 of file fd_config.c.