31RCSID(
"$Id: 170ddc549833688b444471d7b2a59fb562eb7bfd $")
33#include <freeradius-devel/server/base.h>
34#include <freeradius-devel/server/module_rlm.h>
35#include <freeradius-devel/server/virtual_servers.h>
36#include <freeradius-devel/unlang/module.h>
37#include <freeradius-devel/unlang/call.h>
38#include <freeradius-devel/protocol/eap/psk/freeradius.h>
51 .process_module_name =
"eap_psk",
81#define EAP_PSK_MPPE_KEY_LEN 32
94 switch (request->reply->code) {
95 case FR_PACKET_TYPE_VALUE_SUCCESS:
119 case FR_PACKET_TYPE_VALUE_DO_NOT_RESPOND:
122 case FR_PACKET_TYPE_VALUE_FAILURE:
139 if (!eap_session->
opaque) {
140 request->packet->code = FR_PACKET_TYPE_VALUE_IDENTITY_REQUEST;
151 REDEBUG(
"Invalid EAP-PSK response");
156 switch (session->
state) {
158 request->packet->code = FR_PACKET_TYPE_VALUE_IDENTITY_RESPONSE;
162 request->packet->code = FR_PACKET_TYPE_VALUE_RESULT_ACKNOWLEDGEMENT;
166 REDEBUG(
"Unexpected EAP-PSK session state");
193 return eap_session->
process(p_result, mctx, request);
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
@ UNLANG_ACTION_PUSHED_CHILD
unlang_t pushed a new child onto the stack, execute it instead of continuing.
unlang_action_t unlang_call_push(unlang_result_t *p_result, request_t *request, CONF_SECTION *server_cs, bool top_frame)
Push a virtual server CONF_SECTION as a call frame onto the stack.
#define CONF_PARSER_TERMINATOR
cf_parse_t func
Override default parsing behaviour for the specified type with a custom parsing function.
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
#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
Defines a CONF_PAIR to C data type mapping.
eap_packet_t * response
Packet we received from the peer.
Constants, session state, and crypto declarations for EAP-PSK (RFC 4764)
@ EAP_PSK_STATE_RESULT_INDICATION_SENT
@ EAP_PSK_STATE_IDENTITY_REQUEST_SENT
uint8_t msk[EAP_PSK_MSK_LEN]
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.
#define DICT_AUTOLOAD_TERMINATOR
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.
void unlang_interpet_frame_discard(request_t *request)
Discard the bottom most frame on the request's stack.
void eap_add_reply(request_t *request, fr_dict_attr_t const *da, uint8_t const *value, int len)
static eap_session_t * eap_session_get(request_t *request)
void * opaque
Opaque data used by EAP methods.
module_method_t process
Callback that should be used to process the next round.
eap_round_t * this_round
The EAP response we're processing, and the EAP request we're building.
Tracks the progress of a single session of any EAP method.
@ FR_TYPE_OCTETS
Raw octets.
module_instance_t const * mi
Instance of the module being instantiated.
Temporary structure to hold arguments for module calls.
static const conf_parser_t config[]
#define RETURN_UNLANG_HANDLED
#define RETURN_UNLANG_INVALID
#define RETURN_UNLANG_FAIL
#define RETURN_UNLANG_REJECT
fr_dict_autoload_t rlm_eap_psk_dict[]
static unlang_action_t mod_encode(unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
Translate the state machine's reply Packet-Type into an EAP result.
virtual_server_t * virtual_server
eap-psk virtual server providing the policy sections for the exchange.
static unlang_action_t mod_process(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
Derive the next Packet-Type from the session state, and enter the virtual server.
static fr_dict_t const * dict_radius
static fr_dict_t const * dict_eap_psk
#define EAP_PSK_MPPE_KEY_LEN
static fr_dict_attr_t const * attr_ms_mppe_send_key
fr_dict_attr_autoload_t rlm_eap_psk_dict_attr[]
rlm_eap_submodule_t rlm_eap_psk
static fr_dict_attr_t const * attr_ms_mppe_recv_key
static conf_parser_t submodule_config[]
static unlang_action_t mod_session_init(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
size_t inst_size
Size of the module's instance data.
void * data
Module's instance data.
unlang_action_t unlang_module_yield(request_t *request, module_method_t resume, unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx)
Yield a request back to the interpreter from within a module.
eap_aka_sim_process_conf_t * inst
module_t common
Common fields provided by all modules.
Interface exported by EAP submodules.
int virtual_server_cf_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
Wrapper for the config parser to allow pass1 resolution of virtual servers.
CONF_SECTION * virtual_server_cs(virtual_server_t const *vs)
Return the configuration section for a virtual server.
Additional validation rules for virtual server lookup.