The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
proto_dns_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: a51f02412bd56f1be3a9c4c3b6190b8d9ba52798 $
19 * @file proto_dns_udp.c
20 * @brief DNS handler for UDP.
21 *
22 * @copyright 2020 Network RADIUS SAS (legal@networkradius.com)
23 */
24#define LOG_PREFIX "proto_dns_udp"
25
26#include <freeradius-devel/server/cf_util.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#include <freeradius-devel/protocol/dns/freeradius.internal.h>
33#include "proto_dns.h"
34
36
37typedef struct {
38 char const *name; //!< socket name
39 int sockfd;
40
41 fr_io_address_t *connection; //!< for connected sockets.
42
43 fr_stats_t stats; //!< statistics for this socket
45
46typedef struct {
47 CONF_SECTION *cs; //!< our configuration
48
49 fr_ipaddr_t ipaddr; //!< IP address to listen on.
50
51 char const *interface; //!< Interface to bind to.
52
53 uint32_t recv_buff; //!< How big the kernel's receive buffer should be.
54
55 uint32_t max_packet_size; //!< for message ring buffer.
56 uint32_t max_attributes; //!< Limit maximum decodable attributes.
57
58 uint16_t port; //!< Port to listen on.
59
60 bool recv_buff_is_set; //!< Whether we were provided with a receive
61 //!< buffer value.
62
63 fr_client_list_t *clients; //!< local clients
64 fr_client_t *default_client; //!< default 0/0 client
65
66 fr_trie_t *trie; //!< for parsed networks
67 fr_ipaddr_t *allow; //!< allowed networks for dynamic clients
68 fr_ipaddr_t *deny; //!< denied networks for dynamic clients
70
71
78
79
84
85 { FR_CONF_OFFSET("interface", proto_dns_udp_t, interface) },
86
87 { FR_CONF_OFFSET("port", proto_dns_udp_t, port), .dflt = "53" },
88 { FR_CONF_OFFSET_IS_SET("recv_buff", FR_TYPE_UINT32, 0, proto_dns_udp_t, recv_buff) },
89
90 { FR_CONF_POINTER("networks", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) networks_config },
91
92 { FR_CONF_OFFSET("max_packet_size", proto_dns_udp_t, max_packet_size), .dflt = "576" } ,
93 { FR_CONF_OFFSET("max_attributes", proto_dns_udp_t, max_attributes), .dflt = STRINGIFY(DNS_MAX_ATTRIBUTES) } ,
94
96};
97
98static fr_dict_t const *dict_dns;
99
102 { .out = &dict_dns, .proto = "dns" },
104};
105
107
110 { .out = &attr_packet_type, .name = "Packet-Type", .type = FR_TYPE_UINT32, .dict = &dict_dns},
111
113};
114
116 size_t buffer_len, size_t *leftover)
117{
118// proto_dns_udp_t const *inst = talloc_get_type_abort_const(li->listen->app_io_instance,
119// proto_dns_udp_t);
120 proto_dns_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_dns_udp_thread_t);
121 fr_io_address_t *address, **address_p;
122
123 int flags;
124 ssize_t data_size;
125 size_t packet_len;
126 uint32_t xid;
127 uint8_t opcode;
128 fr_dns_packet_t *packet;
130
131 *leftover = 0; /* always for UDP */
132
133 /*
134 * Where the addresses should go. This is a special case
135 * for proto_dns.
136 */
137 address_p = (fr_io_address_t **)packet_ctx;
138 address = *address_p;
139
140 /*
141 * Tell udp_recv if we're connected or not.
142 */
143 flags = UDP_FLAGS_CONNECTED * (thread->connection != NULL);
144
145 data_size = udp_recv(thread->sockfd, flags, &address->socket, buffer, buffer_len, recv_time_p);
146 if (data_size < 0) {
147 RATE_LIMIT_GLOBAL(PERROR, "Read error (%zd)", data_size);
148 return data_size;
149 }
150
151 if ((size_t) data_size < DNS_HDR_LEN) {
152 RATE_LIMIT_GLOBAL(WARN, "Insufficient data - ignoring");
153 return 0;
154 }
155
156 packet_len = data_size;
157
158 /*
159 * We've seen a server reply to this port, but the giaddr
160 * is *not* our address. Drop it.
161 */
162 packet = (fr_dns_packet_t *) buffer;
163
164 if (!fr_dns_packet_ok(buffer, packet_len, true, &reason)) {
165 RATE_LIMIT_GLOBAL(WARN, "Ignoring invalid DNS packet - %s",
167 return 0;
168 }
169
170 /*
171 * check packet code
172 */
173
174 /*
175 * proto_dns sets the priority
176 */
177
179
180 /*
181 * fr_dns_packet_ok() rejects opcodes outside fr_dns_packet_names.
182 */
183 opcode = packet->opcode;
184 if (!fr_cond_assert_msg(opcode < FR_DNS_CODE_MAX, "fr_dns_packet_ok() accepted invalid opcode %u", opcode)) {
185 return 0;
186 }
187
188 /*
189 * Print out what we received.
190 */
191 DEBUG2("Received %s ID %04x length %d %s", fr_dns_packet_names[opcode], xid,
192 (int) packet_len, thread->name);
193
194 return packet_len;
195}
196
198 size_t buffer_len, UNUSED size_t written)
199{
200// proto_dns_udp_t const *inst = talloc_get_type_abort_const(li->listen->app_io_instance,
201// proto_dns_udp_t);
202 proto_dns_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_dns_udp_thread_t);
203
204 fr_io_track_t *track = talloc_get_type_abort(packet_ctx, fr_io_track_t);
205 fr_socket_t socket;
206
207 int flags;
208 ssize_t data_size;
209
210 /*
211 * @todo - share a stats interface with the parent? or
212 * put the stats in the listener, so that proto_dns
213 * can update them, too.. <sigh>
214 */
215 thread->stats.total_responses++;
216
217 flags = UDP_FLAGS_CONNECTED * (thread->connection != NULL);
218
219 /*
220 * Send packets to the originator.
221 */
222 fr_socket_addr_swap(&socket, &track->address->socket);
223
224 /*
225 * Figure out which kind of packet we're sending.
226 */
227 if (!thread->connection) {
228 // @todo - figure out where to send the packet
229 }
230
231 /*
232 * proto_dns takes care of suppressing do-not-respond, etc.
233 */
234 data_size = udp_send(&socket, flags, buffer, buffer_len);
235
236 /*
237 * This socket is dead. That's an error...
238 */
239 if (data_size <= 0) return data_size;
240
241 return data_size;
242}
243
244
246{
247 proto_dns_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_dns_udp_thread_t);
248
249 thread->connection = connection;
250 return 0;
251}
252
253
254static void mod_network_get(int *ipproto, bool *dynamic_clients, fr_trie_t const **trie, void *instance)
255{
256 proto_dns_udp_t *inst = talloc_get_type_abort(instance, proto_dns_udp_t);
257
258 *ipproto = IPPROTO_UDP;
259 *dynamic_clients = false;
260 *trie = inst->trie;
261}
262
263
264/** Open a UDP listener for DHCPv6
265 *
266 */
268{
270 proto_dns_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_dns_udp_thread_t);
271
272 int sockfd, rcode;
273 fr_ipaddr_t ipaddr = inst->ipaddr;
274 uint16_t port = inst->port;
275
276 li->fd = sockfd = fr_socket_server_udp(&inst->ipaddr, &port, "domain", true);
277 if (sockfd < 0) {
278 cf_log_err(li->listen->cs, "Failed opening UDP socket - %s", fr_strerror());
279 error:
280 return -1;
281 }
282
283 li->app_io_addr = fr_socket_addr_alloc_inet_src(li, IPPROTO_UDP, 0, &inst->ipaddr, port);
284
285 /*
286 * Set SO_REUSEPORT before bind, so that all packets can
287 * listen on the same destination IP address.
288 */
289 if (1) {
290 int on = 1;
291
292 if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0) {
293 cf_log_err(li->listen->cs, "Failed to set socket 'reuseport' - %s", fr_syserror(errno));
294 close(sockfd);
295 return -1;
296 }
297 }
298
299 /*
300 * SUID up is really only needed if interface is set, OR port <1024.
301 */
302 rad_suid_up();
303 rcode = fr_socket_bind(sockfd, inst->interface, &ipaddr, &port);
305 if (rcode < 0) {
306 close(sockfd);
307 cf_log_err(li->listen->cs, "Failed binding to socket - %s", fr_strerror());
308 cf_log_err(li->listen->cs, DOC_ROOT_REF(troubleshooting/network/bind));
309 goto error;
310 }
311
312 thread->sockfd = sockfd;
313
314 fr_assert((cf_parent(inst->cs) != NULL) && (cf_parent(cf_parent(inst->cs)) != NULL)); /* listen { ... } */
315
316 thread->name = fr_app_io_socket_name(thread, &proto_dns_udp,
317 NULL, 0,
318 &inst->ipaddr, inst->port,
319 inst->interface);
320 return 0;
321}
322
323
324/** Set the file descriptor for this socket.
325 *
326 */
327static int mod_fd_set(fr_listen_instance_t *li, int fd)
328{
330 proto_dns_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_dns_udp_thread_t);
331
332 thread->sockfd = fd;
333
334 thread->name = fr_app_io_socket_name(thread, &proto_dns_udp,
335 &thread->connection->socket.inet.src_ipaddr, thread->connection->socket.inet.src_port,
336 &inst->ipaddr, inst->port,
337 inst->interface);
338
339 return 0;
340}
341
342
343static char const *mod_name(fr_listen_instance_t *li)
344{
345 proto_dns_udp_thread_t *thread = talloc_get_type_abort(li->thread_instance, proto_dns_udp_thread_t);
346
347 return thread->name;
348}
349
350
351static int mod_instantiate(module_inst_ctx_t const *mctx)
352{
353 proto_dns_udp_t *inst = talloc_get_type_abort(mctx->mi->data, proto_dns_udp_t);
354 CONF_SECTION *conf = mctx->mi->conf;
355 size_t num;
356 CONF_SECTION *server_cs;
357 fr_client_t *client;
358
359 inst->cs = conf;
360
361 /*
362 * Complain if no "ipaddr" is set.
363 */
364 if (inst->ipaddr.af == AF_UNSPEC) {
365 if (!inst->interface) {
366 cf_log_err(conf, "No 'ipaddr' was specified in the 'udp' section");
367 return -1;
368 }
369
370 /*
371 * If there's a named interface, maybe we can
372 * find a link-local address for it. If so, just
373 * use that.
374 */
375 if (inst->interface &&
376 (fr_interface_to_ipaddr(inst->interface, &inst->ipaddr, AF_INET, true) < 0)) {
377 cf_log_err(conf, "No 'ipaddr' specified, and we cannot determine one for interface '%s'",
378 inst->interface);
379 return -1;
380 }
381 }
382
383 if (inst->recv_buff_is_set) {
384 FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, >=, 32);
385 FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, <=, INT_MAX);
386 }
387
388 FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 64);
389 FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, <=, 65536);
390
391 /*
392 * Parse and create the trie for dynamic clients, even if
393 * there's no dynamic clients.
394 */
395 num = talloc_array_length(inst->allow);
396 if (num) {
397 inst->trie = fr_master_io_network(inst, inst->ipaddr.af, inst->allow, inst->deny);
398 if (!inst->trie) {
399 cf_log_perr(conf, "Failed creating list of networks");
400 return -1;
401 }
402 }
403
404 server_cs = cf_section_find_parent(inst->cs, "server", CF_IDENT_ANY);
405 fr_assert(server_cs != NULL);
406
407 /*
408 * Look up local clients, if they exist.
409 *
410 * @todo - ensure that we only parse clients which are
411 * for IPPROTO_UDP, and don't require a "secret".
412 */
413 if (cf_section_find_next(server_cs, NULL, "client", CF_IDENT_ANY)) {
414 inst->clients = client_list_parse_section(server_cs, IPPROTO_UDP, false);
415 if (!inst->clients) {
416 cf_log_err(conf, "Failed creating local clients");
417 return -1;
418 }
419 }
420
421 /*
422 * Create a fake client.
423 */
424 client = inst->default_client = talloc_zero(inst, fr_client_t);
425 if (!inst->default_client) return -1;
426
427 client->ipaddr = (fr_ipaddr_t ) {
428 .af = AF_INET6,
429 };
430
431 client->src_ipaddr = client->ipaddr;
432
433 client->longname = client->shortname = client->secret = talloc_strdup(client, "default");
434 client->nas_type = talloc_strdup(client, "other");
435
436 return 0;
437}
438
440{
442
443 /*
444 * Prefer local clients.
445 */
446 if (inst->clients) {
447 fr_client_t *client;
448
449 client = client_find(inst->clients, ipaddr, ipproto);
450 if (client) return client;
451 }
452
453 return inst->default_client;
454}
455
457 .common = {
458 .magic = MODULE_MAGIC_INIT,
459 .name = "dns_udp",
461 .inst_size = sizeof(proto_dns_udp_t),
462 .thread_inst_size = sizeof(proto_dns_udp_thread_t),
463 .instantiate = mod_instantiate
464 },
465 .default_message_size = 576,
466 .track_duplicates = false,
467
468 .open = mod_open,
469 .read = mod_read,
470 .write = mod_write,
471 .fd_set = mod_fd_set,
472 .connection_set = mod_connection_set,
473 .network_get = mod_network_get,
474 .client_find = mod_client_find,
475 .get_name = mod_name,
476};
static int const char char buffer[256]
Definition acutest.h:641
char const * fr_app_io_socket_name(TALLOC_CTX *ctx, fr_app_io_t const *app_io, fr_ipaddr_t const *src_ipaddr, uint16_t src_port, fr_ipaddr_t const *dst_ipaddr, uint16_t 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
static int packet_ctx
the tests pass only the address of packet_ctx
#define STRINGIFY(x)
Definition build.h:233
#define UNUSED
Definition build.h:415
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:722
#define FR_INTEGER_BOUND_CHECK(_name, _var, _op, _bound)
Definition cf_parse.h:572
#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
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
Definition cf_parse.h:483
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition cf_parse.h:460
#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:350
#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
#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:649
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:106
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:1268
#define cf_log_err(_cf, _fmt,...)
Definition cf_util.h:340
#define cf_parent(_cf)
Definition cf_util.h:115
#define cf_log_perr(_cf, _fmt,...)
Definition cf_util.h:347
#define cf_section_find_parent(_cf, _name1, _name2)
Definition cf_util.h:233
#define CF_IDENT_ANY
Definition cf_util.h:80
#define fr_cond_assert_msg(_x, _fmt,...)
Calls panic_action ifndef NDEBUG, else logs error and evaluates to value of _x.
Definition debug.h:194
static int sockfd
Definition dhcpclient.c:55
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
Definition dict.h:316
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
Definition dict.h:329
#define DICT_AUTOLOAD_TERMINATOR
Definition dict.h:335
Specifies an attribute which must be present for the module to function.
Definition dict.h:315
Specifies a dictionary which must be loaded/loadable for the module to function.
Definition dict.h:328
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition dl_module.h:63
#define DNS_HDR_LEN
Definition dns_tests.c:29
int fr_interface_to_ipaddr(char const *interface, fr_ipaddr_t *ipaddr, int af, bool link_local)
Definition inet.c:1614
int af
Address family.
Definition inet.h:64
IPv4/6 prefix.
fr_socket_t socket
src/dst ip and port.
Definition base.h:342
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:125
char const * longname
Client identifier.
Definition client.h:87
char const * shortname
Client nickname.
Definition client.h:88
Describes a host allowed to send packets to the server.
Definition client.h:80
#define PERROR(_fmt,...)
Definition log.h:233
#define RATE_LIMIT_GLOBAL(_log, _fmt,...)
Rate limit messages using a global limiting entry.
Definition log.h:660
uint64_t total_responses
Definition stats.h:38
void rad_suid_up(void)
Definition util.c:767
void rad_suid_down(void)
Definition util.c:771
ssize_t 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
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
fr_listen_t * listen
the listener this is a socket of.
Definition listen.h:65
int fd
file descriptor for this socket - set by open
Definition listen.h:67
void const * app_io_instance
I/O path configuration context.
Definition listen.h:34
CONF_SECTION * cs
of this listener
Definition listen.h:39
fr_socket_t * app_io_addr
for tracking duplicate sockets
Definition listen.h:71
void * thread_instance
thread / socket context
Definition listen.h:69
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:3221
fr_io_address_t const * address
of this packet.. shared between multiple packets
Definition master.h:55
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
static uint16_t fr_nbo_to_uint16(uint8_t const data[static sizeof(uint16_t)])
Read an unsigned 16bit integer from wire format (big endian)
Definition nbo.h:146
static fr_client_t * mod_client_find(fr_listen_instance_t *li, fr_ipaddr_t const *ipaddr, int ipproto)
uint32_t max_attributes
Limit maximum decodable attributes.
static fr_dict_attr_t const * attr_packet_type
fr_io_address_t * connection
for connected sockets.
uint16_t port
Port to listen on.
CONF_SECTION * cs
our configuration
fr_client_list_t * clients
local clients
fr_ipaddr_t * allow
allowed networks for dynamic clients
fr_client_t * default_client
default 0/0 client
fr_app_io_t proto_dns_udp
char const * name
socket name
fr_stats_t stats
statistics for this socket
bool recv_buff_is_set
Whether we were provided with a receive buffer value.
fr_dict_attr_autoload_t proto_dns_udp_dict_attr[]
static int mod_open(fr_listen_instance_t *li)
Open a UDP listener for DHCPv6.
uint32_t max_packet_size
for message ring buffer.
char const * interface
Interface to bind to.
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 ipaddr
IP address to listen on.
fr_ipaddr_t * deny
denied networks for dynamic clients
static ssize_t mod_read(fr_listen_instance_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 networks_config[]
static int mod_fd_set(fr_listen_instance_t *li, int fd)
Set the file descriptor for this socket.
fr_dict_autoload_t proto_dns_udp_dict[]
static char const * mod_name(fr_listen_instance_t *li)
fr_trie_t * trie
for parsed networks
static ssize_t mod_write(fr_listen_instance_t *li, void *packet_ctx, UNUSED fr_time_t request_time, uint8_t *buffer, size_t buffer_len, UNUSED size_t written)
uint32_t recv_buff
How big the kernel's receive buffer should be.
static fr_dict_t const * dict_dns
static int mod_connection_set(fr_listen_instance_t *li, fr_io_address_t *connection)
static int mod_instantiate(module_inst_ctx_t const *mctx)
char const * fr_dns_packet_names[FR_DNS_CODE_MAX]
Definition base.c:68
bool fr_dns_packet_ok(uint8_t const *packet, size_t packet_len, bool query, fr_dns_decode_fail_t *reason)
Definition base.c:109
fr_table_num_ordered_t fr_dns_reason_fail_table[]
Definition decode.c:394
unsigned int opcode
Definition dns.h:49
fr_dns_decode_fail_t
Definition dns.h:102
#define DNS_MAX_ATTRIBUTES
Definition dns.h:35
@ FR_DNS_CODE_MAX
Definition dns.h:90
#define fr_assert(_expr)
Definition rad_assert.h:37
#define DEBUG2(fmt,...)
#define WARN(fmt,...)
static int ipproto
Definition radclient.c:91
static rs_t * conf
Definition radsniff.c:52
CONF_SECTION * conf
Module's instance configuration.
Definition module.h:355
void * data
Module's instance data.
Definition module.h:297
conf_parser_t const * config
How to convert a CONF_SECTION to a module instance.
Definition module.h:207
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:841
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 fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
Definition table.h:804
#define talloc_get_type_abort_const
Definition talloc.h:117
#define talloc_strdup(_ctx, _str)
Definition talloc.h:149
"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:249
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:126
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