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

DHCP client and relay. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/io/pair.h>
#include <freeradius-devel/util/udp_queue.h>
#include <freeradius-devel/dhcpv4/dhcpv4.h>
#include <freeradius-devel/unlang/module.h>
+ Include dependency graph for rlm_dhcpv4.c:

Go to the source code of this file.

Data Structures

struct  rlm_dhcpv4_delay_t
 
struct  rlm_dhcpv4_t
 
struct  rlm_dhcpv4_thread_t
 

Functions

static void dhcpv4_queue_resume (bool sent, void *rctx)
 
static unlang_action_t dhcpv4_resume (rlm_rcode_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 Bootstrap the module. More...
 
static unlang_action_t mod_process (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 Send packets outbound. More...
 
static int mod_thread_instantiate (module_thread_inst_ctx_t const *mctx)
 Instantiate thread data for the submodule. More...
 

Variables

static fr_dict_attr_t const * attr_gateway_ip_address
 
static fr_dict_attr_t const * attr_message_type
 
static fr_dict_attr_t const * attr_net_dst_ip
 
static fr_dict_attr_t const * attr_net_dst_port
 
static fr_dict_attr_t const * attr_packet_type
 
static fr_dict_attr_t const * attr_transaction_id
 
static fr_dict_t const * dict_dhcpv4
 
static fr_dict_t const * dict_freeradius
 
static const conf_parser_t module_config []
 
module_rlm_t rlm_dhcpv4
 
fr_dict_autoload_t rlm_dhcpv4_dict []
 
fr_dict_attr_autoload_t rlm_dhcpv4_dict_attr []
 

Detailed Description

DHCP client and relay.

Id
87c14390c62c87bc45580335ac3bcdb85566515a

Definition in file rlm_dhcpv4.c.


Data Structure Documentation

◆ rlm_dhcpv4_delay_t

struct rlm_dhcpv4_delay_t

Definition at line 101 of file rlm_dhcpv4.c.

+ Collaboration diagram for rlm_dhcpv4_delay_t:
Data Fields
request_t * request
bool sent

◆ rlm_dhcpv4_t

struct rlm_dhcpv4_t

Definition at line 70 of file rlm_dhcpv4.c.

+ Collaboration diagram for rlm_dhcpv4_t:
Data Fields
fr_udp_queue_config_t config UDP queue config.
uint32_t max_packet_size Maximum packet size.

◆ rlm_dhcpv4_thread_t

struct rlm_dhcpv4_thread_t

Definition at line 76 of file rlm_dhcpv4.c.

+ Collaboration diagram for rlm_dhcpv4_thread_t:
Data Fields
uint8_t * buffer for encoding packets
uint32_t buffer_size Maximum packet size.
fr_udp_queue_t * uq udp queue handler
uint32_t xid XID.

Function Documentation

◆ dhcpv4_queue_resume()

static void dhcpv4_queue_resume ( bool  sent,
void *  rctx 
)
static

Definition at line 106 of file rlm_dhcpv4.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dhcpv4_resume()

static unlang_action_t dhcpv4_resume ( rlm_rcode_t p_result,
module_ctx_t const *  mctx,
UNUSED request_t request 
)
static

Definition at line 115 of file rlm_dhcpv4.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Bootstrap the module.

Bootstrap I/O and type submodules.

Parameters
[in]mctxdata for this module
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 290 of file rlm_dhcpv4.c.

◆ mod_process()

static unlang_action_t mod_process ( rlm_rcode_t p_result,
module_ctx_t const *  mctx,
request_t request 
)
static

Send packets outbound.

Definition at line 131 of file rlm_dhcpv4.c.

+ Here is the call graph for this function:

◆ mod_thread_instantiate()

static int mod_thread_instantiate ( module_thread_inst_ctx_t const *  mctx)
static

Instantiate thread data for the submodule.

Definition at line 258 of file rlm_dhcpv4.c.

+ Here is the call graph for this function:

Variable Documentation

◆ attr_gateway_ip_address

fr_dict_attr_t const* attr_gateway_ip_address
static

Definition at line 49 of file rlm_dhcpv4.c.

◆ attr_message_type

fr_dict_attr_t const* attr_message_type
static

Definition at line 45 of file rlm_dhcpv4.c.

◆ attr_net_dst_ip

fr_dict_attr_t const* attr_net_dst_ip
static

Definition at line 47 of file rlm_dhcpv4.c.

◆ attr_net_dst_port

fr_dict_attr_t const* attr_net_dst_port
static

Definition at line 48 of file rlm_dhcpv4.c.

◆ attr_packet_type

fr_dict_attr_t const* attr_packet_type
static

Definition at line 46 of file rlm_dhcpv4.c.

◆ attr_transaction_id

fr_dict_attr_t const* attr_transaction_id
static

Definition at line 44 of file rlm_dhcpv4.c.

◆ dict_dhcpv4

fr_dict_t const* dict_dhcpv4
static

Definition at line 34 of file rlm_dhcpv4.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 35 of file rlm_dhcpv4.c.

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("port", rlm_dhcpv4_t, config.port), .dflt = "68" },
{ FR_CONF_OFFSET("interface", rlm_dhcpv4_t, config.interface) },
{ FR_CONF_OFFSET_IS_SET("send_buff", FR_TYPE_UINT32, 0, rlm_dhcpv4_t, config.send_buff) },
{ FR_CONF_OFFSET("max_packet_size", rlm_dhcpv4_t, max_packet_size), .dflt = "576" },
{ FR_CONF_OFFSET("max_queued_packets", rlm_dhcpv4_t, config.max_queued_packets), .dflt = "65536" },
{ FR_CONF_OFFSET("timeout", rlm_dhcpv4_t, config.max_queued_time), .dflt = "0" },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627
#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_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
#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_IPV4_ADDR
32 Bit IPv4 Address.
Definition: merged_model.c:86
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99
static const conf_parser_t config[]
Definition: base.c:183

Definition at line 83 of file rlm_dhcpv4.c.

◆ rlm_dhcpv4

module_rlm_t rlm_dhcpv4
Initial value:
= {
.common = {
.name = "dhcpv4",
.inst_size = sizeof(rlm_dhcpv4_t),
.thread_inst_size = sizeof(rlm_dhcpv4_thread_t),
.thread_inst_type = "rlm_dhcpv4_thread_t",
.thread_instantiate = mod_thread_instantiate
},
.method_group = {
.bindings = (module_method_binding_t[]){
{ .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process },
}
}
}
#define CF_IDENT_ANY
Definition: cf_util.h:78
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:63
static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Send packets outbound.
Definition: rlm_dhcpv4.c:131
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Instantiate thread data for the submodule.
Definition: rlm_dhcpv4.c:258
static const conf_parser_t module_config[]
Definition: rlm_dhcpv4.c:83
static int mod_instantiate(module_inst_ctx_t const *mctx)
Bootstrap the module.
Definition: rlm_dhcpv4.c:290
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1302
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
Definition: section.h:40
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Definition: module.h:151
Named methods exported by a module.
Definition: module.h:173

Definition at line 323 of file rlm_dhcpv4.c.

◆ rlm_dhcpv4_dict

fr_dict_autoload_t rlm_dhcpv4_dict
Initial value:
= {
{ .out = &dict_dhcpv4, .proto = "dhcpv4" },
{ .out = &dict_freeradius, .proto = "freeradius" },
{ NULL }
}
static fr_dict_t const * dict_freeradius
Definition: rlm_dhcpv4.c:35
static fr_dict_t const * dict_dhcpv4
Definition: rlm_dhcpv4.c:34

Definition at line 38 of file rlm_dhcpv4.c.

◆ rlm_dhcpv4_dict_attr

fr_dict_attr_autoload_t rlm_dhcpv4_dict_attr
Initial value:
= {
{ .out = &attr_transaction_id, .name = "Transaction-Id", .type = FR_TYPE_UINT32, .dict = &dict_dhcpv4 },
{ .out = &attr_gateway_ip_address, .name = "Gateway-IP-Address", .type = FR_TYPE_IPV4_ADDR, .dict = &dict_dhcpv4 },
{ .out = &attr_message_type, .name = "Message-Type", .type = FR_TYPE_UINT8, .dict = &dict_dhcpv4 },
{ .out = &attr_packet_type, .name = "Packet-Type", .type = FR_TYPE_UINT32, .dict = &dict_dhcpv4 },
{ .out = &attr_net_dst_ip, .name = "Net.Dst.IP", .type = FR_TYPE_COMBO_IP_ADDR, .dict = &dict_freeradius },
{ .out = &attr_net_dst_port, .name = "Net.Dst.Port", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
{ NULL }
}
@ FR_TYPE_UINT16
16 Bit unsigned integer.
Definition: merged_model.c:98
@ FR_TYPE_UINT8
8 Bit unsigned integer.
Definition: merged_model.c:97
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
Definition: merged_model.c:91
static fr_dict_attr_t const * attr_packet_type
Definition: rlm_dhcpv4.c:46
static fr_dict_attr_t const * attr_net_dst_port
Definition: rlm_dhcpv4.c:48
static fr_dict_attr_t const * attr_gateway_ip_address
Definition: rlm_dhcpv4.c:49
static fr_dict_attr_t const * attr_net_dst_ip
Definition: rlm_dhcpv4.c:47
static fr_dict_attr_t const * attr_transaction_id
Definition: rlm_dhcpv4.c:44
static fr_dict_attr_t const * attr_message_type
Definition: rlm_dhcpv4.c:45

Definition at line 52 of file rlm_dhcpv4.c.