24 #include <freeradius-devel/server/protocol.h>
25 #include <freeradius-devel/util/debug.h>
26 #include <freeradius-devel/bfd/bfd.h>
52 CONF_SECTION *recv_ ## _x; \
53 CONF_SECTION *send_ ## _x
70 #define PROCESS_PACKET_TYPE fr_bfd_packet_code_t
71 #define PROCESS_CODE_MAX FR_BFD_CODE_MAX
72 #define PROCESS_PACKET_CODE_VALID FR_BFD_PACKET_CODE_VALID
73 #define PROCESS_INST process_bfd_t
75 #define PROCESS_SEND_RECV (1)
77 #include <freeradius-devel/server/process.h>
84 #ifdef WITH_IFINDEX_NAME_RESOLUTION
85 char if_name[IFNAMSIZ];
92 #ifdef WITH_IFINDEX_NAME_RESOLUTION
96 received ?
"Received" :
"Sending",
99 packet->
socket.inet.src_ipaddr.
af == AF_INET6 ?
"[" :
"",
101 packet->
socket.inet.src_ipaddr.
af == AF_INET6 ?
"]" :
"",
102 packet->
socket.inet.src_port,
103 packet->
socket.inet.dst_ipaddr.
af == AF_INET6 ?
"[" :
"",
105 packet->
socket.inet.dst_ipaddr.
af == AF_INET6 ?
"]" :
"",
106 packet->
socket.inet.dst_port
107 #ifdef WITH_IFINDEX_NAME_RESOLUTION
108 , packet->
socket.inet.ifindex ?
"via " :
"",
109 packet->
socket.inet.ifindex ? fr_ifname_from_ifindex(if_name, packet->
socket.inet.ifindex) :
"",
110 packet->
socket.inet.ifindex ?
" " :
""
114 if (received || request->parent) {
139 state =
vp->vp_uint32;
143 if (
vp) state =
vp->vp_uint8;
149 request->reply->code = state;
151 request->reply->timestamp =
fr_time();
164 .recv = recv_generic,
165 .resume = resume_recv_bfd,
172 .recv = recv_generic,
173 .resume = resume_recv_bfd,
180 .recv = recv_generic,
181 .resume = resume_recv_bfd,
188 .recv = recv_generic,
189 .resume = resume_recv_bfd,
200 .send = send_generic,
201 .resume = resume_send_generic,
207 .send = send_generic,
208 .resume = resume_send_generic,
214 .send = send_generic,
215 .resume = resume_send_generic,
221 .send = send_generic,
222 .resume = resume_send_generic,
229 fr_process_state_t
const *state;
237 request->component =
"bfd";
238 request->module = NULL;
253 return state->send(p_result, mctx, request);
258 UPDATE_STATE(packet);
261 REDEBUG(
"Invalid packet type (%u)", request->packet->code);
267 return state->recv(p_result, mctx, request);
273 #define SEND_RECV(_x, _y) \
275 .section = SECTION_NAME("recv", _x), \
276 .actions = &mod_actions_postauth, \
277 .offset = PROCESS_CONF_OFFSET(recv_ ## _y), \
280 .section = SECTION_NAME("send", _x), \
281 .actions = &mod_actions_postauth, \
282 .offset = PROCESS_CONF_OFFSET(send_ ## _y), \
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
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.
@ BFD_WRAPPER_SEND_PACKET
@ BFD_WRAPPER_RECV_PACKET
@ FR_TYPE_UINT8
8 Bit unsigned integer.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_STRUCT
like TLV, but without T or L, and fixed-width children
module_instance_t const * mi
Instance of the module being instantiated.
Temporary structure to hold arguments for module calls.
fr_pair_t * fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find the first pair with a matching da.
fr_pair_t * fr_pair_find_by_da_nested(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find a pair with a matching fr_dict_attr_t, by walking the nested fr_dict_attr_t tree.
fr_dict_autoload_t process_bfd_dict[]
static fr_dict_attr_t const * attr_bfd_packet
static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
process_bfd_sections_t sections
fr_process_module_t process_bfd
static const virtual_server_compile_t compile_list[]
static void bfd_packet_debug(request_t *request, fr_packet_t *packet, fr_pair_list_t *list, bool received)
static fr_dict_attr_t const * attr_bfd_state
static fr_process_state_t const process_state_reply[]
fr_dict_attr_autoload_t process_bfd_dict_attr[]
static fr_dict_t const * dict_bfd
#define SEND_RECV(_x, _y)
#define PROCESS_PACKET_CODE_VALID
static fr_process_state_t const process_state_packet[]
#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.
char const * fr_bfd_packet_names[FR_BFD_CODE_MAX]
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_FAIL
Module failed, don't reply.
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
@ RLM_MODULE_NUMCODES
How many valid return codes there are.
void * data
Module's instance data.
init
Enter the EAP-IDENTITY state.
#define fr_time()
Allow us to arbitrarily manipulate time.
Stores an attribute, a value and various bits of other 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
Processing sections which are allowed in this virtual server.