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

DHCPv6 handler for UDP. More...

#include <freeradius-devel/server/protocol.h>
#include <freeradius-devel/util/udp.h>
#include <freeradius-devel/util/trie.h>
#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/schedule.h>
#include <freeradius-devel/protocol/dhcpv6/freeradius.internal.h>
#include "proto_dhcpv6.h"
+ Include dependency graph for proto_dhcpv6_udp.c:

Go to the source code of this file.

Data Structures

struct  proto_dhcpv6_udp_t
 
struct  proto_dhcpv6_udp_thread_t
 

Macros

#define LOG_PREFIX   "proto_dhcpv6_udp"
 

Functions

static fr_client_tmod_client_find (fr_listen_t *li, fr_ipaddr_t const *ipaddr, int ipproto)
 
static int mod_connection_set (fr_listen_t *li, fr_io_address_t *connection)
 
static int mod_fd_set (fr_listen_t *li, int fd)
 Set the file descriptor for this socket. More...
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static char const * mod_name (fr_listen_t *li)
 
static void mod_network_get (int *ipproto, bool *dynamic_clients, fr_trie_t const **trie, void *instance)
 
static int mod_open (fr_listen_t *li)
 Open a UDP listener for DHCPv6. 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 int mod_track_compare (UNUSED void const *instance, UNUSED void *thread_instance, UNUSED fr_client_t *client, void const *one, void const *two)
 
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 *packet, size_t packet_len)
 
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 fr_dict_attr_t const * attr_client_id
 
static fr_dict_attr_t const * attr_packet_type
 
static fr_dict_attr_t const * attr_relay_message
 
static fr_dict_t const * dict_dhcpv6
 
static const conf_parser_t networks_config []
 
fr_app_io_t proto_dhcpv6_udp
 
fr_dict_autoload_t proto_dhcpv6_udp_dict []
 
fr_dict_attr_autoload_t proto_dhcpv6_udp_dict_attr []
 
static const conf_parser_t udp_listen_config []
 

Detailed Description

DHCPv6 handler for UDP.

Id
3535e3ed31316abf714ece8ce64e77be7ee4f613

Definition in file proto_dhcpv6_udp.c.


Data Structure Documentation

◆ proto_dhcpv6_udp_t

struct proto_dhcpv6_udp_t

Definition at line 46 of file proto_dhcpv6_udp.c.

+ Collaboration diagram for proto_dhcpv6_udp_t:
Data Fields
fr_ipaddr_t * allow allowed networks for dynamic clients
fr_client_list_t * clients local clients
CONF_SECTION * cs our configuration
fr_client_t * default_client default 0/0 client
fr_ipaddr_t * deny denied networks for dynamic clients
bool dynamic_clients whether we have dynamic clients
fr_ethernet_t ethernet ethernet address associated with the interface
uint32_t hop_limit for multicast addresses
char const * interface Interface to bind to.
fr_ipaddr_t ipaddr IP address to listen on.
uint32_t max_attributes Limit maximum decodable attributes.
uint32_t max_packet_size for message ring buffer.
bool multicast whether or not we listen for multicast packets
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 receive buffer value.
fr_ipaddr_t src_ipaddr IP address to source replies.
fr_trie_t * trie for parsed networks

◆ proto_dhcpv6_udp_thread_t

struct proto_dhcpv6_udp_thread_t

Definition at line 37 of file proto_dhcpv6_udp.c.

+ Collaboration diagram for proto_dhcpv6_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

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   "proto_dhcpv6_udp"

Definition at line 24 of file proto_dhcpv6_udp.c.

Function Documentation

◆ 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 649 of file proto_dhcpv6_udp.c.

+ Here is the call graph for this function:

◆ mod_connection_set()

static int mod_connection_set ( fr_listen_t li,
fr_io_address_t connection 
)
static

Definition at line 258 of file proto_dhcpv6_udp.c.

◆ 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 376 of file proto_dhcpv6_udp.c.

+ Here is the call graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 470 of file proto_dhcpv6_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 462 of file proto_dhcpv6_udp.c.

◆ mod_network_get()

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

Definition at line 267 of file proto_dhcpv6_udp.c.

◆ mod_open()

static int mod_open ( fr_listen_t li)
static

Open a UDP listener for DHCPv6.

Definition at line 280 of file proto_dhcpv6_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 131 of file proto_dhcpv6_udp.c.

+ Here is the call graph for this function:

◆ mod_track_compare()

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

Definition at line 445 of file proto_dhcpv6_udp.c.

◆ mod_track_create()

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 *  packet,
size_t  packet_len 
)
static

Definition at line 391 of file proto_dhcpv6_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 209 of file proto_dhcpv6_udp.c.

+ Here is the call graph for this function:

Variable Documentation

◆ attr_client_id

fr_dict_attr_t const* attr_client_id
static

Definition at line 120 of file proto_dhcpv6_udp.c.

◆ attr_packet_type

fr_dict_attr_t const* attr_packet_type
static

Definition at line 119 of file proto_dhcpv6_udp.c.

◆ attr_relay_message

fr_dict_attr_t const* attr_relay_message
static

Definition at line 121 of file proto_dhcpv6_udp.c.

◆ dict_dhcpv6

fr_dict_t const* dict_dhcpv6
static

Definition at line 111 of file proto_dhcpv6_udp.c.

◆ networks_config

const conf_parser_t networks_config[]
static
Initial value:
= {
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
Definition: cf_parse.h:419
#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 80 of file proto_dhcpv6_udp.c.

◆ proto_dhcpv6_udp

fr_app_io_t proto_dhcpv6_udp
Initial value:
= {
.common = {
.name = "dhcpv6_udp",
.config = udp_listen_config,
.inst_size = sizeof(proto_dhcpv6_udp_t),
.thread_inst_size = sizeof(proto_dhcpv6_udp_thread_t),
.instantiate = mod_instantiate
},
.default_message_size = 4096,
.track_duplicates = true,
.open = mod_open,
.read = mod_read,
.write = mod_write,
.fd_set = mod_fd_set,
.track_create = mod_track_create,
.track_compare = mod_track_compare,
.connection_set = mod_connection_set,
.network_get = mod_network_get,
.client_find = mod_client_find,
.get_name = mod_name,
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:63
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_open(fr_listen_t *li)
Open a UDP listener for DHCPv6.
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)
static char const * mod_name(fr_listen_t *li)
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)
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)
static int mod_instantiate(module_inst_ctx_t const *mctx)
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 *packet, size_t packet_len)

Definition at line 666 of file proto_dhcpv6_udp.c.

◆ proto_dhcpv6_udp_dict

fr_dict_autoload_t proto_dhcpv6_udp_dict
Initial value:
= {
{ .out = &dict_dhcpv6, .proto = "dhcpv6" },
{ NULL }
}
static fr_dict_t const * dict_dhcpv6

Definition at line 114 of file proto_dhcpv6_udp.c.

◆ proto_dhcpv6_udp_dict_attr

fr_dict_attr_autoload_t proto_dhcpv6_udp_dict_attr
Initial value:
= {
{ .out = &attr_packet_type, .name = "Packet-Type", .type = FR_TYPE_UINT32, .dict = &dict_dhcpv6},
{ .out = &attr_client_id, .name = "Client-ID", .type = FR_TYPE_STRUCT, .dict = &dict_dhcpv6},
{ .out = &attr_relay_message, .name = "Relay-Message", .type = FR_TYPE_GROUP, .dict = &dict_dhcpv6 },
{ NULL }
}
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99
@ FR_TYPE_STRUCT
like TLV, but without T or L, and fixed-width children
Definition: merged_model.c:119
@ FR_TYPE_GROUP
A grouping of other attributes.
Definition: merged_model.c:124
static fr_dict_attr_t const * attr_packet_type
static fr_dict_attr_t const * attr_relay_message
static fr_dict_attr_t const * attr_client_id

Definition at line 124 of file proto_dhcpv6_udp.c.

◆ udp_listen_config

const conf_parser_t udp_listen_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("interface", proto_dhcpv6_udp_t, interface) },
{ FR_CONF_OFFSET("port_name", proto_dhcpv6_udp_t, port_name) },
{ FR_CONF_OFFSET("port", proto_dhcpv6_udp_t, port), .dflt = "547" },
{ FR_CONF_OFFSET_IS_SET("recv_buff", FR_TYPE_UINT32, 0, proto_dhcpv6_udp_t, recv_buff) },
{ FR_CONF_OFFSET("hop_limit", proto_dhcpv6_udp_t, hop_limit) },
{ FR_CONF_OFFSET("dynamic_clients", proto_dhcpv6_udp_t, dynamic_clients) } ,
{ FR_CONF_POINTER("networks", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) networks_config },
{ FR_CONF_OFFSET("max_packet_size", proto_dhcpv6_udp_t, max_packet_size), .dflt = "8192" } ,
{ FR_CONF_OFFSET("max_attributes", proto_dhcpv6_udp_t, max_attributes), .dflt = STRINGIFY(DHCPV6_MAX_ATTRIBUTES) } ,
}
#define STRINGIFY(x)
Definition: build.h:195
#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:399
#define DHCPV6_MAX_ATTRIBUTES
Definition: dhcpv6.h:52
@ 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 at line 88 of file proto_dhcpv6_udp.c.