The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Typedefs | Functions | Variables
rlm_radius_udp.c File Reference

RADIUS UDP transport. More...

#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/pair.h>
#include <freeradius-devel/missing.h>
#include <freeradius-devel/server/connection.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/heap.h>
#include <freeradius-devel/util/udp.h>
#include <sys/socket.h>
#include "rlm_radius.h"
#include "track.h"
+ Include dependency graph for rlm_radius_udp.c:

Go to the source code of this file.

Data Structures

struct  rlm_radius_udp_t
 Static configuration for the module. More...
 
struct  udp_coalesced_t
 
struct  udp_handle_t
 Track the handle, which is tightly correlated with the FD. More...
 
struct  udp_request_s
 Connect request_t to local tracking structure. More...
 
struct  udp_result_t
 
struct  udp_thread_t
 

Macros

#define check(_handle, _len_p)
 

Typedefs

typedef struct udp_request_s udp_request_t
 

Functions

static int _udp_handle_free (udp_handle_t *h)
 Free a connection handle, closing associated resources. More...
 
static int _udp_request_free (udp_request_t *u)
 Free a udp_request_t. More...
 
static int _udp_result_free (udp_result_t *r)
 Free a udp_result_t. More...
 
 CC_NO_UBSAN (function)
 Initialise a new outbound connection. More...
 
static bool check_for_zombie (fr_event_list_t *el, trunk_connection_t *tconn, fr_time_t now, fr_time_t last_sent)
 See if the connection is zombied. More...
 
static void conn_close (UNUSED fr_event_list_t *el, void *handle, UNUSED void *uctx)
 Shutdown/close a file descriptor. More...
 
static void conn_discard (UNUSED fr_event_list_t *el, int fd, UNUSED int flags, void *uctx)
 Read and discard data. More...
 
static void conn_error (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, int fd_errno, void *uctx)
 Connection errored. More...
 
static void conn_error_status_check (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, int fd_errno, void *uctx)
 Connection errored. More...
 
static connection_state_t conn_failed (void *handle, connection_state_t state, UNUSED void *uctx)
 Connection failed. More...
 
static void conn_readable_status_check (fr_event_list_t *el, UNUSED int fd, UNUSED int flags, void *uctx)
 Read the incoming status-check response. More...
 
static void conn_status_check_again (fr_event_list_t *el, UNUSED fr_time_t now, void *uctx)
 Send the next status check packet. More...
 
static void conn_status_check_timeout (fr_event_list_t *el, fr_time_t now, void *uctx)
 Status check timer when opening the connection for the first time. More...
 
static void conn_writable_status_check (fr_event_list_t *el, UNUSED int fd, UNUSED int flags, void *uctx)
 Send our status-check packet as soon as the connection becomes writable. More...
 
static void conn_writable_status_check (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, void *uctx)
 
static decode_fail_t decode (TALLOC_CTX *ctx, fr_pair_list_t *reply, uint8_t *response_code, udp_handle_t *h, request_t *request, udp_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. More...
 
static int encode (rlm_radius_udp_t const *inst, request_t *request, udp_request_t *u, uint8_t id)
 
static unlang_action_t mod_enqueue (rlm_rcode_t *p_result, void **rctx_out, void *instance, void *thread, request_t *request)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static unlang_action_t mod_resume (rlm_rcode_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
 Resume execution of the request, returning the rcode set during trunk execution. More...
 
static void mod_signal (module_ctx_t const *mctx, UNUSED request_t *request, fr_signal_t action)
 
static int mod_thread_instantiate (module_thread_inst_ctx_t const *mctx)
 Instantiate thread data for the submodule. More...
 
static void protocol_error_reply (udp_request_t *u, udp_result_t *r, udp_handle_t *h)
 Deal with Protocol-Error replies, and possible negotiation. More...
 
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. More...
 
static void request_complete (request_t *request, void *preq, void *rctx, UNUSED void *uctx)
 Response has already been written to the rctx at this point. More...
 
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. More...
 
static void request_conn_release_replicate (UNUSED connection_t *conn, void *preq_to_reset, UNUSED void *uctx)
 Clear out anything associated with the handle from the request. More...
 
static void request_fail (request_t *request, void *preq, void *rctx, NDEBUG_UNUSED trunk_request_state_t state, UNUSED void *uctx)
 Write out a canned failure. More...
 
static void request_free (UNUSED request_t *request, void *preq_to_free, UNUSED void *uctx)
 Explicitly free resources associated with the protocol request. More...
 
static int8_t request_prioritise (void const *one, void const *two)
 
static void request_retry (fr_event_list_t *el, fr_time_t now, void *uctx)
 Handle retries when a request is being sent asynchronously. More...
 
static void request_timeout (fr_event_list_t *el, fr_time_t now, void *uctx)
 Handle timeouts when a request is being sent synchronously. More...
 
static void revive_timeout (UNUSED fr_event_list_t *el, UNUSED fr_time_t now, void *uctx)
 Revive a connection after "revive_interval". More...
 
static void status_check_alloc (udp_handle_t *h)
 
static void status_check_next (UNUSED fr_event_list_t *el, UNUSED fr_time_t now, void *uctx)
 Handle retries for a status check. More...
 
static void status_check_reply (trunk_request_t *treq, fr_time_t now)
 Deal with replies replies to status checks and possible negotiation. More...
 
static void status_check_reset (udp_handle_t *h, udp_request_t *u)
 Reset a status_check packet, ready to reuse. More...
 
static void status_check_retry (UNUSED fr_event_list_t *el, fr_time_t now, void *uctx)
 
static void udp_request_reset (udp_request_t *u)
 Clear out any connection specific resources from a udp request. More...
 
static void udp_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. More...
 
static void zombie_timeout (fr_event_list_t *el, fr_time_t now, void *uctx)
 Mark a connection dead after "zombie_interval". More...
 

Variables

static fr_dict_attr_t const * attr_eap_message
 
static fr_dict_attr_t const * attr_error_cause
 
static fr_dict_attr_t const * attr_event_timestamp
 
static fr_dict_attr_t const * attr_extended_attribute_1
 
static fr_dict_attr_t const * attr_message_authenticator
 
static fr_dict_attr_t const * attr_nas_identifier
 
static fr_dict_attr_t const * attr_original_packet_code
 
static fr_dict_attr_t const * attr_packet_type
 
static fr_dict_attr_t const * attr_proxy_state
 
static fr_dict_attr_t const * attr_response_length
 
static fr_dict_attr_t const * attr_user_password
 
static fr_dict_t const * dict_radius
 
static const conf_parser_t module_config []
 
static rlm_rcode_t radius_code_to_rcode [FR_RADIUS_CODE_MAX]
 Turn a reply code into a module rcode;. More...
 
rlm_radius_io_t rlm_radius_udp
 
fr_dict_autoload_t rlm_radius_udp_dict []
 
fr_dict_attr_autoload_t rlm_radius_udp_dict_attr []
 

Detailed Description

RADIUS UDP transport.

Id
aabc07be690e2376cc46eceb382d3ab6d60c1b99

Definition in file rlm_radius_udp.c.


Data Structure Documentation

◆ rlm_radius_udp_t

struct rlm_radius_udp_t

Static configuration for the module.

Definition at line 51 of file rlm_radius_udp.c.

+ Collaboration diagram for rlm_radius_udp_t:
Data Fields
fr_radius_ctx_t common_ctx
CONF_SECTION * config
fr_ipaddr_t dst_ipaddr IP of the home server.
uint16_t dst_port Port of the home server.
char const * interface Interface to bind to.
uint32_t max_packet_size Maximum packet size.
uint16_t max_send_coalesce Maximum number of packets to coalesce into one mmsg call.
rlm_radius_t * parent rlm_radius instance.
uint32_t recv_buff How big the kernel's receive buffer should be.
bool recv_buff_is_set Whether we were provided with a recv_buf.
bool replicate Copied from parent->replicate.
char const * secret Shared secret.
uint32_t send_buff How big the kernel's send buffer should be.
bool send_buff_is_set Whether we were provided with a send_buf.
fr_ipaddr_t src_ipaddr IP we open our socket on.
trunk_conf_t trunk_conf trunk configuration

◆ udp_coalesced_t

struct udp_coalesced_t

Definition at line 92 of file rlm_radius_udp.c.

+ Collaboration diagram for udp_coalesced_t:
Data Fields
struct iovec out Describes buffer to send.
trunk_request_t * treq Used for signalling.

◆ udp_handle_t

struct udp_handle_t

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

Definition at line 100 of file rlm_radius_udp.c.

+ Collaboration diagram for udp_handle_t:
Data Fields
int active active packets
uint8_t * buffer Receive buffer.
size_t buflen Receive buffer length.
udp_coalesced_t * coalesced Outbound coalesced requests.
trunk_request_t ** coalesced Outbound coalesced requests.
int fd File descriptor.
fr_time_t first_sent first time we sent a packet since going idle
int id starts at 1.
rlm_radius_udp_t const * inst Our module instance.
rlm_tacacs_tcp_t const * inst Our module instance.
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.
struct mmsghdr * mmsgvec Vector of inbound/outbound packets.
char const * module_name the module that opened the connection
fr_time_t mrs_time Most recent sent time which had a reply.
char const * name From IP PORT to IP PORT.
tcp_buffer_t recv receive buffer
tcp_buffer_t send send buffer
size_t send_buff_actual What we believe the maximum SO_SNDBUF size to be.

We don't try and encode more packet data than this in one go.

uint32_t session_id for TACACS+ "security".
fr_ipaddr_t src_ipaddr Source IP address.

May be altered on bind to be the actual IP address packets will be sent on. This is why we can't use the inst src_ipaddr field.

uint16_t src_port Source port specific to this connection.
Todo:
  • not set by socket_client_tcp()
bool status_checking whether we're doing status checks
udp_result_t * status_r for faking out status checks as real packets
request_t * status_request
udp_request_t * status_u for sending status check packets
trunk_connection_t * tconn trunk connection
udp_thread_t * thread
trunk_request_t * tracking[UINT8_MAX] all sequential!
radius_track_t * tt RADIUS ID tracking structure.
fr_event_timer_t const * zombie_ev Zombie timeout.

◆ udp_request_s

struct udp_request_s

Connect request_t to local tracking structure.

Definition at line 150 of file rlm_radius_udp.c.

+ Collaboration diagram for udp_request_s:
Data Fields
uint8_t code Packet code.
fr_event_timer_t const * 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
bool outstanding are we waiting for a reply?
uint8_t * packet Packet we write to the network.
size_t packet_len Length of the packet.
uint32_t priority copied from request->async->priority
fr_time_t recv_time copied from request->async->recv_time
bool require_message_authenticator saved from the original packet.
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?
bool synchronous cached from inst->parent->synchronous

◆ udp_result_t

struct udp_result_t

Definition at line 85 of file rlm_radius_udp.c.

+ Collaboration diagram for udp_result_t:
Data Fields
rlm_rcode_t rcode from the transport
trunk_request_t * treq

◆ udp_thread_t

struct udp_thread_t

Definition at line 77 of file rlm_radius_udp.c.

+ Collaboration diagram for udp_thread_t:
Data Fields
fr_event_list_t * el Event list.
rlm_radius_udp_t const * inst our instance
rlm_tacacs_tcp_t const * inst our instance
trunk_t * trunk trunk handler

Macro Definition Documentation

◆ check

#define check (   _handle,
  _len_p 
)
Value:
fr_radius_ok((_handle)->buffer, (size_t *)(_len_p), \
(_handle)->thread->inst->parent->max_attributes, false, NULL)
static int const char char buffer[256]
Definition: acutest.h:574
bool fr_radius_ok(uint8_t const *packet, size_t *packet_len_p, uint32_t max_attributes, bool require_message_authenticator, decode_fail_t *reason)
Definition: merged_model.c:259

Definition at line 45 of file rlm_radius_udp.c.

Typedef Documentation

◆ udp_request_t

typedef struct udp_request_s udp_request_t

Definition at line 1 of file rlm_radius_udp.c.

Function Documentation

◆ _udp_handle_free()

static int _udp_handle_free ( udp_handle_t h)
static

Free a connection handle, closing associated resources.

Definition at line 681 of file rlm_radius_udp.c.

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

◆ _udp_request_free()

static int _udp_request_free ( udp_request_t u)
static

Free a udp_request_t.

Definition at line 2520 of file rlm_radius_udp.c.

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

◆ _udp_result_free()

static int _udp_result_free ( udp_result_t r)
static

Free a udp_result_t.

Allows us to set break points for debugging.

Definition at line 2502 of file rlm_radius_udp.c.

+ Here is the caller graph for this function:

◆ CC_NO_UBSAN()

CC_NO_UBSAN ( function  )

Initialise a new outbound connection.

A special version of the trunk/event loop glue function which always discards incoming data.

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

Definition at line 712 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ check_for_zombie()

static bool check_for_zombie ( fr_event_list_t el,
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 1396 of file rlm_radius_udp.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,
UNUSED void *  uctx 
)
static

Shutdown/close a file descriptor.

Definition at line 871 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ conn_discard()

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

Read and discard data.

Definition at line 952 of file rlm_radius_udp.c.

+ Here is the call 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 987 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ conn_error_status_check()

static void conn_error_status_check ( 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 432 of file rlm_radius_udp.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 898 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ conn_readable_status_check()

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

Read the incoming status-check response.

If it's correct mark the connection as connected

Definition at line 515 of file rlm_radius_udp.c.

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

◆ conn_status_check_again()

static void conn_status_check_again ( fr_event_list_t el,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Send the next status check packet.

Definition at line 501 of file rlm_radius_udp.c.

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

◆ conn_status_check_timeout()

static void conn_status_check_timeout ( fr_event_list_t el,
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 453 of file rlm_radius_udp.c.

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

◆ conn_writable_status_check() [1/2]

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

Send our status-check packet as soon as the connection becomes writable.

Definition at line 619 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ conn_writable_status_check() [2/2]

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

◆ decode()

static decode_fail_t decode ( TALLOC_CTX *  ctx,
fr_pair_list_t reply,
uint8_t response_code,
udp_handle_t h,
request_t request,
udp_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
  • DECODE_FAIL_NONE on success.
  • DECODE_FAIL_* on failure.

Definition at line 1139 of file rlm_radius_udp.c.

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

◆ encode()

static int encode ( rlm_radius_udp_t const *  inst,
request_t request,
udp_request_t u,
uint8_t  id 
)
static

Definition at line 1209 of file rlm_radius_udp.c.

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

◆ mod_enqueue()

static unlang_action_t mod_enqueue ( rlm_rcode_t p_result,
void **  rctx_out,
void *  instance,
void *  thread,
request_t request 
)
static

Definition at line 2529 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 2652 of file rlm_radius_udp.c.

◆ mod_resume()

static unlang_action_t mod_resume ( rlm_rcode_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 2428 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ mod_signal()

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

Definition at line 2438 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ 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 2614 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ protocol_error_reply()

static void protocol_error_reply ( udp_request_t u,
udp_result_t r,
udp_handle_t h 
)
static

Deal with Protocol-Error replies, and possible negotiation.

Definition at line 1965 of file rlm_radius_udp.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 2309 of file rlm_radius_udp.c.

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

◆ request_complete()

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

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

Definition at line 2394 of file rlm_radius_udp.c.

+ Here is the call graph for this function:
+ Here is the caller 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 2341 of file rlm_radius_udp.c.

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

◆ request_conn_release_replicate()

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

Clear out anything associated with the handle from the request.

Definition at line 2361 of file rlm_radius_udp.c.

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

◆ request_fail()

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

Write out a canned failure.

Definition at line 2373 of file rlm_radius_udp.c.

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

◆ request_free()

static void request_free ( UNUSED request_t request,
void *  preq_to_free,
UNUSED void *  uctx 
)
static

Explicitly free resources associated with the protocol request.

Definition at line 2411 of file rlm_radius_udp.c.

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

◆ request_prioritise()

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

Definition at line 1098 of file rlm_radius_udp.c.

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

◆ request_retry()

static void request_retry ( fr_event_list_t el,
fr_time_t  now,
void *  uctx 
)
static

Handle retries when a request is being sent asynchronously.

Definition at line 1476 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ request_timeout()

static void request_timeout ( fr_event_list_t el,
fr_time_t  now,
void *  uctx 
)
static

Handle timeouts when a request is being sent synchronously.

Definition at line 1453 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ revive_timeout()

static void revive_timeout ( UNUSED fr_event_list_t el,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Revive a connection after "revive_interval".

Definition at line 1326 of file rlm_radius_udp.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 ( udp_handle_t h)
static

Definition at line 323 of file rlm_radius_udp.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_event_list_t el,
UNUSED fr_time_t  now,
void *  uctx 
)
static

Handle retries for a status check.

Definition at line 2080 of file rlm_radius_udp.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_request_t treq,
fr_time_t  now 
)
static

Deal with replies replies to status checks and possible negotiation.

Definition at line 2095 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ status_check_reset()

static void status_check_reset ( udp_handle_t h,
udp_request_t u 
)
static

Reset a status_check packet, ready to reuse.

Definition at line 306 of file rlm_radius_udp.c.

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

◆ status_check_retry()

static void status_check_retry ( UNUSED fr_event_list_t el,
fr_time_t  now,
void *  uctx 
)
static

Definition at line 1521 of file rlm_radius_udp.c.

+ Here is the call graph for this function:

◆ udp_request_reset()

static void udp_request_reset ( udp_request_t u)
static

Clear out any connection specific resources from a udp request.

Definition at line 291 of file rlm_radius_udp.c.

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

◆ udp_tracking_entry_log()

static void udp_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 272 of file rlm_radius_udp.c.

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

◆ zombie_timeout()

static void zombie_timeout ( fr_event_list_t el,
fr_time_t  now,
void *  uctx 
)
static

Mark a connection dead after "zombie_interval".

Definition at line 1338 of file rlm_radius_udp.c.

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

Variable Documentation

◆ attr_eap_message

fr_dict_attr_t const* attr_eap_message
static

Definition at line 208 of file rlm_radius_udp.c.

◆ attr_error_cause

fr_dict_attr_t const* attr_error_cause
static

Definition at line 204 of file rlm_radius_udp.c.

◆ attr_event_timestamp

fr_dict_attr_t const* attr_event_timestamp
static

Definition at line 205 of file rlm_radius_udp.c.

◆ attr_extended_attribute_1

fr_dict_attr_t const* attr_extended_attribute_1
static

Definition at line 206 of file rlm_radius_udp.c.

◆ attr_message_authenticator

fr_dict_attr_t const* attr_message_authenticator
static

Definition at line 207 of file rlm_radius_udp.c.

◆ attr_nas_identifier

fr_dict_attr_t const* attr_nas_identifier
static

Definition at line 209 of file rlm_radius_udp.c.

◆ attr_original_packet_code

fr_dict_attr_t const* attr_original_packet_code
static

Definition at line 210 of file rlm_radius_udp.c.

◆ attr_packet_type

fr_dict_attr_t const* attr_packet_type
static

Definition at line 214 of file rlm_radius_udp.c.

◆ attr_proxy_state

fr_dict_attr_t const* attr_proxy_state
static

Definition at line 211 of file rlm_radius_udp.c.

◆ attr_response_length

fr_dict_attr_t const* attr_response_length
static

Definition at line 212 of file rlm_radius_udp.c.

◆ attr_user_password

fr_dict_attr_t const* attr_user_password
static

Definition at line 213 of file rlm_radius_udp.c.

◆ dict_radius

fr_dict_t const* dict_radius
static

Definition at line 196 of file rlm_radius_udp.c.

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("port", rlm_radius_udp_t, dst_port) },
{ FR_CONF_OFFSET("interface", rlm_radius_udp_t, interface) },
{ FR_CONF_OFFSET_IS_SET("recv_buff", FR_TYPE_UINT32, 0, rlm_radius_udp_t, recv_buff) },
{ FR_CONF_OFFSET_IS_SET("send_buff", FR_TYPE_UINT32, 0, rlm_radius_udp_t, send_buff) },
{ FR_CONF_OFFSET("max_packet_size", rlm_radius_udp_t, max_packet_size), .dflt = "4096" },
{ FR_CONF_OFFSET("max_send_coalesce", rlm_radius_udp_t, max_send_coalesce), .dflt = "1024" },
{ FR_CONF_OFFSET_TYPE_FLAGS("src_ipv4addr", FR_TYPE_IPV4_ADDR, 0, rlm_radius_udp_t, src_ipaddr) },
{ FR_CONF_OFFSET_TYPE_FLAGS("src_ipv6addr", FR_TYPE_IPV6_ADDR, 0, rlm_radius_udp_t, src_ipaddr) },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627
#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:268
#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:282
#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:256
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: cf_parse.h:405
#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
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
Definition: merged_model.c:86
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
Definition: merged_model.c:88
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
Definition: merged_model.c:91
static char * secret
Definition: radclient-ng.c:69
Static configuration for the module.

Definition at line 172 of file rlm_radius_udp.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:43
@ RLM_MODULE_REJECT
Immediately reject the request.
Definition: rcode.h:41
@ RLM_MODULE_UPDATED
OK (pairs modified).
Definition: rcode.h:49
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
Definition: rcode.h:44

Turn a reply code into a module rcode;.

Definition at line 235 of file rlm_radius_udp.c.

◆ rlm_radius_udp

rlm_radius_io_t rlm_radius_udp
Initial value:
= {
.common = {
.name = "radius_udp",
.inst_size = sizeof(rlm_radius_udp_t),
.thread_inst_size = sizeof(udp_thread_t),
.thread_inst_type = "udp_thread_t",
.config = module_config,
.instantiate = mod_instantiate,
.thread_instantiate = mod_thread_instantiate,
},
.enqueue = mod_enqueue,
.signal = mod_signal,
.resume = mod_resume,
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:63
static void mod_signal(module_ctx_t const *mctx, UNUSED request_t *request, fr_signal_t action)
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Instantiate thread data for the submodule.
static unlang_action_t mod_resume(rlm_rcode_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 unlang_action_t mod_enqueue(rlm_rcode_t *p_result, void **rctx_out, void *instance, void *thread, request_t *request)
static const conf_parser_t module_config[]
static int mod_instantiate(module_inst_ctx_t const *mctx)

Definition at line 2756 of file rlm_radius_udp.c.

◆ rlm_radius_udp_dict

fr_dict_autoload_t rlm_radius_udp_dict
Initial value:
= {
{ .out = &dict_radius, .proto = "radius" },
{ NULL }
}
static fr_dict_t const * dict_radius

Definition at line 199 of file rlm_radius_udp.c.

◆ rlm_radius_udp_dict_attr

fr_dict_attr_autoload_t rlm_radius_udp_dict_attr
Initial value:
= {
{ .out = &attr_error_cause, .name = "Error-Cause", .type = FR_TYPE_UINT32, .dict = &dict_radius },
{ .out = &attr_event_timestamp, .name = "Event-Timestamp", .type = FR_TYPE_DATE, .dict = &dict_radius},
{ .out = &attr_extended_attribute_1, .name = "Extended-Attribute-1", .type = FR_TYPE_TLV, .dict = &dict_radius},
{ .out = &attr_message_authenticator, .name = "Message-Authenticator", .type = FR_TYPE_OCTETS, .dict = &dict_radius},
{ .out = &attr_eap_message, .name = "EAP-Message", .type = FR_TYPE_OCTETS, .dict = &dict_radius},
{ .out = &attr_nas_identifier, .name = "NAS-Identifier", .type = FR_TYPE_STRING, .dict = &dict_radius},
{ .out = &attr_original_packet_code, .name = "Extended-Attribute-1.Original-Packet-Code", .type = FR_TYPE_UINT32, .dict = &dict_radius},
{ .out = &attr_proxy_state, .name = "Proxy-State", .type = FR_TYPE_OCTETS, .dict = &dict_radius},
{ .out = &attr_response_length, .name = "Extended-Attribute-1.Response-Length", .type = FR_TYPE_UINT32, .dict = &dict_radius },
{ .out = &attr_user_password, .name = "User-Password", .type = FR_TYPE_STRING, .dict = &dict_radius},
{ .out = &attr_packet_type, .name = "Packet-Type", .type = FR_TYPE_UINT32, .dict = &dict_radius },
{ NULL }
}
@ FR_TYPE_TLV
Contains nested attributes.
Definition: merged_model.c:118
@ FR_TYPE_STRING
String of printable characters.
Definition: merged_model.c:83
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
Definition: merged_model.c:111
@ FR_TYPE_OCTETS
Raw octets.
Definition: merged_model.c:84
static fr_dict_attr_t const * attr_packet_type
static fr_dict_attr_t const * attr_user_password
static fr_dict_attr_t const * attr_eap_message
static fr_dict_attr_t const * attr_extended_attribute_1
static fr_dict_attr_t const * attr_error_cause
static fr_dict_attr_t const * attr_proxy_state
static fr_dict_attr_t const * attr_nas_identifier
static fr_dict_attr_t const * attr_original_packet_code
static fr_dict_attr_t const * attr_event_timestamp
static fr_dict_attr_t const * attr_response_length
static fr_dict_attr_t const * attr_message_authenticator

Definition at line 217 of file rlm_radius_udp.c.