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

BFD handler for UDP. More...

#include <netdb.h>
#include <freeradius-devel/server/protocol.h>
#include <freeradius-devel/util/udp.h>
#include <freeradius-devel/util/trie.h>
#include <freeradius-devel/bfd/bfd.h>
#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/schedule.h>
#include "session.h"
+ Include dependency graph for proto_bfd_udp.c:

Go to the source code of this file.

Data Structures

struct  proto_bfd_udp_t
 
struct  proto_bfd_udp_thread_t
 

Functions

static int mod_bootstrap (module_inst_ctx_t const *mctx)
 
static fr_client_tmod_client_find (fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto)
 
static void mod_event_list_set (fr_listen_t *li, fr_event_list_t *el, void *nr)
 Set the event list for a new socket. More...
 
static int mod_fd_set (fr_listen_t *li, int fd)
 Set the file descriptor for this socket. More...
 
static char const * mod_name (fr_listen_t *li)
 
static void mod_network_get (void *instance, int *ipproto, bool *dynamic_clients, fr_trie_t const **trie)
 
static int mod_open (fr_listen_t *li)
 Open a UDP listener for RADIUS. More...
 
static ssize_t mod_read (fr_listen_t *li, void **packet_ctx, fr_time_t *recv_time_p, uint8_t *buffer, size_t buffer_len, size_t *leftover)
 
static ssize_t mod_write (fr_listen_t *li, void *packet_ctx, UNUSED fr_time_t request_time, uint8_t *buffer, size_t buffer_len, UNUSED size_t written)
 

Variables

static const conf_parser_t networks_config []
 
fr_app_io_t proto_bfd_udp
 
static const conf_parser_t udp_listen_config []
 

Detailed Description

BFD handler for UDP.

Id
72ad305eda6f047dc6293cb856645f72b901f6cf

Definition in file proto_bfd_udp.c.


Data Structure Documentation

◆ proto_bfd_udp_t

struct proto_bfd_udp_t

Definition at line 47 of file proto_bfd_udp.c.

+ Collaboration diagram for proto_bfd_udp_t:
Data Fields
fr_ipaddr_t * allow allowed networks for dynamic clients
CONF_SECTION * cs our configuration
fr_ipaddr_t * deny denied networks for dynamic clients
bool dynamic_clients whether we have dynamic clients
char const * interface Interface to bind to.
fr_ipaddr_t ipaddr IP address to listen on.
bool only_state_changes on read(), only send packets which signal a state change
fr_rb_tree_t * peers our peers
uint16_t port Port to listen on.
char const * port_name Name of the port for getservent().
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_buff.
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_buff.
char const * server_name virtual server name
fr_trie_t * trie for parsed networks
uint8_t ttl default ttl

◆ proto_bfd_udp_thread_t

struct proto_bfd_udp_thread_t

Definition at line 37 of file proto_bfd_udp.c.

+ Collaboration diagram for proto_bfd_udp_thread_t:
Data Fields
fr_io_address_t * connection for connected sockets.
char const * name socket name
int sockfd
fr_stats_t stats statistics for this socket

Function Documentation

◆ mod_bootstrap()

static int mod_bootstrap ( module_inst_ctx_t const *  mctx)
static

Definition at line 356 of file proto_bfd_udp.c.

+ Here is the call graph for this function:

◆ mod_client_find()

static fr_client_t* mod_client_find ( fr_listen_t li,
fr_ipaddr_t const *  ipaddr,
int  ipproto 
)
static

Definition at line 474 of file proto_bfd_udp.c.

+ Here is the call graph for this function:

◆ mod_event_list_set()

static void mod_event_list_set ( fr_listen_t li,
fr_event_list_t el,
void *  nr 
)
static

Set the event list for a new socket.

Parameters
[in]lithe listener
[in]elthe event list
[in]nrcontext from the network side

Definition at line 489 of file proto_bfd_udp.c.

+ Here is the call graph for this function:

◆ mod_fd_set()

static int mod_fd_set ( fr_listen_t li,
int  fd 
)
static

Set the file descriptor for this socket.

Definition at line 333 of file proto_bfd_udp.c.

+ Here is the call graph for this function:

◆ mod_name()

static char const* mod_name ( fr_listen_t li)
static

Definition at line 348 of file proto_bfd_udp.c.

◆ mod_network_get()

static void mod_network_get ( void *  instance,
int *  ipproto,
bool dynamic_clients,
fr_trie_t const **  trie 
)
static

Definition at line 233 of file proto_bfd_udp.c.

◆ mod_open()

static int mod_open ( fr_listen_t li)
static

Open a UDP listener for RADIUS.

Definition at line 245 of file proto_bfd_udp.c.

+ Here is the call graph for this function:

◆ mod_read()

static ssize_t mod_read ( fr_listen_t li,
void **  packet_ctx,
fr_time_t recv_time_p,
uint8_t buffer,
size_t  buffer_len,
size_t leftover 
)
static

Definition at line 109 of file proto_bfd_udp.c.

+ Here is the call graph for this function:

◆ mod_write()

static ssize_t mod_write ( fr_listen_t li,
void *  packet_ctx,
UNUSED fr_time_t  request_time,
uint8_t buffer,
size_t  buffer_len,
UNUSED size_t  written 
)
static

Definition at line 194 of file proto_bfd_udp.c.

+ Here is the call graph for this function:

Variable Documentation

◆ networks_config

const conf_parser_t networks_config[]
static
Initial value:
= {
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:626
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
Definition: cf_parse.h:420
#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_COMBO_IP_PREFIX
IPv4 or IPv6 address prefix depending on length.
Definition: merged_model.c:92

Definition at line 77 of file proto_bfd_udp.c.

◆ proto_bfd_udp

fr_app_io_t proto_bfd_udp
Initial value:
= {
.common = {
.name = "bfd_udp",
.config = udp_listen_config,
.inst_size = sizeof(proto_bfd_udp_t),
.thread_inst_size = sizeof(proto_bfd_udp_thread_t),
.bootstrap = mod_bootstrap
},
.default_message_size = FR_BFD_HEADER_LENGTH + 64,
.track_duplicates = false,
.open = mod_open,
.read = mod_read,
.write = mod_write,
.fd_set = mod_fd_set,
.network_get = mod_network_get,
.event_list_set = mod_event_list_set,
.client_find = mod_client_find,
.get_name = mod_name,
}
#define FR_BFD_HEADER_LENGTH
Definition: bfd.h:141
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:65
static ssize_t mod_read(fr_listen_t *li, void **packet_ctx, fr_time_t *recv_time_p, uint8_t *buffer, size_t buffer_len, size_t *leftover)
static fr_client_t * mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto)
static int mod_bootstrap(module_inst_ctx_t const *mctx)
static void mod_event_list_set(fr_listen_t *li, fr_event_list_t *el, void *nr)
Set the event list for a new socket.
static int mod_open(fr_listen_t *li)
Open a UDP listener for RADIUS.
static const conf_parser_t udp_listen_config[]
Definition: proto_bfd_udp.c:85
static char const * mod_name(fr_listen_t *li)
static void mod_network_get(void *instance, int *ipproto, bool *dynamic_clients, fr_trie_t const **trie)
static int mod_fd_set(fr_listen_t *li, int fd)
Set the file descriptor for this socket.
static ssize_t mod_write(fr_listen_t *li, void *packet_ctx, UNUSED fr_time_t request_time, uint8_t *buffer, size_t buffer_len, UNUSED size_t written)

Definition at line 516 of file proto_bfd_udp.c.

◆ udp_listen_config

const conf_parser_t udp_listen_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("interface", proto_bfd_udp_t, interface) },
{ FR_CONF_OFFSET("port_name", proto_bfd_udp_t, port_name) },
{ FR_CONF_OFFSET("port", proto_bfd_udp_t, port) },
{ FR_CONF_OFFSET("ttl", proto_bfd_udp_t, ttl), .dflt = "255" },
{ FR_CONF_OFFSET("only_state_changes", proto_bfd_udp_t, only_state_changes), .dflt = "yes" },
{ FR_CONF_OFFSET_IS_SET("recv_buff", FR_TYPE_UINT32, 0, proto_bfd_udp_t, recv_buff) },
{ FR_CONF_OFFSET_IS_SET("send_buff", FR_TYPE_UINT32, 0, proto_bfd_udp_t, send_buff) },
{ FR_CONF_POINTER("networks", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) networks_config },
}
#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_POINTER(_name, _type, _flags, _res_p)
conf_parser_t which parses a single CONF_PAIR producing a single global result
Definition: cf_parse.h:310
#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
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition: cf_parse.h:400
@ 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 const conf_parser_t networks_config[]
Definition: proto_bfd_udp.c:77

Definition at line 85 of file proto_bfd_udp.c.