The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
proto_load_step.c
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15 */
16
17/**
18 * $Id: ccadf4e068a431cd6d9d1f4ac59f39d4356c0747 $
19 * @file proto_load_step.c
20 * @brief Generic protocol load generator
21 *
22 * @copyright 2019 The FreeRADIUS server project.
23 * @copyright 2019 Network RADIUS SAS (legal@networkradius.com)
24 */
25#include <netdb.h>
26#include <fcntl.h>
27#include <freeradius-devel/server/protocol.h>
28#include <freeradius-devel/io/application.h>
29#include <freeradius-devel/io/listen.h>
30#include <freeradius-devel/io/schedule.h>
31#include <freeradius-devel/io/load.h>
32
33#include "proto_load.h"
34
36
38
39typedef struct {
40 fr_event_list_t *el; //!< event list
41 fr_network_t *nr; //!< network handler
42
43 char const *name; //!< socket name
44 bool done;
46
47 fr_time_t recv_time; //!< recv time of the last packet
48
50 fr_load_t *l; //!< load generation handler
51 fr_load_config_t load; //!< load configuration
52 fr_stats_t stats; //!< statistics for this socket
53
54 int fd; //!< for CSV files
55 fr_event_timer_t const *ev; //!< for writing statistics
56
57 fr_listen_t *parent; //!< master IO handler
59
62
63 CONF_SECTION *cs; //!< our configuration
64
65 char const *filename; //!< where to read input packet from
66 fr_pair_list_t pair_list; //!< for input packet
67
68 int code;
69 uint32_t max_attributes; //!< Limit maximum decodable attributes
70
71 fr_client_t *client; //!< static client
72
73 fr_load_config_t load; //!< load configuration
74 bool repeat; //!, do we repeat the load generation
75 char const *csv; //!< where to write CSV stats
76
77 fr_dict_t const *dict; //!< Our namespace.
78};
79
80
83 { FR_CONF_OFFSET("csv", proto_load_step_t, csv) },
84
85 { FR_CONF_OFFSET("max_attributes", proto_load_step_t, max_attributes), .dflt = STRINGIFY(RADIUS_MAX_ATTRIBUTES) } ,
86
87 { FR_CONF_OFFSET("start_pps", proto_load_step_t, load.start_pps) },
88 { FR_CONF_OFFSET("max_pps", proto_load_step_t, load.max_pps) },
89 { FR_CONF_OFFSET("duration", proto_load_step_t, load.duration) },
90 { FR_CONF_OFFSET("step", proto_load_step_t, load.step) },
91 { FR_CONF_OFFSET("max_backlog", proto_load_step_t, load.milliseconds) },
92 { FR_CONF_OFFSET("parallel", proto_load_step_t, load.parallel) },
93 { FR_CONF_OFFSET("repeat", proto_load_step_t, repeat) },
94
96};
97
98
99static 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)
100{
102 proto_load_step_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_load_step_thread_t);
103 fr_io_address_t *address, **address_p;
104
105 if (thread->done) return -1;
106
107 /*
108 * Suspend reading on the FD, because we let the timers
109 * take over the load generation.
110 */
111 if (!thread->suspended) {
112 static fr_event_update_t pause[] = {
115 { 0 }
116 };
117
118 if (fr_event_filter_update(thread->el, li->fd, FR_EVENT_FILTER_IO, pause) < 0) {
119 fr_assert(0);
120 }
121
122 thread->suspended = true;
123 }
124
125 *leftover = 0; /* always for load generation */
126
127 /*
128 * Where the addresses should go. This is a special case
129 * for proto_radius.
130 */
131 address_p = (fr_io_address_t **) packet_ctx;
132 address = *address_p;
133
134 memset(address, 0, sizeof(*address));
135 address->socket.inet.src_ipaddr.af = AF_INET;
136 address->socket.inet.dst_ipaddr.af = AF_INET;
137 address->radclient = inst->client;
138
139 *recv_time_p = thread->recv_time;
140
141 if (buffer_len < 1) {
142 DEBUG2("proto_load_step read buffer is too small for input packet");
143 return 0;
144 }
145
146 buffer[0] = 0;
147
148 /*
149 * Print out what we received.
150 */
151 DEBUG2("proto_load_step - reading packet for %s",
152 thread->name);
153
154 return 1;
155}
156
157
158static ssize_t mod_write(fr_listen_t *li, UNUSED void *packet_ctx, fr_time_t request_time,
159 UNUSED uint8_t *buffer, size_t buffer_len, UNUSED size_t written)
160{
161 proto_load_step_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_load_step_thread_t);
162 fr_load_reply_t state;
163
164 /*
165 * @todo - share a stats interface with the parent? or
166 * put the stats in the listener, so that proto_radius
167 * can update them, too.. <sigh>
168 */
169 thread->stats.total_responses++;
170
171 /*
172 * Tell the load generatopr subsystem that we have a
173 * reply. Then if the load test is done, exit the
174 * server.
175 */
176 state = fr_load_generator_have_reply(thread->l, request_time);
177 if (state == FR_LOAD_DONE) {
178 if (!thread->inst->repeat) {
179 thread->done = true;
180 } else {
181 (void) fr_load_generator_stop(thread->l); /* ensure l->ev is gone */
182 (void) fr_load_generator_start(thread->l);
183 }
184 }
185
186 return buffer_len;
187}
188
189
190/** Open a load listener
191 *
192 */
193static int mod_open(fr_listen_t *li)
194{
196 proto_load_step_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_load_step_thread_t);
197
198 fr_ipaddr_t ipaddr;
199
200 /*
201 * We never read or write to this file, but we need a
202 * readable FD in order to bootstrap the process.
203 */
204 li->fd = open(inst->filename, O_RDONLY);
205
206 memset(&ipaddr, 0, sizeof(ipaddr));
207 ipaddr.af = AF_INET;
208 li->app_io_addr = fr_socket_addr_alloc_inet_src(li, IPPROTO_UDP, 0, &ipaddr, 0);
209
210 fr_assert((cf_parent(inst->cs) != NULL) && (cf_parent(cf_parent(inst->cs)) != NULL)); /* listen { ... } */
211
212 thread->name = talloc_typed_asprintf(thread, "load_step from filename %s", inst->filename);
213 thread->parent = talloc_parent(li);
214
215 return 0;
216}
217
218
219/** Generate traffic.
220 *
221 */
222static int mod_generate(fr_time_t now, void *uctx)
223{
224 fr_listen_t *li = uctx;
225 proto_load_step_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_load_step_thread_t);
226
227 thread->recv_time = now;
228
229 /*
230 * Tell the network side to call our read routine.
231 */
232 fr_network_listen_read(thread->nr, thread->parent);
233
234 return 0;
235}
236
237
238static void write_stats(fr_event_list_t *el, fr_time_t now, void *uctx)
239{
240 proto_load_step_thread_t *thread = uctx;
241 size_t len;
242 char buffer[1024];
243
244 (void) fr_event_timer_in(thread, el, &thread->ev, fr_time_delta_from_sec(1), write_stats, thread);
245
246 len = fr_load_generator_stats_sprint(thread->l, now, buffer, sizeof(buffer));
247 if (write(thread->fd, buffer, len) < 0) {
248 DEBUG("Failed writing to %s - %s", thread->inst->csv, fr_syserror(errno));
249 }
250}
251
252
253/** Decode the packet
254 *
255 */
256static int mod_decode(void const *instance, request_t *request, UNUSED uint8_t *const data, UNUSED size_t data_len)
257{
259 fr_io_track_t const *track = talloc_get_type_abort_const(request->async->packet_ctx, fr_io_track_t);
260 fr_io_address_t const *address = track->address;
261
262 /*
263 * Set the request dictionary so that we can do
264 * generic->protocol attribute conversions as
265 * the request runs through the server.
266 */
267 request->dict = inst->dict;
268
269 /*
270 * Hacks for now until we have a lower-level decode routine.
271 */
272 if (inst->code) request->packet->code = inst->code;
273 request->packet->id = fr_rand() & 0xff;
274 request->reply->id = request->packet->id;
275
276 request->packet->data = talloc_zero_array(request->packet, uint8_t, 1);
277 request->packet->data_len = 1;
278
279 (void) fr_pair_list_copy(request->request_ctx, &request->request_pairs, &inst->pair_list);
280
281 /*
282 * Set the rest of the fields.
283 */
284 request->client = UNCONST(fr_client_t *, address->radclient);
285
286 request->packet->socket = address->socket;
287 fr_socket_addr_swap(&request->reply->socket, &address->socket);
288
289 REQUEST_VERIFY(request);
290
291 return 0;
292}
293
294/** Set the event list for a new socket
295 *
296 * @param[in] li the listener
297 * @param[in] el the event list
298 * @param[in] nr context from the network side
299 */
301{
303 proto_load_step_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_load_step_thread_t);
304 size_t len;
305 char buffer[256];
306
307 thread->el = el;
308 thread->nr = nr;
309 thread->inst = inst;
310 thread->load = inst->load;
311
312 thread->l = fr_load_generator_create(thread, el, &thread->load, mod_generate, li);
313 if (!thread->l) return;
314
315 (void) fr_load_generator_start(thread->l);
316
317 if (!inst->csv) return;
318
319 thread->fd = open(inst->csv, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0600);
320 if (thread->fd < 0) {
321 ERROR("Failed opening %s - %s", inst->csv, fr_syserror(errno));
322 return;
323 }
324
325 (void) fr_event_timer_in(thread, thread->el, &thread->ev, fr_time_delta_from_sec(1), write_stats, thread);
326
327 len = fr_load_generator_stats_sprint(thread->l, fr_time(), buffer, sizeof(buffer));
328 if (write(thread->fd, buffer, len) < 0) {
329 DEBUG("Failed writing to %s - %s", thread->inst->csv, fr_syserror(errno));
330 }
331}
332
333static char const *mod_name(fr_listen_t *li)
334{
335 proto_load_step_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_load_step_thread_t);
336
337 return thread->name;
338}
339
340static int mod_instantiate(module_inst_ctx_t const *mctx)
341{
342 proto_load_step_t *inst = talloc_get_type_abort(mctx->mi->data, proto_load_step_t);
343 CONF_SECTION *conf = mctx->mi->conf;
344 fr_client_t *client;
345 fr_pair_t *vp;
346 module_instance_t const *mi = mctx->mi;
347
349 if (!inst->dict) {
350 cf_log_err(conf, "Please define 'namespace' in this virtual server");
351 return -1;
352 }
353
354 fr_pair_list_init(&inst->pair_list);
355 inst->client = client = talloc_zero(inst, fr_client_t);
356 if (!inst->client) return 0;
357
358 client->ipaddr.af = AF_INET;
359 client->src_ipaddr = client->ipaddr;
360
361 client->longname = client->shortname = inst->filename;
362 client->secret = talloc_strdup(client, "testing123");
363 client->nas_type = talloc_strdup(client, "load");
364 client->use_connected = false;
365
366 if (inst->filename) {
367 FILE *fp;
368 bool done = false;
369
370 fp = fopen(inst->filename, "r");
371 if (!fp) {
372 cf_log_err(conf, "Failed opening %s - %s",
373 inst->filename, fr_syserror(errno));
374 return -1;
375 }
376
377 if (fr_pair_list_afrom_file(inst, inst->dict, &inst->pair_list, fp, &done) < 0) {
378 cf_log_perr(conf, "Failed reading %s", inst->filename);
379 fclose(fp);
380 return -1;
381 }
382
383 fclose(fp);
384 }
385
386 inst->parent = talloc_get_type_abort(mi->parent->data, proto_load_t);
387 inst->cs = conf;
388
389 vp = fr_pair_find_by_da(&inst->pair_list, NULL, inst->parent->attr_packet_type);
390 if (vp) inst->code = vp->vp_uint32;
391
392 FR_INTEGER_BOUND_CHECK("start_pps", inst->load.start_pps, >=, 10);
393 FR_INTEGER_BOUND_CHECK("start_pps", inst->load.start_pps, <, 400000);
394
395 FR_INTEGER_BOUND_CHECK("step", inst->load.step, >=, 1);
396 FR_INTEGER_BOUND_CHECK("step", inst->load.step, <, 100000);
397
398 if (inst->load.max_pps > 0) FR_INTEGER_BOUND_CHECK("max_pps", inst->load.max_pps, >, inst->load.start_pps);
399 FR_INTEGER_BOUND_CHECK("max_pps", inst->load.max_pps, <, 100000);
400
401 FR_TIME_DELTA_BOUND_CHECK("duration", inst->load.duration, >=, fr_time_delta_from_sec(1));
402 FR_TIME_DELTA_BOUND_CHECK("duration", inst->load.duration, <, fr_time_delta_from_sec(10000));
403
404
405 FR_INTEGER_BOUND_CHECK("parallel", inst->load.parallel, >=, 1);
406 FR_INTEGER_BOUND_CHECK("parallel", inst->load.parallel, <, 1000);
407
408 FR_INTEGER_BOUND_CHECK("max_backlog", inst->load.milliseconds, >=, 1);
409 FR_INTEGER_BOUND_CHECK("max_backlog", inst->load.milliseconds, <, 100000);
410
411 return 0;
412}
413
420
422 .common = {
423 .magic = MODULE_MAGIC_INIT,
424 .name = "load_step",
426 .inst_size = sizeof(proto_load_step_t),
427 .thread_inst_size = sizeof(proto_load_step_thread_t),
428 .instantiate = mod_instantiate
429 },
430 .default_message_size = 4096,
431 .track_duplicates = false,
432
433 .open = mod_open,
434 .read = mod_read,
435 .write = mod_write,
436 .event_list_set = mod_event_list_set,
437 .client_find = mod_client_find,
438 .get_name = mod_name,
439
440 .decode = mod_decode,
441};
static int const char char buffer[256]
Definition acutest.h:576
module_t common
Common fields to all loadable modules.
Definition app_io.h:34
Public structure describing an I/O path for a protocol.
Definition app_io.h:33
#define load(_var)
#define UNCONST(_type, _ptr)
Remove const qualification from a pointer.
Definition build.h:167
#define STRINGIFY(x)
Definition build.h:197
#define UNUSED
Definition build.h:315
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:642
#define FR_INTEGER_BOUND_CHECK(_name, _var, _op, _bound)
Definition cf_parse.h:502
#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_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
#define FR_TIME_DELTA_BOUND_CHECK(_name, _var, _op, _bound)
Definition cf_parse.h:513
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition cf_parse.h:418
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition cf_parse.h:424
@ CONF_FLAG_NOT_EMPTY
CONF_PAIR is required to have a non zero length value.
Definition cf_parse.h:433
Defines a CONF_PAIR to C data type mapping.
Definition cf_parse.h:579
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:101
CONF_ITEM * cf_section_to_item(CONF_SECTION const *cs)
Cast a CONF_SECTION to a CONF_ITEM.
Definition cf_util.c:738
#define cf_log_err(_cf, _fmt,...)
Definition cf_util.h:289
#define cf_parent(_cf)
Definition cf_util.h:101
#define cf_log_perr(_cf, _fmt,...)
Definition cf_util.h:296
#define ERROR(fmt,...)
Definition dhcpclient.c:41
#define DEBUG(fmt,...)
Definition dhcpclient.c:39
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition dl_module.h:63
@ FR_EVENT_FILTER_IO
Combined filter for read/write functions/.
Definition event.h:62
#define fr_event_filter_update(...)
Definition event.h:224
#define FR_EVENT_SUSPEND(_s, _f)
Temporarily remove the filter for a func from kevent.
Definition event.h:94
#define fr_event_timer_in(...)
Definition event.h:255
Callbacks for the FR_EVENT_FILTER_IO filter.
Definition event.h:173
Structure describing a modification to a filter's state.
Definition event.h:75
int af
Address family.
Definition inet.h:64
IPv4/6 prefix.
fr_socket_t socket
src/dst ip and port.
Definition base.h:336
fr_client_t const * radclient
old-style client definition
Definition base.h:338
fr_socket_t * app_io_addr
for tracking duplicate sockets
Definition listen.h:35
void const * app_io_instance
I/O path configuration context.
Definition listen.h:32
void * thread_instance
thread / socket context
Definition listen.h:33
int fd
file descriptor for this socket - set by open
Definition listen.h:28
void fr_network_listen_read(fr_network_t *nr, fr_listen_t *li)
Signal the network to read from a listener.
Definition network.c:324
fr_ipaddr_t ipaddr
IPv4/IPv6 address of the host.
Definition client.h:83
char const * secret
Secret PSK.
Definition client.h:90
fr_ipaddr_t src_ipaddr
IPv4/IPv6 address to send responses from (family must match ipaddr).
Definition client.h:84
char const * nas_type
Type of client (arbitrary).
Definition client.h:127
char const * longname
Client identifier.
Definition client.h:87
char const * shortname
Client nickname.
Definition client.h:88
bool use_connected
do we use connected sockets for this client
Definition client.h:120
Describes a host allowed to send packets to the server.
Definition client.h:80
Stores all information relating to an event list.
Definition event.c:411
A timer event.
Definition event.c:102
fr_load_t * fr_load_generator_create(TALLOC_CTX *ctx, fr_event_list_t *el, fr_load_config_t *config, fr_load_callback_t callback, void *uctx)
Definition load.c:87
int fr_load_generator_start(fr_load_t *l)
Start the load generator.
Definition load.c:230
int fr_load_generator_stop(fr_load_t *l)
Stop the load generation through the simple expedient of deleting the timer associated with it.
Definition load.c:252
size_t fr_load_generator_stats_sprint(fr_load_t *l, fr_time_t now, char *buffer, size_t buflen)
Print load generator statistics in CVS format.
Definition load.c:341
fr_load_reply_t fr_load_generator_have_reply(fr_load_t *l, fr_time_t request_time)
Tell the load generator that we have a reply to a packet we sent.
Definition load.c:263
fr_load_reply_t
Whether or not the application should continue.
Definition load.h:103
@ FR_LOAD_DONE
the load generator is done
Definition load.h:105
Load generation configuration.
Definition load.h:72
fr_io_address_t const * address
of this packet.. shared between multiple packets
Definition master.h:54
unsigned int uint32_t
long int ssize_t
unsigned char uint8_t
module_instance_t * mi
Instance of the module being instantiated.
Definition module_ctx.h:51
Temporary structure to hold arguments for instantiation calls.
Definition module_ctx.h:50
int fr_pair_list_copy(TALLOC_CTX *ctx, fr_pair_list_t *to, fr_pair_list_t const *from)
Duplicate a list of pairs.
Definition pair.c:2319
fr_pair_t * fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find the first pair with a matching da.
Definition pair.c:693
void fr_pair_list_init(fr_pair_list_t *list)
Initialise a pair list header.
Definition pair.c:46
int fr_pair_list_afrom_file(TALLOC_CTX *ctx, fr_dict_t const *dict, fr_pair_list_t *out, FILE *fp, bool *pfiledone)
Read valuepairs from the fp up to End-Of-File.
Load master protocol handler.
fr_app_io_t proto_load_step
fr_listen_t * parent
master IO handler
fr_client_t * client
static client
fr_pair_list_t pair_list
for input packet
fr_load_config_t load
load configuration
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 const conf_parser_t load_listen_config[]
CONF_SECTION * cs
our configuration
proto_load_step_t const * inst
static int mod_decode(void const *instance, request_t *request, UNUSED uint8_t *const data, UNUSED size_t data_len)
Decode the packet.
fr_load_config_t load
load configuration
char const * filename
where to read input packet from
static void write_stats(fr_event_list_t *el, fr_time_t now, void *uctx)
uint32_t max_attributes
Limit maximum decodable attributes.
struct proto_load_step_s proto_load_step_t
char const * csv
, do we repeat the load generation
static ssize_t mod_write(fr_listen_t *li, UNUSED void *packet_ctx, fr_time_t request_time, UNUSED uint8_t *buffer, size_t buffer_len, UNUSED size_t written)
fr_stats_t stats
statistics for this socket
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 load listener.
fr_time_t recv_time
recv time of the last packet
fr_load_t * l
load generation handler
fr_event_timer_t const * ev
for writing statistics
fr_dict_t const * dict
Our namespace.
fr_network_t * nr
network handler
static int mod_generate(fr_time_t now, void *uctx)
Generate traffic.
fr_event_list_t * el
event list
static char const * mod_name(fr_listen_t *li)
static int mod_instantiate(module_inst_ctx_t const *mctx)
char const * name
socket name
proto_load_t * parent
static fr_client_t * mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto)
#define fr_assert(_expr)
Definition rad_assert.h:38
static int ipproto
static bool done
Definition radclient.c:80
#define DEBUG2(fmt,...)
Definition radclient.h:43
#define RADIUS_MAX_ATTRIBUTES
Definition radius.h:40
static rs_t * conf
Definition radsniff.c:53
uint32_t fr_rand(void)
Return a 32-bit random number.
Definition rand.c:105
#define REQUEST_VERIFY(_x)
Definition request.h:276
CONF_SECTION * conf
Module's instance configuration.
Definition module.h:329
void * data
Module's instance data.
Definition module.h:271
module_instance_t const * parent
Parent module's instance (if any).
Definition module.h:337
conf_parser_t const * config
How to convert a CONF_SECTION to a module instance.
Definition module.h:198
Module instance data.
Definition module.h:265
uint64_t total_responses
Definition stats.h:38
eap_aka_sim_process_conf_t * inst
fr_pair_t * vp
#define fr_time()
Allow us to arbitrarily manipulate time.
Definition state_test.c:8
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
Definition syserror.c:243
char * talloc_typed_asprintf(TALLOC_CTX *ctx, char const *fmt,...)
Call talloc vasprintf, setting the type on the new chunk correctly.
Definition talloc.c:492
#define talloc_get_type_abort_const
Definition talloc.h:282
static fr_time_delta_t fr_time_delta_from_sec(int64_t sec)
Definition time.h:590
"server local" time.
Definition time.h:69
static fr_event_list_t * el
static fr_socket_t * fr_socket_addr_alloc_inet_src(TALLOC_CTX *ctx, int proto, int ifindex, fr_ipaddr_t const *ipaddr, int port)
A variant of fr_socket_addr_init_inet_src will also allocates a fr_socket_t.
Definition socket.h:244
int af
AF_INET, AF_INET6, or AF_UNIX.
Definition socket.h:78
static void fr_socket_addr_swap(fr_socket_t *dst, fr_socket_t const *src)
Swap src/dst information of a fr_socket_t.
Definition socket.h:121
static fr_slen_t data
Definition value.h:1265
fr_dict_t const * virtual_server_dict_by_child_ci(CONF_ITEM const *ci)
Return the namespace for a given virtual server specified by a CONF_ITEM within the virtual server.