25 #include <freeradius-devel/io/application.h>
26 #include <freeradius-devel/server/protocol.h>
27 #include <freeradius-devel/util/dict.h>
28 #include <freeradius-devel/util/debug.h>
29 #include <freeradius-devel/vmps/vmps.h>
31 #include <freeradius-devel/protocol/vmps/vmps.h>
63 #define PROCESS_PACKET_TYPE fr_vmps_packet_code_t
64 #define PROCESS_CODE_MAX FR_VMPS_CODE_MAX
65 #define PROCESS_CODE_DO_NOT_RESPOND FR_VMPS_DO_NOT_RESPOND
66 #define PROCESS_PACKET_CODE_VALID FR_VMPS_PACKET_CODE_VALID
67 #define PROCESS_INST process_vmps_t
68 #include <freeradius-devel/server/process.h>
71 [FR_PACKET_TYPE_VALUE_JOIN_REQUEST] = {
85 .resume = resume_recv_generic,
86 .section_offset = PROCESS_CONF_OFFSET(join_request),
88 [FR_PACKET_TYPE_VALUE_JOIN_RESPONSE] = {
101 .send = send_generic,
102 .resume = resume_send_generic,
103 .section_offset = PROCESS_CONF_OFFSET(join_response),
106 [FR_PACKET_TYPE_VALUE_RECONFIRM_REQUEST] = {
119 .recv = recv_generic,
120 .resume = resume_recv_generic,
121 .section_offset = PROCESS_CONF_OFFSET(reconfirm_request),
123 [FR_PACKET_TYPE_VALUE_RECONFIRM_RESPONSE] = {
136 .send = send_generic,
137 .resume = resume_send_generic,
138 .section_offset = PROCESS_CONF_OFFSET(reconfirm_response),
155 .send = send_generic,
156 .resume = resume_send_generic,
157 .section_offset = PROCESS_CONF_OFFSET(do_not_respond),
167 #ifdef WITH_IFINDEX_NAME_RESOLUTION
168 char if_name[IFNAMSIZ];
175 #ifdef WITH_IFINDEX_NAME_RESOLUTION
179 received ?
"Received" :
"Sending",
182 packet->
socket.inet.src_ipaddr.
af == AF_INET6 ?
"[" :
"",
184 packet->
socket.inet.src_ipaddr.
af == AF_INET6 ?
"]" :
"",
185 packet->
socket.inet.src_port,
186 packet->
socket.inet.dst_ipaddr.
af == AF_INET6 ?
"[" :
"",
188 packet->
socket.inet.dst_ipaddr.
af == AF_INET6 ?
"]" :
"",
189 packet->
socket.inet.dst_port
190 #ifdef WITH_IFINDEX_NAME_RESOLUTION
191 , packet->
socket.inet.ifindex ?
"via " :
"",
192 packet->
socket.inet.ifindex ? fr_ifname_from_ifindex(if_name, packet->
socket.inet.ifindex) :
"",
193 packet->
socket.inet.ifindex ?
" " :
""
197 if (received || request->parent) {
206 fr_process_state_t
const *state;
213 request->component =
"vmps";
214 request->module = NULL;
217 UPDATE_STATE(packet);
220 REDEBUG(
"Invalid packet type (%u)", request->packet->code);
226 return state->recv(p_result, mctx, request);
233 .offset = PROCESS_CONF_OFFSET(join_request),
238 .offset = PROCESS_CONF_OFFSET(join_response),
243 .offset = PROCESS_CONF_OFFSET(reconfirm_request),
248 .offset = PROCESS_CONF_OFFSET(reconfirm_response),
253 .offset = PROCESS_CONF_OFFSET(do_not_respond),
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
A section grouping multiple CONF_PAIR.
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
Specifies an attribute which must be present for the module to function.
Specifies a dictionary which must be loaded/loadable for the module to function.
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
fr_dict_attr_t const * attr_packet_type
void log_request_proto_pair_list(fr_log_lvl_t lvl, request_t *request, fr_pair_t const *parent, fr_pair_list_t const *vps, char const *prefix)
Print a list of protocol fr_pair_ts.
void log_request(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request, char const *file, int line, char const *fmt,...)
Marshal variadic log arguments into a va_list and pass to normal logging functions.
void log_request_pair_list(fr_log_lvl_t lvl, request_t *request, fr_pair_t const *parent, fr_pair_list_t const *vps, char const *prefix)
Print a fr_pair_list_t.
@ L_DBG_LVL_1
Highest priority debug messages (-x).
@ L_DBG
Only displayed when debugging is enabled.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
unlang_mod_actions_t const mod_actions_authorize
unlang_mod_actions_t const mod_actions_postauth
module_instance_t const * mi
Instance of the module being instantiated.
Temporary structure to hold arguments for module calls.
CONF_SECTION * do_not_respond
CONF_SECTION * reconfirm_response
static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
fr_dict_autoload_t process_vmps_dict[]
static void vmps_packet_debug(request_t *request, fr_packet_t const *packet, fr_pair_list_t const *list, bool received)
process_vmps_sections_t sections
fr_process_module_t process_vmps
static const virtual_server_compile_t compile_list[]
fr_dict_attr_autoload_t process_vmps_dict_attr[]
CONF_SECTION * reconfirm_request
static fr_process_state_t const process_state[]
CONF_SECTION * join_request
CONF_SECTION * join_response
#define PROCESS_PACKET_CODE_VALID
static fr_dict_t const * dict_vmps
#define PROCESS_TRACE
Trace each state function as it's entered.
module_t common
Common fields for all loadable modules.
Common public symbol definition for all process modules.
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_INVALID
The module considers the request invalid.
@ RLM_MODULE_OK
The module is OK, continue.
@ RLM_MODULE_FAIL
Module failed, don't reply.
@ RLM_MODULE_DISALLOW
Reject the request (user is locked out).
@ RLM_MODULE_REJECT
Immediately reject the request.
@ RLM_MODULE_NOTFOUND
User not found.
@ RLM_MODULE_UPDATED
OK (pairs modified).
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
void * data
Module's instance data.
#define talloc_get_type_abort_const
unsigned int code
Packet code (type).
fr_socket_t socket
This packet was received on.
int id
Packet ID (used to link requests/responses).
int af
AF_INET, AF_INET6, or AF_UNIX.
#define fr_box_ipaddr(_val)
#define COMPILE_TERMINATOR
section_name_t const * section
Identifier for the section.
Processing sections which are allowed in this virtual server.
char const * fr_vmps_packet_names[FR_VMPS_CODE_MAX]