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 <ctype.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_bootstrap (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
3be14b864946e15203c61e19d318cd8ad323c9a2

Definition in file rlm_dhcpv4.c.


Data Structure Documentation

◆ rlm_dhcpv4_delay_t

struct rlm_dhcpv4_delay_t

Definition at line 144 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 72 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 78 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 149 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 184 of file rlm_dhcpv4.c.

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

◆ mod_bootstrap()

static int mod_bootstrap ( 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 112 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 201 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 161 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 51 of file rlm_dhcpv4.c.

◆ attr_message_type

fr_dict_attr_t const* attr_message_type
static

Definition at line 47 of file rlm_dhcpv4.c.

◆ attr_net_dst_ip

fr_dict_attr_t const* attr_net_dst_ip
static

Definition at line 49 of file rlm_dhcpv4.c.

◆ attr_net_dst_port

fr_dict_attr_t const* attr_net_dst_port
static

Definition at line 50 of file rlm_dhcpv4.c.

◆ attr_packet_type

fr_dict_attr_t const* attr_packet_type
static

Definition at line 48 of file rlm_dhcpv4.c.

◆ attr_transaction_id

fr_dict_attr_t const* attr_transaction_id
static

Definition at line 46 of file rlm_dhcpv4.c.

◆ dict_dhcpv4

fr_dict_t const* dict_dhcpv4
static

Definition at line 36 of file rlm_dhcpv4.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 37 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:626
#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:188

Definition at line 85 of file rlm_dhcpv4.c.

◆ rlm_dhcpv4

module_rlm_t rlm_dhcpv4
Initial value:
= {
.common = {
.name = "dhcpv4",
.inst_size = sizeof(rlm_dhcpv4_t),
.bootstrap = mod_bootstrap,
.thread_inst_size = sizeof(rlm_dhcpv4_thread_t),
.thread_inst_type = "rlm_dhcpv4_thread_t",
.thread_instantiate = mod_thread_instantiate
},
.method_names = (module_method_name_t[]){
{ .name1 = CF_IDENT_ANY, .name2 = 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:65
Specifies a module method identifier.
Definition: module_method.c:36
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:201
static int mod_bootstrap(module_inst_ctx_t const *mctx)
Bootstrap the module.
Definition: rlm_dhcpv4.c:112
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Instantiate thread data for the submodule.
Definition: rlm_dhcpv4.c:161
static const conf_parser_t module_config[]
Definition: rlm_dhcpv4.c:85
#define MODULE_NAME_TERMINATOR
Definition: module.h:135

Definition at line 325 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:37
static fr_dict_t const * dict_dhcpv4
Definition: rlm_dhcpv4.c:36

Definition at line 40 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:48
static fr_dict_attr_t const * attr_net_dst_port
Definition: rlm_dhcpv4.c:50
static fr_dict_attr_t const * attr_gateway_ip_address
Definition: rlm_dhcpv4.c:51
static fr_dict_attr_t const * attr_net_dst_ip
Definition: rlm_dhcpv4.c:49
static fr_dict_attr_t const * attr_transaction_id
Definition: rlm_dhcpv4.c:46
static fr_dict_attr_t const * attr_message_type
Definition: rlm_dhcpv4.c:47

Definition at line 54 of file rlm_dhcpv4.c.