25 RCSID(
"$Id: 3e9122ec7fde3776836b7ff86a6df49a007534fd $")
27 #include <freeradius-devel/radius/server.h>
28 #include <freeradius-devel/radius/server_udp.h>
29 #include <freeradius-devel/radius/server_priv.h>
88 if (!
my->mem)
goto fail;
89 my->mem->uctx = &
my->cfg.verify;
93 my->common.bio =
my->mem;
114 if (
fr_packet_encode(reply, list, request, (
char const *)
my->cfg.verify.secret) < 0) {
119 if (
fr_packet_sign(reply, request, (
char const *)
my->cfg.verify.secret) < 0)
goto fail;
128 my->info.write_blocked =
false;
163 if (!packet)
return -1;
165 packet->
data = talloc_memdup(packet,
my->buffer, slen);
173 packet->
id = packet->
data[1];
180 NULL, (
char const *)
my->cfg.verify.secret) < 0) {
static ssize_t fr_bio_write(fr_bio_t *bio, void *packet_ctx, void const *buffer, size_t size)
Write raw data to a bio.
static ssize_t fr_bio_read(fr_bio_t *bio, void *packet_ctx, void *buffer, size_t size)
Read raw data from a bio.
@ FR_RADIUS_CODE_MAX
Maximum possible protocol code.
fr_bio_t * fr_bio_fd_alloc(TALLOC_CTX *ctx, fr_bio_fd_config_t const *cfg, size_t offset)
Allocate a FD bio.
fr_bio_fd_info_t const * fr_bio_fd_info(fr_bio_t *bio)
Returns a pointer to the bio-specific information.
@ FR_BIO_FD_UNCONNECTED
unconnected UDP / datagram only
fr_bio_fd_type_t type
accept, connected, unconnected, etc.
char const * path
for Unix domain sockets
char const * filename
for files
int socket_type
SOCK_STREAM or SOCK_DGRAM.
Configuration for sockets.
int fr_bio_free(fr_bio_t *bio)
Free this bio, and everything it calls.
int fr_bio_shutdown(fr_bio_t *bio)
Shut down a set of BIOs.
fr_bio_t * fr_bio_mem_alloc(TALLOC_CTX *ctx, size_t read_size, size_t write_size, fr_bio_t *next)
Allocate a memory buffer bio.
fr_packet_t * fr_packet_alloc(TALLOC_CTX *ctx, bool new_vector)
Allocate a new fr_packet_t.
ssize_t fr_radius_decode_simple(TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t *packet, size_t packet_len, uint8_t const *vector, char const *secret)
Simple wrapper for callers who just need a shared secret.
int fr_packet_sign(fr_packet_t *packet, fr_packet_t const *original, char const *secret)
Sign a previously encoded packet.
ssize_t fr_packet_encode(fr_packet_t *packet, fr_pair_list_t *list, fr_packet_t const *original, char const *secret)
Encode a packet.
fr_bio_t * fr_radius_server_bio_get_fd(fr_bio_packet_t *bio)
int fr_radius_server_fd_bio_read(fr_bio_packet_t *bio, UNUSED void **packet_ctx_p, fr_packet_t **packet_p, TALLOC_CTX *out_ctx, fr_pair_list_t *out)
fr_bio_packet_t * fr_radius_server_bio_alloc(TALLOC_CTX *ctx, fr_radius_server_config_t *cfg, fr_bio_fd_config_t const *fd_cfg)
static int _radius_server_fd_bio_free(fr_radius_server_fd_bio_t *my)
fr_radius_server_bio_info_t const * fr_radius_server_bio_info(fr_bio_packet_t *bio)
fr_radius_server_fd_bio_t * fr_radius_server_fd_bio_alloc(TALLOC_CTX *ctx, size_t read_size, fr_radius_server_config_t *cfg, fr_bio_fd_config_t const *fd_cfg)
int fr_radius_server_fd_bio_write(fr_bio_packet_t *bio, UNUSED void *pctx, fr_packet_t *reply, fr_pair_list_t *list)
fr_bio_packet_t * fr_radius_server_udp_bio_alloc(TALLOC_CTX *ctx, fr_radius_server_config_t *cfg, fr_bio_fd_config_t const *fd_cfg)
Allocate a RADIUS bio for receiving packets from clients.
unsigned int code
Packet code (type).
fr_socket_t socket
This packet was received on.
int id
Packet ID (used to link requests/responses).
uint8_t * data
Packet data (body).
size_t data_len
Length of packet data.
uint8_t vector[RADIUS_AUTH_VECTOR_LENGTH]
RADIUS authentication vector.
#define fr_strerror_const(_msg)
static size_t char ** out