size_t talloc_pool_size; //!< Size of pool to allocate to hold each #REQUEST.
- uint8_t state_server_id; //!< Sets a specific byte in the state to allow the
- //!< authenticating server to be identified in packet
- //!< captures.
-
bool write_pid; //!< write the PID file
#ifdef HAVE_SETUID
typedef struct fr_state_tree_t fr_state_tree_t;
-fr_state_tree_t *fr_state_tree_init(TALLOC_CTX *ctx, fr_dict_attr_t const *da, uint32_t max_sessions, uint32_t timeout);
+fr_state_tree_t *fr_state_tree_init(TALLOC_CTX *ctx, fr_dict_attr_t const *da,
+ uint32_t max_sessions, uint32_t timeout, uint8_t server_id);
void fr_state_discard(fr_state_tree_t *state, REQUEST *request);
#ifdef ENABLE_OPENSSL_VERSION_CHECK
{ FR_CONF_POINTER("allow_vulnerable_openssl", FR_TYPE_STRING, &main_config.allow_vulnerable_openssl), .dflt = "no" },
#endif
- { FR_CONF_POINTER("server_id", FR_TYPE_UINT8, &main_config.state_server_id) },
CONF_PARSER_TERMINATOR
};
uint32_t timeout; //!< How long to wait before cleaning up state entires.
pthread_mutex_t mutex; //!< Synchronisation mutex.
+ uint8_t server_id; //!< ID to use for load balancing.
+
fr_dict_attr_t const *da; //!< State attribute used.
};
* @param[in] da Attribute used to store and retrieve state from.
* @param[in] max_sessions we track state for.
* @param[in] timeout How long to wait before cleaning up entries.
+ * @param[in] server_id ID byte to use in load-balancing operations.
* @return
* - A new state tree.
* - NULL on failure.
*/
fr_state_tree_t *fr_state_tree_init(TALLOC_CTX *ctx, fr_dict_attr_t const *da,
- uint32_t max_sessions, uint32_t timeout)
+ uint32_t max_sessions, uint32_t timeout, uint8_t server_id)
{
fr_state_tree_t *state;
talloc_set_destructor(state, _state_tree_free);
state->da = da; /* Remember which attribute we use to load/store state */
+ state->tree = server_id;
return state;
}
* Allow a portion of the State attribute to be set,
* this is useful for debugging purposes.
*/
- entry->state_comp.server_id = main_config.state_server_id;
+ entry->state_comp.server_id = state->server_id;
vp = fr_pair_afrom_da(packet, state->da);
fr_pair_value_memcpy(vp, entry->state, sizeof(entry->state));
if (modules_thread_instantiate(thread_ctx, main_config.config, el) < 0) goto exit_failure;
if (xlat_thread_instantiate(thread_ctx) < 0) goto exit_failure;
- state = fr_state_tree_init(autofree, attr_state, 256, 10);
+ state = fr_state_tree_init(autofree, attr_state, 256, 10, 0);
/*
* Set the panic action (if required)
uint32_t session_timeout; //!< Maximum time between the last response and next request.
uint32_t max_session; //!< Maximum ongoing session allowed.
+ uint8_t state_server_id; //!< Sets a specific byte in the state to allow the
+ //!< authenticating server to be identified in packet
+ //!< captures.
+
fr_state_tree_t *state_tree; //!< State tree to link multiple requests/responses.
} proto_radius_auth_t;
static const CONF_PARSER session_config[] = {
{ FR_CONF_OFFSET("timeout", FR_TYPE_UINT32, proto_radius_auth_t, session_timeout), .dflt = "15" },
{ FR_CONF_OFFSET("max", FR_TYPE_UINT32, proto_radius_auth_t, max_session), .dflt = "4096" },
+ { FR_CONF_OFFSET("state_server_id", FR_TYPE_UINT8, proto_radius_auth_t, state_server_id) },
CONF_PARSER_TERMINATOR
};
}
}
- inst->state_tree = fr_state_tree_init(inst, attr_state, inst->max_session, inst->session_timeout);
+ inst->state_tree = fr_state_tree_init(inst, attr_state, inst->max_session,
+ inst->session_timeout, inst->state_server_id);
return 0;
}