The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
bio.c File Reference

RADIUS BIO transport. More...

#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/pair.h>
#include <freeradius-devel/server/connection.h>
#include <freeradius-devel/unlang/function.h>
#include <freeradius-devel/unlang/load_balance_priv.h>
#include <freeradius-devel/unlang/subrequest.h>
#include <freeradius-devel/util/heap.h>
#include <freeradius-devel/util/rb_expire.h>
#include "track.h"
+ Include dependency graph for bio.c:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bio_handle_ctx_t
 
struct  bio_handle_t
 Track the handle, which is tightly correlated with the FD. More...
 
struct  bio_handle_t.bio
 
struct  bio_request_s
 Connect request_t to local tracking structure. More...
 
struct  bio_thread_t
 
struct  bio_thread_t.bio
 
struct  home_server_t
 

Macros

#define REQUIRE_MA(_h)   (((_h)->ctx.inst->require_message_authenticator == FR_RADIUS_REQUIRE_MA_YES) || *(_h)->ctx.inst->received_message_authenticator)
 

Typedefs

typedef struct bio_request_s bio_request_t
 

Enumerations

enum  bio_limit_ports_t : uint8_t {
  LIMIT_PORTS_NONE = 0 ,
  LIMIT_PORTS_STATIC ,
  LIMIT_PORTS_DYNAMIC
}
 

Functions

static int _bio_handle_free (bio_handle_t *h)
 Free a connection handle, closing associated resources.
 
static int _bio_request_free (bio_request_t *u)
 Free a bio_request_t.
 
static bool bio_at_eof (bio_handle_t const *h)
 Is the connection at EOF?
 
static void bio_connected (fr_bio_t *bio)
 
static void bio_eof (fr_bio_t *bio)
 The BIO chain is at EOF, and has no more data for us.
 
static void bio_error (fr_bio_t *bio)
 
static void bio_request_reset (bio_request_t *u)
 Clear out any connection specific resources from a udp request.
 
static void bio_tracking_entry_log (fr_log_t const *log, fr_log_type_t log_type, char const *file, int line, radius_track_entry_t *te)
 Log additional information about a tracking entry.
 
static int bio_write_blocked (fr_bio_t *bio)
 Pause the connection when a stream BIO is blocked on write.
 
static int bio_write_resume (fr_bio_t *bio)
 Resume the connection when a stream BIO can write again.
 
static bool check_for_zombie (request_t *request, trunk_connection_t *tconn, fr_time_t now, fr_time_t last_sent)
 See if the connection is zombied.
 
static void conn_close (UNUSED fr_event_list_t *el, void *handle, void *uctx)
 Shutdown/close a file descriptor.
 
static void conn_discard (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, void *uctx)
 Read and discard data.
 
static void conn_error (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, int fd_errno, void *uctx)
 Connection errored.
 
static connection_state_t conn_failed (void *handle, connection_state_t state, UNUSED void *uctx)
 Connection failed.
 
static connection_state_t conn_init (void **h_out, connection_t *conn, void *uctx)
 Initialise a new outbound connection.
 
static void conn_init_error (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, int fd_errno, void *uctx)
 Connection errored.
 
static void conn_init_next (UNUSED fr_timer_list_t *tl, UNUSED fr_time_t now, void *uctx)
 Perform the next step of init and negotiation.
 
static void conn_init_readable (fr_event_list_t *el, UNUSED int fd, UNUSED int flags, void *uctx)
 Read the connection during the init and negotiation stage.
 
static void conn_init_timeout (UNUSED fr_timer_list_t *tl, fr_time_t now, void *uctx)
 Status check timer when opening the connection for the first time.
 
static void conn_init_writable (fr_event_list_t *el, UNUSED int fd, UNUSED int flags, void *uctx)
 Send initial negotiation.
 
static void conn_init_writable (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, void *uctx)
 
static void conn_writable_flush (fr_event_list_t *el, int fd, int flags, void *uctx)
 The fd is writable, and the connection is blocked on write.
 
static fr_radius_decode_fail_t decode (TALLOC_CTX *ctx, fr_pair_list_t *reply, uint8_t *response_code, bio_handle_t *h, request_t *request, bio_request_t *u, uint8_t const request_authenticator[static RADIUS_AUTH_VECTOR_LENGTH], uint8_t *data, size_t data_len)
 Decode response packet data, extracting relevant information and validating the packet.
 
static void do_retry (rlm_radius_t const *inst, bio_request_t *u, request_t *request, fr_retry_t const *retry)
 
static void do_signal (rlm_radius_t const *inst, bio_request_t *u, request_t *request, fr_signal_t action)
 
static int encode (bio_handle_t *h, request_t *request, bio_request_t *u, uint8_t id)
 
static fr_cmp_ret_t home_server_cmp (void const *one, void const *two)
 Dynamic home server code.
 
static void home_server_free (void *data)
 
static void mod_dup (request_t *request, bio_request_t *u)
 
static int mod_enqueue (bio_request_t **p_u, fr_retry_config_t const **p_retry_config, rlm_radius_t const *inst, trunk_t *trunk, request_t *request)
 
static unlang_action_t mod_resume (unlang_result_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
 Resume execution of the request, returning the rcode set during trunk execution.
 
static void mod_retry (module_ctx_t const *mctx, request_t *request, fr_retry_t const *retry)
 Handle module retries.
 
static void mod_signal (module_ctx_t const *mctx, request_t *request, fr_signal_t action)
 
static int mod_thread_detach (module_thread_inst_ctx_t const *mctx)
 Free thread data for the submodule.
 
static int mod_thread_instantiate (module_thread_inst_ctx_t const *mctx)
 Instantiate thread data for the submodule.
 
static void mod_write (request_t *request, trunk_request_t *treq, bio_handle_t *h)
 
static void protocol_error_reply (bio_request_t *u, bio_handle_t *h)
 Deal with Protocol-Error replies, and possible negotiation.
 
static void request_cancel (UNUSED connection_t *conn, void *preq_to_reset, trunk_cancel_reason_t reason, UNUSED void *uctx)
 Remove the request from any tracking structures.
 
static void request_complete (request_t *request, NDEBUG_UNUSED void *preq, void *rctx, UNUSED void *uctx)
 Response has already been written to the rctx at this point.
 
static void request_conn_release (connection_t *conn, void *preq_to_reset, UNUSED void *uctx)
 Clear out anything associated with the handle from the request.
 
static void request_demux (UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
 
static void request_fail (request_t *request, NDEBUG_UNUSED void *preq, void *rctx, NDEBUG_UNUSED trunk_request_state_t state, UNUSED void *uctx)
 Write out a canned failure.
 
static void request_mux (UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
 
static fr_cmp_ret_t request_prioritise (void const *one, void const *two)
 
static void request_replicate_demux (UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
 
static void request_replicate_mux (UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
 
static void revive_timeout (UNUSED fr_timer_list_t *tl, UNUSED fr_time_t now, void *uctx)
 Revive a connection after "revive_interval".
 
static fr_bio_verify_action_t rlm_radius_verify (UNUSED fr_bio_t *bio, void *verify_ctx, UNUSED void *packet_ctx, const void *data, size_t *size)
 
static void status_check_alloc (bio_handle_t *h)
 
static void status_check_enqueue (trunk_connection_t *tconn, bio_handle_t *h, bool init)
 Queue a status check packet on an open connection, and wait for the reply.
 
static void status_check_next (UNUSED fr_timer_list_t *tl, UNUSED fr_time_t now, void *uctx)
 Send the next status check, after the previous status check got a reply.
 
static void status_check_reply (trunk_connection_t *tconn, bio_request_t *u, fr_time_t now)
 Deal with replies replies to status checks and possible negotiation.
 
static void status_check_reset (bio_handle_t *h, bio_request_t *u)
 Reset a status_check packet, ready to reuse.
 
static void status_check_timeout (UNUSED fr_timer_list_t *tl, fr_time_t now, void *uctx)
 We timed out, without getting a status check reply.
 
static connection_t * thread_conn_alloc (trunk_connection_t *tconn, fr_event_list_t *el, connection_conf_t const *conf, char const *log_prefix, void *uctx)
 
static void thread_conn_notify (trunk_connection_t *tconn, connection_t *conn, fr_event_list_t *el, trunk_connection_event_t notify_on, UNUSED void *uctx)
 
static void thread_conn_notify (trunk_connection_t *tconn, connection_t *conn, fr_event_list_t *el, trunk_connection_event_t notify_on, void *uctx)
 
static xlat_action_t xlat_radius_client (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 
static xlat_action_t xlat_radius_replicate (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 
static xlat_action_t xlat_sendto_resume (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in)
 
static void xlat_sendto_retry (xlat_ctx_t const *xctx, request_t *request, fr_retry_t const *retry)
 
static void xlat_sendto_signal (xlat_ctx_t const *xctx, request_t *request, fr_signal_t action)
 
static void zombie_timeout (fr_timer_list_t *tl, fr_time_t now, void *uctx)
 Mark a connection dead after "zombie_interval".
 

Variables

static const trunk_io_funcs_t io_funcs
 
static const trunk_io_funcs_t io_replicate_funcs
 
static rlm_rcode_t radius_code_to_rcode [FR_RADIUS_CODE_MAX]
 Turn a reply code into a module rcode;.
 
static xlat_arg_parser_t const xlat_radius_send_args []
 

Detailed Description

RADIUS BIO transport.

Id
f63e1d9f18c596d9f71d513d0101be24493ed9d3

Definition in file bio.c.


Data Structure Documentation

◆ bio_handle_ctx_t

struct bio_handle_ctx_t

Definition at line 46 of file bio.c.

+ Collaboration diagram for bio_handle_ctx_t:
Data Fields
bool dynamic is this a dynamic home server.
fr_event_list_t * el Event list.
fr_bio_fd_config_t fd_config for threads or sockets
fr_bio_fd_info_t const * fd_info status of the FD.
rlm_radius_t const * inst our instance
bio_limit_ports_t limit_source_ports What type of port limit is in use.
char const * module_name the module that opened the connection
fr_radius_ctx_t radius_ctx for signing packets
trunk_t * trunk trunk handler

◆ bio_handle_t

struct bio_handle_t

Track the handle, which is tightly correlated with the FD.

Definition at line 79 of file bio.c.

+ Collaboration diagram for bio_handle_t:
Data Fields
struct bio_handle_t.bio bio
uint8_t * buffer Receive buffer.
size_t buflen Receive buffer length.
connection_t * conn
bio_handle_ctx_t ctx common struct for home servers and BIO handles
bool eof The BIO chain is at EOF, see bio_eof().
int fd File descriptor.
fr_time_t first_sent first time we sent a packet since going idle
unlang_t const * instruction Instruction which triggered the start of the zombie period.
uint8_t last_id Used when replicating to ensure IDs are distributed evenly.
fr_time_t last_idle last time we had nothing to do
fr_time_t last_reply When we last received a reply.
fr_time_t last_sent last time we sent a packet.
uint32_t max_packet_size Our max packet size. may be different from the parent.
fr_time_t mrs_time Most recent sent time which had a reply.
trunk_connection_event_t notify_on The events which the trunk last asked for.
bool status_checking whether we're doing status checks
request_t * status_request
bio_request_t * status_u for sending status check packets
trunk_connection_t * tconn The trunk connection.

Set by thread_conn_notify(), so it is NULL until the trunk has started to use the connection.

radius_track_t * tt RADIUS ID tracking structure.
bool write_blocked A stream write blocked, and has not yet resumed.

See bio_write_blocked() and bio_write_resume().

fr_timer_t * zombie_ev Zombie timeout.

◆ bio_handle_t.bio

struct bio_handle_t.bio

Definition at line 89 of file bio.c.

Data Fields
fr_bio_t * fd raw FD
fr_bio_t * main what we use for IO
fr_bio_t * mem memory wrappers for stream sockets

◆ bio_request_s

struct bio_request_s

Connect request_t to local tracking structure.

Definition at line 150 of file bio.c.

+ Collaboration diagram for bio_request_s:
Data Fields
uint8_t code Packet code.
fr_timer_t * ev timer for retransmissions
fr_pair_list_t extra VPs for debugging, like Proxy-State.
uint8_t id Last ID assigned to this packet.
uint32_t num_replies number of reply packets, sent is in retry.count
uint8_t * packet Packet we write to the network.
size_t packet_len Length of the packet.
size_t partial partially sent data
uint32_t priority copied from request->async->priority
bool proxied is this request being proxied
rlm_rcode_t rcode from the transport
fr_time_t recv_time copied from request->async->recv_time
fr_retry_t retry retransmission timers
radius_track_entry_t * rr ID tracking, resend count, etc.
bool status_check is this packet a status check?
trunk_request_t * treq

◆ bio_thread_t

struct bio_thread_t

Definition at line 61 of file bio.c.

+ Collaboration diagram for bio_thread_t:
Data Fields
struct bio_thread_t.bio bio
connection_t ** connections
bio_handle_ctx_t ctx common struct for home servers and BIO handles
int num_ports

◆ bio_thread_t.bio

struct bio_thread_t.bio

Definition at line 64 of file bio.c.

Data Fields
fr_rb_expire_t expires for proxying / client sending
fr_bio_t * fd writing
uint32_t id for replication

◆ home_server_t

struct home_server_t

Definition at line 175 of file bio.c.

+ Collaboration diagram for home_server_t:
Data Fields
connection_t * connections[] for tracking outbound connections
bio_handle_ctx_t ctx for copying to bio_handle_t
fr_rb_expire_node_t expire
int num_ports

Macro Definition Documentation

◆ REQUIRE_MA

#define REQUIRE_MA (   _h)    (((_h)->ctx.inst->require_message_authenticator == FR_RADIUS_REQUIRE_MA_YES) || *(_h)->ctx.inst->received_message_authenticator)

Typedef Documentation

◆ bio_request_t

typedef struct bio_request_s bio_request_t

Definition at line 74 of file bio.c.

Enumeration Type Documentation

◆ bio_limit_ports_t

Enumerator
LIMIT_PORTS_NONE 

Source port not restricted.

LIMIT_PORTS_STATIC 

Limited source ports for static home servers.

LIMIT_PORTS_DYNAMIC 

Limited source ports for dynamic home servers.

Definition at line 40 of file bio.c.

Function Documentation

◆ _bio_handle_free()

static int _bio_handle_free ( bio_handle_t *  h)
static

Free a connection handle, closing associated resources.

Definition at line 983 of file bio.c.

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

◆ _bio_request_free()

static int _bio_request_free ( bio_request_t *  u)
static

Free a bio_request_t.

Allows us to set break points for debugging.

Definition at line 3191 of file bio.c.

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

◆ bio_at_eof()

static bool bio_at_eof ( bio_handle_t const *  h)
inlinestatic

Is the connection at EOF?

Either the whole BIO chain is at EOF, or the fd is at EOF.

Definition at line 141 of file bio.c.

+ Here is the caller graph for this function:

◆ bio_connected()

static void bio_connected ( fr_bio_t *  bio)
static

Definition at line 1037 of file bio.c.

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

◆ bio_eof()

static void bio_eof ( fr_bio_t *  bio)
static

The BIO chain is at EOF, and has no more data for us.

For TLS, the peer sent us a close_notify alert. The fd BIO may not have seen EOF, as the peer can send a close_notify and keep the TCP connection open.

Definition at line 1061 of file bio.c.

◆ bio_error()

static void bio_error ( fr_bio_t *  bio)
static

Definition at line 1046 of file bio.c.

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

◆ bio_request_reset()

static void bio_request_reset ( bio_request_t *  u)
static

Clear out any connection specific resources from a udp request.

Definition at line 253 of file bio.c.

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

◆ bio_tracking_entry_log()

static void bio_tracking_entry_log ( fr_log_t const *  log,
fr_log_type_t  log_type,
char const *  file,
int  line,
radius_track_entry_t *  te 
)
static

Log additional information about a tracking entry.

Parameters
[in]teTracking entry we're logging information for.
[in]logdestination.
[in]log_typeType of log message.
[in]filethe logging request was made in.
[in]linelogging request was made on.

Definition at line 234 of file bio.c.

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

◆ bio_write_blocked()

static int bio_write_blocked ( fr_bio_t *  bio)
static

Pause the connection when a stream BIO is blocked on write.

Returns
  • 1 for "writes are blocked".

Definition at line 665 of file bio.c.

+ Here is the call graph for this function:

◆ bio_write_resume()

static int bio_write_resume ( fr_bio_t *  bio)
static

Resume the connection when a stream BIO can write again.

Returns
  • 1 for "writes can resume".

Definition at line 700 of file bio.c.

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

◆ check_for_zombie()

static bool check_for_zombie ( request_t *  request,
trunk_connection_t *  tconn,
fr_time_t  now,
fr_time_t  last_sent 
)
static

See if the connection is zombied.

We check for zombie when major events happen:

1) request hits its final timeout
2) request timer hits, and it needs to be retransmitted
3) a DUP packet comes in, and the request needs to be retransmitted
4) we're sending a packet.

There MIGHT not be retries configured, so we MUST check for zombie when any new packet comes in. Similarly, there MIGHT not be new packets, but retries are configured, so we have to check there, too.

Also, the socket might not be writable for a while. There MIGHT be a long time between getting the timer / DUP signal, and the request finally being written to the socket. So we need to check for zombie at BOTH the timeout and the mux / write function.

Returns
  • true if the connection is zombie.
  • false if the connection is not zombie.

Definition at line 2052 of file bio.c.

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

◆ conn_close()

static void conn_close ( UNUSED fr_event_list_t *  el,
void *  handle,
void *  uctx 
)
static

Shutdown/close a file descriptor.

Definition at line 1397 of file bio.c.

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

◆ conn_discard()

static void conn_discard ( UNUSED fr_event_list_t *  el,
UNUSED int  fd,
UNUSED int  flags,
void *  uctx 
)
static

Read and discard data.

Definition at line 1523 of file bio.c.

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

◆ conn_error()

static void conn_error ( UNUSED fr_event_list_t *  el,
UNUSED int  fd,
UNUSED int  flags,
int  fd_errno,
void *  uctx 
)
static

Connection errored.

We were signalled by the event loop that a fatal error occurred on this connection.

Parameters
[in]elThe event list signalling.
[in]fdthat errored.
[in]flagsEl flags.
[in]fd_errnoThe nature of the error.
[in]uctxThe trunk connection handle (tconn).

Definition at line 1558 of file bio.c.

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

◆ conn_failed()

static connection_state_t conn_failed ( void *  handle,
connection_state_t  state,
UNUSED void *  uctx 
)
static

Connection failed.

Parameters
[in]handleof connection that failed.
[in]statethe connection was in when it failed.
[in]uctxUNUSED.

Definition at line 1467 of file bio.c.

+ Here is the caller graph for this function:

◆ conn_init()

static connection_state_t conn_init ( void **  h_out,
connection_t *  conn,
void *  uctx 
)
static

Initialise a new outbound connection.

Parameters
[out]h_outWhere to write the new file descriptor.
[in]connto initialise.
[in]uctxA bio_handle_ctx_t

Definition at line 1146 of file bio.c.

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

◆ conn_init_error()

static void conn_init_error ( UNUSED fr_event_list_t *  el,
UNUSED int  fd,
UNUSED int  flags,
int  fd_errno,
void *  uctx 
)
static

Connection errored.

We were signalled by the event loop that a fatal error occurred on this connection.

Parameters
[in]elThe event list signalling.
[in]fdthat errored.
[in]flagsEl flags.
[in]fd_errnoThe nature of the error.
[in]uctxThe trunk connection handle (tconn).

Definition at line 382 of file bio.c.

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

◆ conn_init_next()

static void conn_init_next ( UNUSED fr_timer_list_t *  tl,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Perform the next step of init and negotiation.

Definition at line 451 of file bio.c.

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

◆ conn_init_readable()

static void conn_init_readable ( fr_event_list_t *  el,
UNUSED int  fd,
UNUSED int  flags,
void *  uctx 
)
static

Read the connection during the init and negotiation stage.

Definition at line 472 of file bio.c.

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

◆ conn_init_timeout()

static void conn_init_timeout ( UNUSED fr_timer_list_t *  tl,
fr_time_t  now,
void *  uctx 
)
static

Status check timer when opening the connection for the first time.

Setup retries, or fail the connection.

Definition at line 403 of file bio.c.

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

◆ conn_init_writable() [1/2]

static void conn_init_writable ( fr_event_list_t *  el,
UNUSED int  fd,
UNUSED int  flags,
void *  uctx 
)
static

Send initial negotiation.

Definition at line 586 of file bio.c.

+ Here is the call graph for this function:

◆ conn_init_writable() [2/2]

static void conn_init_writable ( UNUSED fr_event_list_t *  el,
UNUSED int  fd,
UNUSED int  flags,
void *  uctx 
)
static
+ Here is the caller graph for this function:

◆ conn_writable_flush()

static void conn_writable_flush ( fr_event_list_t *  el,
int  fd,
int  flags,
void *  uctx 
)
static

The fd is writable, and the connection is blocked on write.

Definition at line 1573 of file bio.c.

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

◆ decode()

static fr_radius_decode_fail_t decode ( TALLOC_CTX *  ctx,
fr_pair_list_t *  reply,
uint8_t *  response_code,
bio_handle_t *  h,
request_t *  request,
bio_request_t *  u,
uint8_t const  request_authenticator[static RADIUS_AUTH_VECTOR_LENGTH],
uint8_t *  data,
size_t  data_len 
)
static

Decode response packet data, extracting relevant information and validating the packet.

Parameters
[in]ctxto allocate pairs in.
[out]replyPointer to head of pair list to add reply attributes to.
[out]response_codeThe type of response packet.
[in]hconnection handle.
[in]requestthe request.
[in]uUDP request.
[in]request_authenticatorfrom the original request.
[in]datato decode.
[in]data_lenLength of input data.
Returns
  • FR_RADIUS_FAIL_NONE on success.
  • FR_RADIUS_FAIL_* on failure.

Definition at line 1718 of file bio.c.

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

◆ do_retry()

static void do_retry ( rlm_radius_t const *  inst,
bio_request_t *  u,
request_t *  request,
fr_retry_t const *  retry 
)
static

Definition at line 2184 of file bio.c.

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

◆ do_signal()

static void do_signal ( rlm_radius_t const *  inst,
bio_request_t *  u,
request_t *  request,
fr_signal_t  action 
)
static

Definition at line 3150 of file bio.c.

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

◆ encode()

static int encode ( bio_handle_t *  h,
request_t *  request,
bio_request_t *  u,
uint8_t  id 
)
static

Definition at line 1789 of file bio.c.

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

◆ home_server_cmp()

static fr_cmp_ret_t home_server_cmp ( void const *  one,
void const *  two 
)
static

Dynamic home server code.

Definition at line 3618 of file bio.c.

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

◆ home_server_free()

static void home_server_free ( void *  data)
static

Definition at line 3349 of file bio.c.

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

◆ mod_dup()

static void mod_dup ( request_t *  request,
bio_request_t *  u 
)
static

Definition at line 2127 of file bio.c.

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

◆ mod_enqueue()

static int mod_enqueue ( bio_request_t **  p_u,
fr_retry_config_t const **  p_retry_config,
rlm_radius_t const *  inst,
trunk_t *  trunk,
request_t *  request 
)
static

Definition at line 3212 of file bio.c.

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

◆ mod_resume()

static unlang_action_t mod_resume ( unlang_result_t *  p_result,
module_ctx_t const *  mctx,
UNUSED request_t *  request 
)
static

Resume execution of the request, returning the rcode set during trunk execution.

Definition at line 3129 of file bio.c.

+ Here is the call graph for this function:

◆ mod_retry()

static void mod_retry ( module_ctx_t const *  mctx,
request_t *  request,
fr_retry_t const *  retry 
)
static

Handle module retries.

Definition at line 2176 of file bio.c.

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

◆ mod_signal()

static void mod_signal ( module_ctx_t const *  mctx,
request_t *  request,
fr_signal_t  action 
)
static

Definition at line 3141 of file bio.c.

+ Here is the call graph for this function:

◆ mod_thread_detach()

static int mod_thread_detach ( module_thread_inst_ctx_t const *  mctx)
static

Free thread data for the submodule.

Definition at line 3488 of file bio.c.

◆ mod_thread_instantiate()

static int mod_thread_instantiate ( module_thread_inst_ctx_t const *  mctx)
static

Instantiate thread data for the submodule.

Definition at line 3383 of file bio.c.

+ Here is the call graph for this function:

◆ mod_write()

static void mod_write ( request_t *  request,
trunk_request_t *  treq,
bio_handle_t *  h 
)
static

Definition at line 2286 of file bio.c.

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

◆ protocol_error_reply()

static void protocol_error_reply ( bio_request_t *  u,
bio_handle_t *  h 
)
static

Deal with Protocol-Error replies, and possible negotiation.

Definition at line 2509 of file bio.c.

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

◆ request_cancel()

static void request_cancel ( UNUSED connection_t *  conn,
void *  preq_to_reset,
trunk_cancel_reason_t  reason,
UNUSED void *  uctx 
)
static

Remove the request from any tracking structures.

Frees encoded packets if the request is being moved to a new connection

Definition at line 3018 of file bio.c.

◆ request_complete()

static void request_complete ( request_t *  request,
NDEBUG_UNUSED void *  preq,
void *  rctx,
UNUSED void *  uctx 
)
static

Response has already been written to the rctx at this point.

Definition at line 3104 of file bio.c.

+ Here is the call graph for this function:

◆ request_conn_release()

static void request_conn_release ( connection_t *  conn,
void *  preq_to_reset,
UNUSED void *  uctx 
)
static

Clear out anything associated with the handle from the request.

Definition at line 3050 of file bio.c.

+ Here is the call graph for this function:

◆ request_demux()

static void request_demux ( UNUSED fr_event_list_t *  el,
trunk_connection_t *  tconn,
connection_t *  conn,
UNUSED void *  uctx 
)
static

Definition at line 2685 of file bio.c.

+ Here is the call graph for this function:

◆ request_fail()

static void request_fail ( request_t *  request,
NDEBUG_UNUSED void *  preq,
void *  rctx,
NDEBUG_UNUSED trunk_request_state_t  state,
UNUSED void *  uctx 
)
static

Write out a canned failure.

Definition at line 3075 of file bio.c.

+ Here is the call graph for this function:

◆ request_mux()

static void request_mux ( UNUSED fr_event_list_t *  el,
trunk_connection_t *  tconn,
connection_t *  conn,
UNUSED void *  uctx 
)
static

Definition at line 2267 of file bio.c.

+ Here is the call graph for this function:

◆ request_prioritise()

static fr_cmp_ret_t request_prioritise ( void const *  one,
void const *  two 
)
static

Definition at line 1679 of file bio.c.

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

◆ request_replicate_demux()

static void request_replicate_demux ( UNUSED fr_event_list_t *  el,
trunk_connection_t *  tconn,
connection_t *  conn,
UNUSED void *  uctx 
)
static

Definition at line 2901 of file bio.c.

+ Here is the call graph for this function:

◆ request_replicate_mux()

static void request_replicate_mux ( UNUSED fr_event_list_t *  el,
trunk_connection_t *  tconn,
connection_t *  conn,
UNUSED void *  uctx 
)
static

Definition at line 2881 of file bio.c.

+ Here is the call graph for this function:

◆ revive_timeout()

static void revive_timeout ( UNUSED fr_timer_list_t *  tl,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Revive a connection after "revive_interval".

Definition at line 1888 of file bio.c.

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

◆ rlm_radius_verify()

static fr_bio_verify_action_t rlm_radius_verify ( UNUSED fr_bio_t *  bio,
void *  verify_ctx,
UNUSED void *  packet_ctx,
const void *  data,
size_t *  size 
)
static

Definition at line 1068 of file bio.c.

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

◆ status_check_alloc()

static void status_check_alloc ( bio_handle_t *  h)
static

Definition at line 287 of file bio.c.

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

◆ status_check_enqueue()

static void status_check_enqueue ( trunk_connection_t *  tconn,
bio_handle_t *  h,
bool  init 
)
static

Queue a status check packet on an open connection, and wait for the reply.

The caller has already set up the retry state of the status check. The timer runs when the status check gets no reply before u->retry.next.

Definition at line 2008 of file bio.c.

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

◆ status_check_next()

static void status_check_next ( UNUSED fr_timer_list_t *  tl,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Send the next status check, after the previous status check got a reply.

Definition at line 2622 of file bio.c.

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

◆ status_check_reply()

static void status_check_reply ( trunk_connection_t *  tconn,
bio_request_t *  u,
fr_time_t  now 
)
static

Deal with replies replies to status checks and possible negotiation.

Definition at line 2641 of file bio.c.

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

◆ status_check_reset()

static void status_check_reset ( bio_handle_t *  h,
bio_request_t *  u 
)
static

Reset a status_check packet, ready to reuse.

Definition at line 270 of file bio.c.

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

◆ status_check_timeout()

static void status_check_timeout ( UNUSED fr_timer_list_t *  tl,
fr_time_t  now,
void *  uctx 
)
static

We timed out, without getting a status check reply.

Definition at line 1959 of file bio.c.

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

◆ thread_conn_alloc()

static connection_t * thread_conn_alloc ( trunk_connection_t *  tconn,
fr_event_list_t *  el,
connection_conf_t const *  conf,
char const *  log_prefix,
void *  uctx 
)
static

Definition at line 1494 of file bio.c.

+ Here is the call graph for this function:

◆ thread_conn_notify() [1/2]

static void thread_conn_notify ( trunk_connection_t *  tconn,
connection_t *  conn,
fr_event_list_t *  el,
trunk_connection_event_t  notify_on,
UNUSED void *  uctx 
)
static

Definition at line 1602 of file bio.c.

+ Here is the call graph for this function:

◆ thread_conn_notify() [2/2]

static void thread_conn_notify ( trunk_connection_t *  tconn,
connection_t *  conn,
fr_event_list_t *  el,
trunk_connection_event_t  notify_on,
void *  uctx 
)
static
+ Here is the caller graph for this function:

◆ xlat_radius_client()

static xlat_action_t xlat_radius_client ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t *  out,
xlat_ctx_t const *  xctx,
request_t *  request,
fr_value_box_list_t *  args 
)
static

Definition at line 3669 of file bio.c.

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

◆ xlat_radius_replicate()

static xlat_action_t xlat_radius_replicate ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t *  out,
xlat_ctx_t const *  xctx,
request_t *  request,
fr_value_box_list_t *  args 
)
static

Definition at line 3511 of file bio.c.

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

◆ xlat_sendto_resume()

static xlat_action_t xlat_sendto_resume ( TALLOC_CTX *  ctx,
fr_dcursor_t *  out,
xlat_ctx_t const *  xctx,
request_t *  request,
UNUSED fr_value_box_list_t *  in 
)
static

Definition at line 3630 of file bio.c.

+ Here is the call graph for this function:

◆ xlat_sendto_retry()

static void xlat_sendto_retry ( xlat_ctx_t const *  xctx,
request_t *  request,
fr_retry_t const *  retry 
)
static

Definition at line 3658 of file bio.c.

+ Here is the call graph for this function:

◆ xlat_sendto_signal()

static void xlat_sendto_signal ( xlat_ctx_t const *  xctx,
request_t *  request,
fr_signal_t  action 
)
static

Definition at line 3647 of file bio.c.

+ Here is the call graph for this function:

◆ zombie_timeout()

static void zombie_timeout ( fr_timer_list_t *  tl,
fr_time_t  now,
void *  uctx 
)
static

Mark a connection dead after "zombie_interval".

Definition at line 1900 of file bio.c.

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

Variable Documentation

◆ io_funcs

const trunk_io_funcs_t io_funcs
static
Initial value:
= {
.connection_alloc = thread_conn_alloc,
.connection_notify = thread_conn_notify,
.request_prioritise = request_prioritise,
.request_mux = request_mux,
.request_demux = request_demux,
.request_conn_release = request_conn_release,
.request_complete = request_complete,
.request_fail = request_fail,
.request_cancel = request_cancel,
}
static void request_demux(UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
Definition bio.c:2685
static void request_conn_release(connection_t *conn, void *preq_to_reset, UNUSED void *uctx)
Clear out anything associated with the handle from the request.
Definition bio.c:3050
static fr_cmp_ret_t request_prioritise(void const *one, void const *two)
Definition bio.c:1679
static void request_cancel(UNUSED connection_t *conn, void *preq_to_reset, trunk_cancel_reason_t reason, UNUSED void *uctx)
Remove the request from any tracking structures.
Definition bio.c:3018
static void request_fail(request_t *request, NDEBUG_UNUSED void *preq, void *rctx, NDEBUG_UNUSED trunk_request_state_t state, UNUSED void *uctx)
Write out a canned failure.
Definition bio.c:3075
static void thread_conn_notify(trunk_connection_t *tconn, connection_t *conn, fr_event_list_t *el, trunk_connection_event_t notify_on, void *uctx)
static connection_t * thread_conn_alloc(trunk_connection_t *tconn, fr_event_list_t *el, connection_conf_t const *conf, char const *log_prefix, void *uctx)
Definition bio.c:1494
static void request_mux(UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
Definition bio.c:2267
static void request_complete(request_t *request, NDEBUG_UNUSED void *preq, void *rctx, UNUSED void *uctx)
Response has already been written to the rctx at this point.
Definition bio.c:3104

Definition at line 3356 of file bio.c.

◆ io_replicate_funcs

const trunk_io_funcs_t io_replicate_funcs
static
Initial value:
= {
.connection_alloc = thread_conn_alloc,
.connection_notify = thread_conn_notify,
.request_prioritise = request_prioritise,
.request_mux = request_replicate_mux,
.request_demux = request_replicate_demux,
.request_conn_release = request_conn_release,
.request_complete = request_complete,
.request_fail = request_fail,
.request_cancel = request_cancel,
}
static void request_replicate_mux(UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
Definition bio.c:2881
static void request_replicate_demux(UNUSED fr_event_list_t *el, trunk_connection_t *tconn, connection_t *conn, UNUSED void *uctx)
Definition bio.c:2901

Definition at line 3368 of file bio.c.

◆ radius_code_to_rcode

rlm_rcode_t radius_code_to_rcode[FR_RADIUS_CODE_MAX]
static
Initial value:
= {
}
@ FR_RADIUS_CODE_ACCESS_CHALLENGE
RFC2865 - Access-Challenge.
Definition defs.h:43
@ FR_RADIUS_CODE_DISCONNECT_ACK
RFC3575/RFC5176 - Disconnect-Ack (positive)
Definition defs.h:47
@ FR_RADIUS_CODE_ACCESS_ACCEPT
RFC2865 - Access-Accept.
Definition defs.h:34
@ FR_RADIUS_CODE_ACCOUNTING_RESPONSE
RFC2866 - Accounting-Response.
Definition defs.h:37
@ FR_RADIUS_CODE_COA_NAK
RFC3575/RFC5176 - CoA-Nak (not willing to perform)
Definition defs.h:51
@ FR_RADIUS_CODE_COA_ACK
RFC3575/RFC5176 - CoA-Ack (positive)
Definition defs.h:50
@ FR_RADIUS_CODE_DISCONNECT_NAK
RFC3575/RFC5176 - Disconnect-Nak (not willing to perform)
Definition defs.h:48
@ FR_RADIUS_CODE_PROTOCOL_ERROR
RFC7930 - Protocol-Error (generic NAK)
Definition defs.h:52
@ FR_RADIUS_CODE_ACCESS_REJECT
RFC2865 - Access-Reject.
Definition defs.h:35
@ RLM_MODULE_OK
The module is OK, continue.
Definition rcode.h:49
@ RLM_MODULE_REJECT
Immediately reject the request.
Definition rcode.h:47
@ RLM_MODULE_UPDATED
OK (pairs modified).
Definition rcode.h:55
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
Definition rcode.h:50

Turn a reply code into a module rcode;.

Definition at line 188 of file bio.c.

◆ xlat_radius_send_args

xlat_arg_parser_t const xlat_radius_send_args[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_COMBO_IP_ADDR },
{ .required = true, .single = true, .type = FR_TYPE_UINT16 },
{ .required = true, .single = true, .type = FR_TYPE_STRING },
}
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_UINT16
16 Bit unsigned integer.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
#define XLAT_ARG_PARSER_TERMINATOR
Definition xlat.h:160

Definition at line 3501 of file bio.c.