The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
proto_vmps_udp.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: 8a3d1402044b713b5c04aaa7be9b9298ab24bb1d $
19 * @file proto_vmps_udp.c
20 * @brief VMPS handler for UDP.
21 *
22 * @copyright 2018 The FreeRADIUS server project.
23 * @copyright 2018 Alan DeKok (aland@deployingradius.com)
24 */
25#include <netdb.h>
26#include <freeradius-devel/server/protocol.h>
27#include <freeradius-devel/util/udp.h>
28#include <freeradius-devel/util/trie.h>
29#include <freeradius-devel/io/application.h>
30#include <freeradius-devel/io/listen.h>
31#include <freeradius-devel/io/schedule.h>
32
33#include <freeradius-devel/protocol/vmps/vmps.h>
34
35#include "proto_vmps.h"
36
38
39typedef struct {
40 char const *name; //!< socket name
41
42 int sockfd;
43
44 fr_io_address_t *connection; //!< for connected sockets.
45
46 fr_stats_t stats; //!< statistics for this socket
48
49typedef struct {
50 CONF_SECTION *cs; //!< our configuration
51
52 fr_ipaddr_t ipaddr; //!< IP address to listen on.
53
54 char const *interface; //!< Interface to bind to.
55 char const *port_name; //!< Name of the port for getservent().
56
57 uint32_t recv_buff; //!< How big the kernel's receive buffer should be.
58
59 uint32_t max_packet_size; //!< for message ring buffer.
60
61 uint16_t port; //!< Port to listen on.
62
63 bool recv_buff_is_set; //!< Whether we were provided with a receive
64 //!< buffer value.
65 bool dynamic_clients; //!< whether we have dynamic clients
66
67 fr_trie_t *trie; //!< for parsed networks
68 fr_ipaddr_t *allow; //!< allowed networks for dynamic clients
69 fr_ipaddr_t *deny; //!< denied networks for dynamic clients
70
71 fr_client_list_t *clients; //!< local clients
73
74
81
82
87
88 { FR_CONF_OFFSET("interface", proto_vmps_udp_t, interface) },
89 { FR_CONF_OFFSET("port_name", proto_vmps_udp_t, port_name) },
90
91 { FR_CONF_OFFSET("port", proto_vmps_udp_t, port) },
92 { FR_CONF_OFFSET_IS_SET("recv_buff", FR_TYPE_UINT32, 0, proto_vmps_udp_t, recv_buff) },
93
94 { FR_CONF_OFFSET("dynamic_clients", proto_vmps_udp_t, dynamic_clients) } ,
95 { FR_CONF_POINTER("networks", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) networks_config },
96
97 { FR_CONF_OFFSET("max_packet_size", proto_vmps_udp_t, max_packet_size), .dflt = "1024" } ,
98
100};
101
102
103static 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)
104{
106 proto_vmps_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_vmps_udp_thread_t);
107 fr_io_address_t *address, **address_p;
108
109 int flags;
110 ssize_t data_size;
111 size_t packet_len;
112
113 uint32_t id;
114
115 *leftover = 0; /* always for UDP */
116
117 /*
118 * Where the addresses should go. This is a special case
119 * for proto_vmps.
120 */
121 address_p = (fr_io_address_t **) packet_ctx;
122 address = *address_p;
123
124 /*
125 * Tell udp_recv if we're connected or not.
126 */
127 flags = UDP_FLAGS_CONNECTED * (thread->connection != NULL);
128
129 data_size = udp_recv(thread->sockfd, flags, &address->socket, buffer, buffer_len, recv_time_p);
130 if (data_size < 0) {
131 PDEBUG2("proto_vmps_udp got read error %zd", data_size);
132 return data_size;
133 }
134
135 if (!data_size) {
136 DEBUG2("proto_vmps_udp got no data: ignoring");
137 return 0;
138 }
139
140 packet_len = data_size;
141
142 if (data_size < FR_VQP_HDR_LEN) {
143 DEBUG2("proto_vmps_udp got 'too short' packet size %zd", data_size);
145 return 0;
146 }
147
148 if (packet_len > inst->max_packet_size) {
149 DEBUG2("proto_vmps_udp got 'too long' packet size %zd > %u", data_size, inst->max_packet_size);
151 return 0;
152 }
153
154 if (buffer[0] != FR_VQP_VERSION) {
155 DEBUG("proto_vmps_udp got invalid packet version %d", buffer[0]);
156 thread->stats.total_unknown_types++;
157 return 0;
158 }
159
160 if ((buffer[1] != FR_PACKET_TYPE_VALUE_JOIN_REQUEST) &&
161 (buffer[1] != FR_PACKET_TYPE_VALUE_RECONFIRM_REQUEST)) {
162 DEBUG("proto_vmps_udp got invalid packet code %d", buffer[1]);
163 thread->stats.total_unknown_types++;
164 return 0;
165 }
166
167 /*
168 * If it's not a VMPS packet, ignore it.
169 */
170 if (!fr_vmps_ok(buffer, &packet_len)) {
171 /*
172 * @todo - check for F5 load balancer packets. <sigh>
173 */
174 DEBUG2("proto_vmps_udp got a packet which isn't VMPS");
176 return 0;
177 }
178
179 /*
180 * proto_vmps sets the priority
181 */
182
183 memcpy(&id, buffer + 4, 4);
184 id = ntohl(id);
185
186 /*
187 * Print out what we received.
188 */
189 DEBUG2("proto_vmps_udp - Received %d ID %08x length %d %s",
190 buffer[1], id,
191 (int) packet_len, thread->name);
192
193 return packet_len;
194}
195
196
197static ssize_t mod_write(fr_listen_t *li, void *packet_ctx, UNUSED fr_time_t request_time,
198 uint8_t *buffer, size_t buffer_len, UNUSED size_t written)
199{
200 proto_vmps_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_vmps_udp_thread_t);
201 fr_io_track_t *track = talloc_get_type_abort(packet_ctx, fr_io_track_t);
202 fr_socket_t socket;
203
204 int flags;
205 ssize_t data_size;
206
207 /*
208 * @todo - share a stats interface with the parent? or
209 * put the stats in the listener, so that proto_vmps
210 * can update them, too.. <sigh>
211 */
212 thread->stats.total_responses++;
213
214 flags = UDP_FLAGS_CONNECTED * (thread->connection != NULL);
215
216 fr_socket_addr_swap(&socket, &track->address->socket);
217
218 /*
219 * This handles the race condition where we get a DUP,
220 * but the original packet replies before we're run.
221 * i.e. this packet isn't marked DUP, so we have to
222 * discover it's a dup later...
223 *
224 * As such, if there's already a reply, then we ignore
225 * the encoded reply (which is probably going to be a
226 * NAK), and instead reply with the cached reply.
227 */
228 if (track->reply_len) {
229 if (track->reply_len >= 8) {
230 char *packet;
231
232 memcpy(&packet, &track->reply, sizeof(packet)); /* const issues */
233
234 (void) udp_send(&socket, flags, packet, track->reply_len);
235 }
236
237 return buffer_len;
238 }
239
240 /*
241 * We only write VMPS packets.
242 */
243 fr_assert(buffer_len >= 8);
244
245 /*
246 * Only write replies if they're VMPS packets.
247 * sometimes we want to NOT send a reply...
248 */
249 data_size = udp_send(&socket, flags, buffer, buffer_len);
250
251 /*
252 * This socket is dead. That's an error...
253 */
254 if (data_size <= 0) return data_size;
255
256 return data_size;
257}
258
259
261{
262 proto_vmps_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_vmps_udp_thread_t);
263
264 thread->connection = connection;
265 return 0;
266}
267
268
269static void mod_network_get(int *ipproto, bool *dynamic_clients, fr_trie_t const **trie, void *instance)
270{
271 proto_vmps_udp_t *inst = talloc_get_type_abort(instance, proto_vmps_udp_t);
272
273 *ipproto = IPPROTO_UDP;
274 *dynamic_clients = inst->dynamic_clients;
275 *trie = inst->trie;
276}
277
278
279/** Open a UDP listener for VMPS
280 *
281 */
282static int mod_open(fr_listen_t *li)
283{
285 proto_vmps_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_vmps_udp_thread_t);
286
287 int sockfd;
288 fr_ipaddr_t ipaddr = inst->ipaddr;
289 uint16_t port = inst->port;
290
291 li->fd = sockfd = fr_socket_server_udp(&inst->ipaddr, &port, inst->port_name, true);
292 if (sockfd < 0) {
293 cf_log_err(li->cs, "Failed opening UDP socket - %s", fr_strerror());
294 error:
295 return -1;
296 }
297
298 li->app_io_addr = fr_socket_addr_alloc_inet_src(li, IPPROTO_UDP, 0, &inst->ipaddr, port);
299
300 /*
301 * Set SO_REUSEPORT before bind, so that all packets can
302 * listen on the same destination IP address.
303 */
304 {
305 int on = 1;
306
307 if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0) {
308 cf_log_err(li->cs, "Failed to set socket 'reuseport' - %s", fr_syserror(errno));
309 close(sockfd);
310 return -1;
311 }
312 }
313
314 if (fr_socket_bind(sockfd, inst->interface, &ipaddr, &port) < 0) {
315 close(sockfd);
316 cf_log_err(li->cs, "Failed binding to socket - %s", fr_strerror());
317 cf_log_err(li->cs, DOC_ROOT_REF(troubleshooting/network/bind));
318 goto error;
319 }
320
321 thread->sockfd = sockfd;
322
323 fr_assert((cf_parent(inst->cs) != NULL) && (cf_parent(cf_parent(inst->cs)) != NULL)); /* listen { ... } */
324
325 thread->name = fr_app_io_socket_name(thread, &proto_vmps_udp,
326 NULL, 0,
327 &inst->ipaddr, inst->port,
328 inst->interface);
329 return 0;
330}
331
332
333/** Set the file descriptor for this socket.
334 *
335 */
336static int mod_fd_set(fr_listen_t *li, int fd)
337{
339 proto_vmps_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_vmps_udp_thread_t);
340
341 thread->sockfd = fd;
342
343 thread->name = fr_app_io_socket_name(thread, &proto_vmps_udp,
344 &thread->connection->socket.inet.src_ipaddr, thread->connection->socket.inet.src_port,
345 &inst->ipaddr, inst->port,
346 inst->interface);
347
348 return 0;
349}
350
351static void *mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client,
352 fr_io_track_t *track, uint8_t const *buffer, size_t buffer_len)
353{
355
356 if (buffer_len < 4) {
357 ERROR("VMPS packet is too small. (%zu < 4)", buffer_len);
358 return NULL;
359 }
360
361 t = talloc_zero(track, proto_vmps_track_t);
362
363 if (!t) return NULL;
364
365 talloc_set_name_const(t, "proto_vmps_track_t");
366
367 memcpy(&t->transaction_id, buffer, sizeof(t->transaction_id));
368
369 t->opcode = buffer[1];
370
371 return t;
372}
373
374static int mod_track_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client,
375 void const *one, void const *two)
376{
379 int ret;
380
381 /*
382 * Order by transaction ID
383 */
385 if (ret != 0) return ret;
386
387 /*
388 * Then ordered by opcode, which is usually the same.
389 */
390 return (a->opcode < b->opcode) - (a->opcode > b->opcode);
391}
392
393static int mod_instantiate(module_inst_ctx_t const *mctx)
394{
395 proto_vmps_udp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_vmps_udp_t);
396 CONF_SECTION *conf = mctx->mi->conf;
397 size_t num;
398 CONF_ITEM *ci;
399 CONF_SECTION *server_cs;
400
401 inst->cs = conf;
402
403 /*
404 * Complain if no "ipaddr" is set.
405 */
406 if (inst->ipaddr.af == AF_UNSPEC) {
407 cf_log_err(conf, "No 'ipaddr' was specified in the 'udp' section");
408 return -1;
409 }
410
411 if (inst->recv_buff_is_set) {
412 FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, >=, 32);
413 FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, <=, INT_MAX);
414 }
415
416 FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 32);
417 FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65536);
418
419 if (!inst->port) {
420 struct servent *s;
421
422 if (!inst->port_name) {
423 cf_log_err(conf, "No 'port' was specified in the 'udp' section");
424 return -1;
425 }
426
427 s = getservbyname(inst->port_name, "udp");
428 if (!s) {
429 cf_log_err(conf, "Unknown value for 'port_name = %s", inst->port_name);
430 return -1;
431 }
432
433 inst->port = ntohs(s->s_port);
434 }
435
436 /*
437 * Parse and create the trie for dynamic clients, even if
438 * there's no dynamic clients.
439 *
440 * @todo - we could use this for source IP filtering?
441 * e.g. allow clients from a /16, but not from a /24
442 * within that /16.
443 */
444 num = talloc_array_length(inst->allow);
445 if (!num) {
446 if (inst->dynamic_clients) {
447 cf_log_err(conf, "The 'allow' subsection MUST contain at least one 'network' entry when 'dynamic_clients = true'.");
448 return -1;
449 }
450 } else {
451 inst->trie = fr_master_io_network(inst, inst->ipaddr.af, inst->allow, inst->deny);
452 if (!inst->trie) {
453 cf_log_perr(conf, "Failed creating list of networks");
454 return -1;
455 }
456 }
457
458 ci = cf_section_to_item(mctx->mi->parent->conf); /* listen { ... } */
459 fr_assert(ci != NULL);
460 ci = cf_parent(ci);
461 fr_assert(ci != NULL);
462
463 server_cs = cf_item_to_section(ci);
464
465 /*
466 * Look up local clients, if they exist.
467 *
468 * @todo - ensure that we only parse clients which are
469 * for IPPROTO_UDP, and to not require a "secret".
470 */
471 if (cf_section_find_next(server_cs, NULL, "client", CF_IDENT_ANY)) {
472 inst->clients = client_list_parse_section(server_cs, IPPROTO_UDP, false);
473 if (!inst->clients) {
474 cf_log_err(conf, "Failed creating local clients");
475 return -1;
476 }
477 }
478
479 return 0;
480}
481
482// @todo - allow for "wildcard" clients, which allow anything
483// and then rely on "networks" to filter source IPs...
484// which means we probably want to filter on "networks" even if there are no dynamic clients
486{
488 fr_client_t *client;
489
490 /*
491 * Prefer local clients.
492 */
493 if (inst->clients) {
494 client = client_find(inst->clients, ipaddr, ipproto);
495 if (client) return client;
496 }
497
498 return client_find(NULL, ipaddr, ipproto);
499}
500
501static char const *mod_name(fr_listen_t *li)
502{
503 proto_vmps_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_vmps_udp_thread_t);
504
505 return thread->name;
506}
507
509 .common = {
510 .magic = MODULE_MAGIC_INIT,
511 .name = "vmps_udp",
513 .inst_size = sizeof(proto_vmps_udp_t),
514 .thread_inst_size = sizeof(proto_vmps_udp_thread_t),
515 .instantiate = mod_instantiate,
516 },
517 .default_message_size = 4096,
518 .track_duplicates = true,
519
520 .open = mod_open,
521 .read = mod_read,
522 .write = mod_write,
523 .fd_set = mod_fd_set,
524 .track_create = mod_track_create,
525 .track_compare = mod_track_compare,
526 .connection_set = mod_connection_set,
527 .network_get = mod_network_get,
528 .client_find = mod_client_find,
529 .get_name = mod_name,
530};
static int const char char buffer[256]
Definition acutest.h:576
char const * fr_app_io_socket_name(TALLOC_CTX *ctx, fr_app_io_t const *app_io, fr_ipaddr_t const *src_ipaddr, int src_port, fr_ipaddr_t const *dst_ipaddr, int dst_port, char const *interface)
Definition app_io.c:32
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 UNUSED
Definition build.h:336
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:669
#define FR_INTEGER_BOUND_CHECK(_name, _var, _op, _bound)
Definition cf_parse.h:529
#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:280
#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:334
#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:294
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
Definition cf_parse.h:446
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition cf_parse.h:423
#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:238
Defines a CONF_PAIR to C data type mapping.
Definition cf_parse.h:606
Common header for all CONF_* types.
Definition cf_priv.h:54
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:106
CONF_ITEM * cf_section_to_item(CONF_SECTION const *cs)
Cast a CONF_SECTION to a CONF_ITEM.
Definition cf_util.c:746
CONF_SECTION * cf_item_to_section(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_SECTION.
Definition cf_util.c:692
CONF_SECTION * cf_section_find_next(CONF_SECTION const *cs, CONF_SECTION const *prev, char const *name1, char const *name2)
Return the next matching section.
Definition cf_util.c:1215
#define cf_log_err(_cf, _fmt,...)
Definition cf_util.h:345
#define cf_parent(_cf)
Definition cf_util.h:118
#define cf_log_perr(_cf, _fmt,...)
Definition cf_util.h:352
#define CF_IDENT_ANY
Definition cf_util.h:80
#define ERROR(fmt,...)
Definition dhcpclient.c:40
static int sockfd
Definition dhcpclient.c:55
#define DEBUG(fmt,...)
Definition dhcpclient.c:38
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition dl_module.h:63
IPv4/6 prefix.
fr_socket_t socket
src/dst ip and port.
Definition base.h:336
CONF_SECTION * cs
of this listener
Definition listen.h:41
fr_socket_t * app_io_addr
for tracking duplicate sockets
Definition listen.h:36
void const * app_io_instance
I/O path configuration context.
Definition listen.h:33
void * thread_instance
thread / socket context
Definition listen.h:34
int fd
file descriptor for this socket - set by open
Definition listen.h:28
Describes a host allowed to send packets to the server.
Definition client.h:80
#define PDEBUG2(_fmt,...)
Definition log.h:272
uint64_t total_responses
Definition stats.h:38
uint64_t total_unknown_types
Definition stats.h:46
uint64_t total_malformed_requests
Definition stats.h:42
ssize_t udp_recv(int sockfd, int flags, fr_socket_t *socket_out, void *data, size_t data_len, fr_time_t *when)
Read a UDP packet.
Definition udp.c:144
int udp_send(fr_socket_t const *sock, int flags, void *data, size_t data_len)
Send a packet via a UDP socket.
Definition udp.c:42
fr_trie_t * fr_master_io_network(TALLOC_CTX *ctx, int af, fr_ipaddr_t *allow, fr_ipaddr_t *deny)
Create a trie from arrays of allow / deny IP addresses.
Definition master.c:3181
uint8_t * reply
reply packet (if any)
Definition master.h:47
fr_io_address_t const * address
of this packet.. shared between multiple packets
Definition master.h:55
size_t reply_len
length of reply, or 1 for "do not reply"
Definition master.h:48
unsigned short uint16_t
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
@ FR_TYPE_COMBO_IP_PREFIX
IPv4 or IPv6 address prefix depending on length.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
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
uint32_t transaction_id
Definition proto_vmps.h:48
char const * interface
Interface to bind to.
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)
char const * name
socket name
fr_ipaddr_t * deny
denied networks for dynamic clients
char const * port_name
Name of the port for getservent().
uint16_t port
Port to listen on.
fr_ipaddr_t ipaddr
IP address to listen on.
bool dynamic_clients
whether we have dynamic clients
static fr_client_t * mod_client_find(fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto)
static int mod_open(fr_listen_t *li)
Open a UDP listener for VMPS.
static const conf_parser_t udp_listen_config[]
static void mod_network_get(int *ipproto, bool *dynamic_clients, fr_trie_t const **trie, void *instance)
fr_ipaddr_t * allow
allowed networks for dynamic clients
static const conf_parser_t networks_config[]
uint32_t max_packet_size
for message ring buffer.
fr_client_list_t * clients
local clients
static void * mod_track_create(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, fr_io_track_t *track, uint8_t const *buffer, size_t buffer_len)
uint32_t recv_buff
How big the kernel's receive buffer should be.
fr_io_address_t * connection
for connected sockets.
bool recv_buff_is_set
Whether we were provided with a receive buffer value.
static int mod_track_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, void const *one, void const *two)
static int mod_connection_set(fr_listen_t *li, fr_io_address_t *connection)
fr_trie_t * trie
for parsed networks
static int mod_fd_set(fr_listen_t *li, int fd)
Set the file descriptor for this socket.
static char const * mod_name(fr_listen_t *li)
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 int mod_instantiate(module_inst_ctx_t const *mctx)
fr_stats_t stats
statistics for this socket
CONF_SECTION * cs
our configuration
fr_app_io_t proto_vmps_udp
#define fr_assert(_expr)
Definition rad_assert.h:37
static int ipproto
#define DEBUG2(fmt,...)
static rs_t * conf
Definition radsniff.c:52
CONF_SECTION * conf
Module's instance configuration.
Definition module.h:351
void * data
Module's instance data.
Definition module.h:293
module_instance_t const * parent
Parent module's instance (if any).
Definition module.h:359
conf_parser_t const * config
How to convert a CONF_SECTION to a module instance.
Definition module.h:206
int fr_socket_server_udp(fr_ipaddr_t const *src_ipaddr, uint16_t *src_port, char const *port_name, bool async)
Open an IPv4/IPv6 unconnected UDP socket.
Definition socket.c:846
int fr_socket_bind(int sockfd, char const *ifname, fr_ipaddr_t *src_ipaddr, uint16_t *src_port)
Bind a UDP/TCP v4/v6 socket to a given ipaddr src port, and interface.
Definition socket.c:200
fr_client_t * client_find(fr_client_list_t const *clients, fr_ipaddr_t const *ipaddr, int proto)
Definition client.c:370
fr_client_list_t * client_list_parse_section(CONF_SECTION *section, int proto, TLS_UNUSED bool tls_required)
Definition client.c:475
Group of clients.
Definition client.c:50
eap_aka_sim_process_conf_t * inst
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
Definition syserror.c:243
#define talloc_get_type_abort_const
Definition talloc.h:117
"server local" time.
Definition time.h:69
#define UDP_FLAGS_CONNECTED
Definition udp.h:38
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:241
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:118
Holds information necessary for binding or connecting to a socket.
Definition socket.h:60
char const * fr_strerror(void)
Get the last library error.
Definition strerror.c:558
#define DOC_ROOT_REF(_x)
Definition version.h:90
bool fr_vmps_ok(uint8_t const *packet, size_t *packet_len)
Definition vmps.c:83
#define FR_VQP_VERSION
Definition vmps.h:35
#define FR_VQP_HDR_LEN
Definition vmps.h:34