The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Add an additional log destination for any given request. More...
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/server/connection.h>
#include <sys/uio.h>
Go to the source code of this file.
Data Structures | |
struct | logtee_net_t |
struct | rlm_logtee_t |
logtee module instance More... | |
struct | rlm_logtee_t.file |
struct | rlm_logtee_t.unix_sock |
struct | rlm_logtee_thread_t |
Per-thread instance data. More... | |
Enumerations | |
enum | logtee_dst_t { LOGTEE_DST_INVALID = 0 , LOGTEE_DST_FILE , LOGTEE_DST_UNIX , LOGTEE_DST_UDP , LOGTEE_DST_TCP } |
Functions | |
static void | _logtee_conn_close (UNUSED fr_event_list_t *el, void *h, UNUSED void *uctx) |
Shutdown/close a file descriptor. More... | |
static void | _logtee_conn_error (UNUSED fr_event_list_t *el, int sock, UNUSED int flags, int fd_errno, void *uctx) |
Connection errored. More... | |
static connection_state_t | _logtee_conn_open (UNUSED fr_event_list_t *el, UNUSED void *h, void *uctx) |
Process notification that fd is open. More... | |
static void | _logtee_conn_read (UNUSED fr_event_list_t *el, int sock, UNUSED int flags, void *uctx) |
Drain any data we received. More... | |
static void | _logtee_conn_writable (UNUSED fr_event_list_t *el, int sock, UNUSED int flags, void *uctx) |
There's space available to write data, so do that... More... | |
CC_NO_UBSAN (function) | |
Initialise a new outbound connection. More... | |
static void | logtee_fd_active (rlm_logtee_thread_t *t) |
Set the socket to active. More... | |
static void | logtee_fd_idle (rlm_logtee_thread_t *t) |
Set the socket to idle. More... | |
static void | logtee_it (fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt, va_list ap, void *uctx)) |
static void | logtee_it (fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, UNUSED char const *file, UNUSED int line, char const *fmt, va_list ap, void *uctx) |
Logging callback to write log messages to a destination. More... | |
static unlang_action_t | mod_insert_logtee (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
Add our logging destination to the linked list of logging destinations (if it doesn't already exist) More... | |
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
static int | mod_thread_instantiate (module_thread_inst_ctx_t const *mctx) |
Create thread-specific connections and buffers. More... | |
Variables | |
static fr_dict_attr_t const * | attr_log_level |
static fr_dict_attr_t const * | attr_log_message |
static fr_dict_attr_t const * | attr_log_type |
static fr_dict_t const * | dict_freeradius |
static const conf_parser_t | file_config [] |
static fr_table_num_sorted_t const | logtee_dst_table [] |
static size_t | logtee_dst_table_len = NUM_ELEMENTS(logtee_dst_table) |
static const conf_parser_t | module_config [] |
module_rlm_t | rlm_logtee |
fr_dict_autoload_t | rlm_logtee_dict [] |
fr_dict_attr_autoload_t | rlm_logtee_dict_attr [] |
static const conf_parser_t | tcp_config [] |
static const conf_parser_t | udp_config [] |
static const conf_parser_t | unix_config [] |
Add an additional log destination for any given request.
Definition in file rlm_logtee.c.
struct logtee_net_t |
Definition at line 70 of file rlm_logtee.c.
Data Fields | ||
---|---|---|
fr_ipaddr_t | dst_ipaddr | Network server. |
uint16_t | port | Network port. |
fr_ipaddr_t | src_ipaddr | Send requests from a given src_ipaddr. |
struct rlm_logtee_t |
logtee module instance
Definition at line 78 of file rlm_logtee.c.
Data Fields | ||
---|---|---|
size_t | buffer_depth | How big our circular buffer should be. |
fr_time_delta_t | connection_timeout | How long to wait to open a socket. |
char const * | delimiter |
Line termination string (usually ). |
size_t | delimiter_len | Length of line termination string. |
struct rlm_logtee_t | file | |
logtee_dst_t | log_dst | Logging destination. |
char const * | log_dst_str | Logging destination string. |
tmpl_t * | log_fmt | Source of log messages. |
char const * | name | Module instance name. |
fr_time_delta_t | reconnection_delay | How long to wait to retry. |
logtee_net_t | tcp | TCP server. |
logtee_net_t | udp | UDP server. |
struct rlm_logtee_t | unix_sock |
struct rlm_logtee_t.file |
Definition at line 91 of file rlm_logtee.c.
Data Fields | ||
---|---|---|
bool | escape | Do filename escaping, yes / no. |
xlat_escape_legacy_t | escape_func | Escape function. |
gid_t | group | Resolved gid. |
char const * | group_str | Group to set on new files. |
char const * | name | File to write to. |
uint32_t | permissions | Permissions to use when creating new files. |
struct rlm_logtee_t.unix_sock |
Definition at line 100 of file rlm_logtee.c.
Data Fields | ||
---|---|---|
char const * | path | Where the UNIX socket lives. |
struct rlm_logtee_thread_t |
Per-thread instance data.
Contains buffers and connection handles specific to the thread.
Definition at line 115 of file rlm_logtee.c.
Data Fields | ||
---|---|---|
connection_t * | conn | Connection to our log destination. |
fr_event_list_t * | el | This thread's event list. |
fr_fring_t * | fring | Circular buffer used to batch up messages. |
rlm_logtee_t const * | inst | Instance of logtee. |
fr_pair_t * | lvl | Temporary value pair holding the log lvl. |
fr_pair_t * | msg | Temporary value pair holding the message value. |
TALLOC_CTX * | msg_pool | A 1k talloc pool to hold the log message whilst it's being expanded. |
bool | pending | We have pending messages to write. |
fr_pair_t * | type | Temporary value pair holding the message type. |
enum logtee_dst_t |
Enumerator | |
---|---|
LOGTEE_DST_INVALID | |
LOGTEE_DST_FILE | Log to a file. |
LOGTEE_DST_UNIX | Log via Unix socket. |
LOGTEE_DST_UDP | Log via UDP. |
LOGTEE_DST_TCP | Log via TCP. |
Definition at line 54 of file rlm_logtee.c.
|
static |
Shutdown/close a file descriptor.
Definition at line 354 of file rlm_logtee.c.
|
static |
Connection errored.
Definition at line 213 of file rlm_logtee.c.
|
static |
Process notification that fd is open.
Definition at line 366 of file rlm_logtee.c.
|
static |
Drain any data we received.
We don't care about this data, we just don't want the kernel to signal the other side that our read buffer's full.
Definition at line 230 of file rlm_logtee.c.
|
static |
There's space available to write data, so do that...
Definition at line 263 of file rlm_logtee.c.
CC_NO_UBSAN | ( | function | ) |
Initialise a new outbound connection.
[out] | h_out | Where to write the new file descriptor. |
[in] | conn | being initialised. |
[in] | uctx | A rlm_logtee_thread_t. |
Definition at line 390 of file rlm_logtee.c.
|
static |
Set the socket to active.
We have messages we want to send, so need to know when the socket is writable.
[in] | t | Thread instance containing the connection. |
Definition at line 337 of file rlm_logtee.c.
|
static |
Set the socket to idle.
If the other side is sending back garbage, we want to drain it so our buffer doesn't fill up.
[in] | t | Thread instance containing the connection. |
Definition at line 317 of file rlm_logtee.c.
|
static |
|
static |
Logging callback to write log messages to a destination.
This allows the logging destination to be customised on a per request basis.
[in] | type | What type of message this is (error, warn, info, debug). |
[in] | lvl | At what logging level this message should be output. |
[in] | request | The current request. |
[in] | file | src file the log message was generated in. |
[in] | line | number the log message was generated on. |
[in] | fmt | sprintf style fmt string. |
[in] | ap | Arguments for the fmt string. |
[in] | uctx | Context data for the log function. |
Definition at line 455 of file rlm_logtee.c.
|
static |
Add our logging destination to the linked list of logging destinations (if it doesn't already exist)
[in] | p_result | the result of the module call:
|
[in] | mctx | Module calling ctx. |
[in] | request | request to add our log destination to. |
Definition at line 526 of file rlm_logtee.c.
|
static |
|
static |
Create thread-specific connections and buffers.
[in] | mctx | specific data. |
Definition at line 556 of file rlm_logtee.c.
|
static |
Definition at line 187 of file rlm_logtee.c.
|
static |
Definition at line 188 of file rlm_logtee.c.
|
static |
Definition at line 189 of file rlm_logtee.c.
|
static |
Definition at line 179 of file rlm_logtee.c.
|
static |
Definition at line 132 of file rlm_logtee.c.
|
static |
Definition at line 62 of file rlm_logtee.c.
|
static |
Definition at line 68 of file rlm_logtee.c.
|
static |
Definition at line 158 of file rlm_logtee.c.
module_rlm_t rlm_logtee |
Definition at line 659 of file rlm_logtee.c.
fr_dict_autoload_t rlm_logtee_dict |
Definition at line 182 of file rlm_logtee.c.
fr_dict_attr_autoload_t rlm_logtee_dict_attr |
Definition at line 192 of file rlm_logtee.c.
|
static |
Definition at line 151 of file rlm_logtee.c.
|
static |
Definition at line 145 of file rlm_logtee.c.
|
static |
Definition at line 140 of file rlm_logtee.c.