Lines Matching full:data
55 * struct radius_session - Internal RADIUS server data for a session
76 * struct radius_client - Internal RADIUS server data for a client
93 * struct radius_server_data - Internal RADIUS server data
143 * PAC-Opaque data. It can be set to %NULL if EAP-FAST is not used. If
230 * context data. Normally, this can be set to %NULL.
253 * @ctx: Context data from conf_ctx
257 * @user: Data structure for filling in the user information
263 * password data and RADIUS server will free it after use.
269 * eap_req_id_text - Optional data for EAP-Request/Identity
286 * msg_ctx - Context data for wpa_msg() calls
314 radius_server_get_client(struct radius_server_data *data, struct in_addr *addr,
317 struct radius_client *client = data->clients;
368 static void radius_server_session_free(struct radius_server_data *data,
371 eloop_cancel_timeout(radius_server_session_timeout, data, sess);
372 eloop_cancel_timeout(radius_server_session_remove_timeout, data, sess);
378 data->num_sess--;
382 static void radius_server_session_remove(struct radius_server_data *data,
388 eloop_cancel_timeout(radius_server_session_remove_timeout, data, sess);
399 radius_server_session_free(data, sess);
411 struct radius_server_data *data = eloop_ctx;
414 radius_server_session_remove(data, sess);
420 struct radius_server_data *data = eloop_ctx;
424 radius_server_session_remove(data, sess);
429 radius_server_new_session(struct radius_server_data *data,
434 if (data->num_sess >= RADIUS_MAX_SESSION) {
444 sess->server = data;
446 sess->sess_id = data->next_sess_id++;
450 radius_server_session_timeout, data, sess);
451 data->num_sess++;
457 radius_server_get_new_session(struct radius_server_data *data,
482 res = data->get_eap_user(data->conf_ctx, user, user_len, 0, NULL);
487 sess = radius_server_new_session(data, client);
498 eap_conf.ssl_ctx = data->ssl_ctx;
499 eap_conf.msg_ctx = data->msg_ctx;
500 eap_conf.eap_sim_db_priv = data->eap_sim_db_priv;
503 eap_conf.pac_opaque_encr_key = data->pac_opaque_encr_key;
504 eap_conf.eap_fast_a_id = data->eap_fast_a_id;
505 eap_conf.eap_fast_a_id_len = data->eap_fast_a_id_len;
506 eap_conf.eap_fast_a_id_info = data->eap_fast_a_id_info;
507 eap_conf.eap_fast_prov = data->eap_fast_prov;
508 eap_conf.pac_key_lifetime = data->pac_key_lifetime;
509 eap_conf.pac_key_refresh_time = data->pac_key_refresh_time;
510 eap_conf.eap_sim_aka_result_ind = data->eap_sim_aka_result_ind;
511 eap_conf.tnc = data->tnc;
512 eap_conf.wps = data->wps;
513 eap_conf.pwd_group = data->pwd_group;
519 radius_server_session_free(data, sess);
533 radius_server_encapsulate_eap(struct radius_server_data *data,
576 if (data->dump_msk_file) {
579 f = fopen(data->dump_msk_file, "a");
624 static int radius_server_reject(struct radius_server_data *data,
670 data->counters.access_rejects++;
673 if (sendto(data->auth_sock, wpabuf_head(buf), wpabuf_len(buf), 0,
685 static int radius_server_request(struct radius_server_data *data,
718 radius_server_reject(data, client, msg, from, fromlen,
722 sess = radius_server_get_new_session(data, client, msg);
725 radius_server_reject(data, client, msg, from, fromlen,
736 data->counters.dup_access_requests++;
742 res = sendto(data->auth_sock, wpabuf_head(buf),
760 data->counters.packets_dropped++;
765 RADIUS_DUMP("Received EAP data", wpabuf_head(eap), wpabuf_len(eap));
781 RADIUS_DUMP("EAP data from the state machine",
785 RADIUS_DEBUG("No EAP data from the state machine, but eapFail "
797 RADIUS_DEBUG("No EAP data from the state machine - ignore this"
800 data->counters.packets_dropped++;
808 reply = radius_server_encapsulate_eap(data, client, sess, msg);
821 data->counters.access_accepts++;
825 data->counters.access_rejects++;
829 data->counters.access_challenges++;
834 res = sendto(data->auth_sock, wpabuf_head(buf),
847 data->counters.packets_dropped++;
855 data, sess);
858 data, sess);
868 struct radius_server_data *data = eloop_ctx;
898 if (data->ipv6) {
906 client = radius_server_get_client(data,
912 if (!data->ipv6) {
918 client = radius_server_get_client(data, &from.sin.sin_addr, 0);
921 RADIUS_DUMP("Received data", buf, len);
925 data->counters.invalid_requests++;
932 data->counters.malformed_access_requests++;
947 data->counters.unknown_types++;
952 data->counters.access_requests++;
958 data->counters.bad_authenticators++;
963 if (radius_server_request(data, msg, (struct sockaddr *) &from,
1043 static void radius_server_free_sessions(struct radius_server_data *data,
1052 radius_server_session_free(data, prev);
1057 static void radius_server_free_clients(struct radius_server_data *data,
1067 radius_server_free_sessions(data, prev->sessions);
1240 struct radius_server_data *data;
1250 data = os_zalloc(sizeof(*data));
1251 if (data == NULL)
1254 os_get_time(&data->start_time);
1255 data->conf_ctx = conf->conf_ctx;
1256 data->eap_sim_db_priv = conf->eap_sim_db_priv;
1257 data->ssl_ctx = conf->ssl_ctx;
1258 data->msg_ctx = conf->msg_ctx;
1259 data->ipv6 = conf->ipv6;
1261 data->pac_opaque_encr_key = os_malloc(16);
1262 os_memcpy(data->pac_opaque_encr_key, conf->pac_opaque_encr_key,
1266 data->eap_fast_a_id = os_malloc(conf->eap_fast_a_id_len);
1267 if (data->eap_fast_a_id) {
1268 os_memcpy(data->eap_fast_a_id, conf->eap_fast_a_id,
1270 data->eap_fast_a_id_len = conf->eap_fast_a_id_len;
1274 data->eap_fast_a_id_info = os_strdup(conf->eap_fast_a_id_info);
1275 data->eap_fast_prov = conf->eap_fast_prov;
1276 data->pac_key_lifetime = conf->pac_key_lifetime;
1277 data->pac_key_refresh_time = conf->pac_key_refresh_time;
1278 data->get_eap_user = conf->get_eap_user;
1279 data->eap_sim_aka_result_ind = conf->eap_sim_aka_result_ind;
1280 data->tnc = conf->tnc;
1281 data->wps = conf->wps;
1282 data->pwd_group = conf->pwd_group;
1284 data->eap_req_id_text = os_malloc(conf->eap_req_id_text_len);
1285 if (data->eap_req_id_text) {
1286 os_memcpy(data->eap_req_id_text, conf->eap_req_id_text,
1288 data->eap_req_id_text_len = conf->eap_req_id_text_len;
1294 data
1297 data->clients = radius_server_read_clients(conf->client_file,
1299 if (data->clients == NULL) {
1301 radius_server_deinit(data);
1307 data->auth_sock = radius_server_open_socket6(conf->auth_port);
1310 data->auth_sock = radius_server_open_socket(conf->auth_port);
1311 if (data->auth_sock < 0) {
1314 radius_server_deinit(data);
1317 if (eloop_register_read_sock(data->auth_sock,
1319 data, NULL)) {
1320 radius_server_deinit(data);
1324 return data;
1330 * @data: RADIUS server context from radius_server_init()
1332 void radius_server_deinit(struct radius_server_data *data)
1334 if (data == NULL)
1337 if (data->auth_sock >= 0) {
1338 eloop_unregister_read_sock(data->auth_sock);
1339 close(data->auth_sock);
1342 radius_server_free_clients(data, data->clients);
1344 os_free(data->pac_opaque_encr_key);
1345 os_free(data->eap_fast_a_id);
1346 os_free(data->eap_fast_a_id_info);
1347 os_free(data->eap_req_id_text);
1349 os_free(data->dump_msk_file);
1351 os_free(data);
1357 * @data: RADIUS server context from radius_server_init()
1358 * @buf: Buffer for returning the MIB data in text format
1362 int radius_server_get_mib(struct radius_server_data *data, char *buf,
1373 if (data == NULL || buflen == 0)
1380 uptime = (now.sec - data->start_time.sec) * 100 +
1381 ((now.usec - data->start_time.usec) / 10000) % 100;
1406 data->counters.access_requests,
1407 data->counters.invalid_requests,
1408 data->counters.dup_access_requests,
1409 data->counters.access_accepts,
1410 data->counters.access_rejects,
1411 data->counters.access_challenges,
1412 data->counters.malformed_access_requests,
1413 data->counters.bad_authenticators,
1414 data->counters.packets_dropped,
1415 data->counters.unknown_types);
1422 for (cli = data->clients, idx = 0; cli; cli = cli->next, idx++) {
1425 if (data->ipv6) {
1434 if (!data->ipv6) {
1478 struct radius_server_data *data = sess->server;
1480 return data->get_eap_user(data->conf_ctx, identity, identity_len,
1488 struct radius_server_data *data = sess->server;
1489 *len = data->eap_req_id_text_len;
1490 return data->eap_req_id_text;
1502 * radius_server_eap_pending_cb - Pending EAP data notification
1503 * @data: RADIUS server context from radius_server_init()
1509 void radius_server_eap_pending_cb(struct radius_server_data *data, void *ctx)
1515 if (data == NULL)
1518 for (cli = data->clients; cli; cli = cli->next) {
1539 if (radius_server_request(data, msg,