• Home
  • Raw
  • Download

Lines Matching full:radius

2  * RADIUS client
12 #include "radius.h"
16 /* Defaults for RADIUS retransmit values (exponential backoff) */
19 * RADIUS_CLIENT_FIRST_WAIT - RADIUS client timeout for first retry in seconds
24 * RADIUS_CLIENT_MAX_WAIT - RADIUS client maximum retry timeout in seconds
29 * RADIUS_CLIENT_MAX_FAILOVER - RADIUS client maximum retries
37 * RADIUS_CLIENT_MAX_ENTRIES - RADIUS client maximum pending messages
45 * RADIUS_CLIENT_NUM_FAILOVER - RADIUS client failover point
47 * The number of failed retry attempts after which the RADIUS server will be
54 * struct radius_rx_handler - RADIUS client RX handler
56 * This data structure is used internally inside the RADIUS client module to
58 * radius_client_register() and unregistered when the RADIUS client is
63 * handler - Received RADIUS message handler
79 * struct radius_msg_list - RADIUS client message retransmit list
81 * This data structure is used internally inside the RADIUS client module to
82 * store pending RADIUS requests that may still need to be retransmitted.
88 * This is used to find RADIUS messages for the same STA.
93 * msg - RADIUS message
133 * shared_secret - Shared secret with the target RADIUS server
152 * struct radius_client_data - Internal RADIUS client data
154 * This data structure is used internally inside the RADIUS client module.
157 * calls to other functions as an identifier for the RADIUS client instance.
166 * conf - RADIUS client configuration (list of RADIUS servers to use)
171 * auth_serv_sock - IPv4 socket for RADIUS authentication messages
176 * acct_serv_sock - IPv4 socket for RADIUS accounting messages
181 * auth_serv_sock6 - IPv6 socket for RADIUS authentication messages
186 * acct_serv_sock6 - IPv6 socket for RADIUS accounting messages
191 * auth_sock - Currently used socket for RADIUS authentication server
196 * acct_sock - Currently used socket for RADIUS accounting server
221 * msgs - Pending outgoing RADIUS messages
231 * next_radius_identifier - Next RADIUS message identifier to use
248 radius_change_server(struct radius_client_data *radius,
252 static int radius_client_init_acct(struct radius_client_data *radius);
253 static int radius_client_init_auth(struct radius_client_data *radius);
254 static void radius_client_auth_failover(struct radius_client_data *radius);
255 static void radius_client_acct_failover(struct radius_client_data *radius);
266 * radius_client_register - Register a RADIUS client RX handler
267 * @radius: RADIUS client context from radius_client_init()
268 * @msg_type: RADIUS client type (RADIUS_AUTH or RADIUS_ACCT)
269 * @handler: Handler for received RADIUS messages
273 * This function is used to register a handler for processing received RADIUS
275 * be called whenever a RADIUS message is received from the active server.
277 * There can be multiple registered RADIUS message handlers. The handlers will
281 int radius_client_register(struct radius_client_data *radius, in radius_client_register() argument
294 handlers = &radius->acct_handlers; in radius_client_register()
295 num = &radius->num_acct_handlers; in radius_client_register()
297 handlers = &radius->auth_handlers; in radius_client_register()
298 num = &radius->num_auth_handlers; in radius_client_register()
317 * @radius: RADIUS client context from radius_client_init()
325 void radius_client_set_interim_error_cb(struct radius_client_data *radius, in radius_client_set_interim_error_cb() argument
329 radius->interim_error_cb = cb; in radius_client_set_interim_error_cb()
330 radius->interim_error_cb_ctx = ctx; in radius_client_set_interim_error_cb()
338 static int radius_client_handle_send_error(struct radius_client_data *radius, in radius_client_handle_send_error() argument
343 wpa_printf(MSG_INFO, "send[RADIUS,s=%d]: %s", s, strerror(errno)); in radius_client_handle_send_error()
346 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_client_handle_send_error()
352 radius_client_init_acct(radius); in radius_client_handle_send_error()
355 radius_client_init_auth(radius); in radius_client_handle_send_error()
365 static int radius_client_retransmit(struct radius_client_data *radius, in radius_client_retransmit() argument
369 struct hostapd_radius_servers *conf = radius->conf; in radius_client_retransmit()
380 if (radius->acct_sock < 0) in radius_client_retransmit()
381 radius_client_init_acct(radius); in radius_client_retransmit()
382 if (radius->acct_sock < 0 && conf->num_acct_servers > 1) { in radius_client_retransmit()
383 prev_num_msgs = radius->num_msgs; in radius_client_retransmit()
384 radius_client_acct_failover(radius); in radius_client_retransmit()
385 if (prev_num_msgs != radius->num_msgs) in radius_client_retransmit()
388 s = radius->acct_sock; in radius_client_retransmit()
397 if (radius->auth_sock < 0) in radius_client_retransmit()
398 radius_client_init_auth(radius); in radius_client_retransmit()
399 if (radius->auth_sock < 0 && conf->num_auth_servers > 1) { in radius_client_retransmit()
400 prev_num_msgs = radius->num_msgs; in radius_client_retransmit()
401 radius_client_auth_failover(radius); in radius_client_retransmit()
402 if (prev_num_msgs != radius->num_msgs) in radius_client_retransmit()
405 s = radius->auth_sock; in radius_client_retransmit()
416 "RADIUS: Failed to transmit interim accounting update to " in radius_client_retransmit()
419 if (radius->interim_error_cb) in radius_client_retransmit()
420 radius->interim_error_cb(entry->addr, in radius_client_retransmit()
421 radius->interim_error_cb_ctx); in radius_client_retransmit()
427 "RADIUS: No valid socket for retransmission"); in radius_client_retransmit()
444 hdr->identifier = radius_client_get_id(radius); in radius_client_retransmit()
451 "RADIUS: Updated Acct-Delay-Time to %u for retransmission", in radius_client_retransmit()
455 if (radius->conf->msg_dumps) in radius_client_retransmit()
463 "RADIUS: Removing un-ACKed message due to too many failed retransmit attempts"); in radius_client_retransmit()
469 hostapd_logger(radius->ctx, entry->addr, HOSTAPD_MODULE_RADIUS, in radius_client_retransmit()
470 HOSTAPD_LEVEL_DEBUG, "Resending RADIUS message (id=%d)", in radius_client_retransmit()
476 if (radius_client_handle_send_error(radius, s, entry->msg_type) in radius_client_retransmit()
492 struct radius_client_data *radius = eloop_ctx; in radius_client_timer() local
500 entry = radius->msgs; in radius_client_timer()
508 s = entry->msg_type == RADIUS_AUTH ? radius->auth_sock : in radius_client_timer()
509 radius->acct_sock; in radius_client_timer()
523 radius_client_auth_failover(radius); in radius_client_timer()
526 radius_client_acct_failover(radius); in radius_client_timer()
528 entry = radius->msgs; in radius_client_timer()
533 prev_num_msgs = radius->num_msgs; in radius_client_timer()
535 radius_client_retransmit(radius, entry, now.sec)) { in radius_client_timer()
539 radius->msgs = entry->next; in radius_client_timer()
544 radius->num_msgs--; in radius_client_timer()
548 if (prev_num_msgs != radius->num_msgs) { in radius_client_timer()
550 "RADIUS: Message removed from queue - restart from beginning"); in radius_client_timer()
551 entry = radius->msgs; in radius_client_timer()
563 if (radius->msgs) { in radius_client_timer()
566 eloop_cancel_timeout(radius_client_timer, radius, NULL); in radius_client_timer()
568 radius_client_timer, radius, NULL); in radius_client_timer()
569 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_client_timer()
570 HOSTAPD_LEVEL_DEBUG, "Next RADIUS client " in radius_client_timer()
577 static void radius_client_auth_failover(struct radius_client_data *radius) in radius_client_auth_failover() argument
579 struct hostapd_radius_servers *conf = radius->conf; in radius_client_auth_failover()
585 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_client_auth_failover()
591 for (entry = radius->msgs; entry; entry = entry->next) { in radius_client_auth_failover()
600 radius_change_server(radius, next, old, in radius_client_auth_failover()
601 radius->auth_serv_sock, in radius_client_auth_failover()
602 radius->auth_serv_sock6, 1); in radius_client_auth_failover()
606 static void radius_client_acct_failover(struct radius_client_data *radius) in radius_client_acct_failover() argument
608 struct hostapd_radius_servers *conf = radius->conf; in radius_client_acct_failover()
614 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_client_acct_failover()
620 for (entry = radius->msgs; entry; entry = entry->next) { in radius_client_acct_failover()
630 radius_change_server(radius, next, old, in radius_client_acct_failover()
631 radius->acct_serv_sock, in radius_client_acct_failover()
632 radius->acct_serv_sock6, 0); in radius_client_acct_failover()
636 static void radius_client_update_timeout(struct radius_client_data *radius) in radius_client_update_timeout() argument
642 eloop_cancel_timeout(radius_client_timer, radius, NULL); in radius_client_update_timeout()
644 if (radius->msgs == NULL) { in radius_client_update_timeout()
649 for (entry = radius->msgs; entry; entry = entry->next) { in radius_client_update_timeout()
657 eloop_register_timeout(first - now.sec, 0, radius_client_timer, radius, in radius_client_update_timeout()
659 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_client_update_timeout()
660 HOSTAPD_LEVEL_DEBUG, "Next RADIUS client retransmit in" in radius_client_update_timeout()
665 static void radius_client_list_add(struct radius_client_data *radius, in radius_client_list_add() argument
682 wpa_printf(MSG_INFO, "RADIUS: Failed to add packet into retransmit list"); in radius_client_list_add()
701 entry->next = radius->msgs; in radius_client_list_add()
702 radius->msgs = entry; in radius_client_list_add()
703 radius_client_update_timeout(radius); in radius_client_list_add()
705 if (radius->num_msgs >= RADIUS_CLIENT_MAX_ENTRIES) { in radius_client_list_add()
706 wpa_printf(MSG_INFO, "RADIUS: Removing the oldest un-ACKed packet due to retransmit list limits"); in radius_client_list_add()
717 radius->num_msgs++; in radius_client_list_add()
722 * radius_client_send - Send a RADIUS request
723 * @radius: RADIUS client context from radius_client_init()
724 * @msg: RADIUS message to be sent
729 * This function is used to transmit a RADIUS authentication (RADIUS_AUTH) or
746 int radius_client_send(struct radius_client_data *radius, in radius_client_send() argument
750 struct hostapd_radius_servers *conf = radius->conf; in radius_client_send()
758 if (conf->acct_server && radius->acct_sock < 0) in radius_client_send()
759 radius_client_init_acct(radius); in radius_client_send()
761 if (conf->acct_server == NULL || radius->acct_sock < 0 || in radius_client_send()
763 hostapd_logger(radius->ctx, NULL, in radius_client_send()
773 s = radius->acct_sock; in radius_client_send()
776 if (conf->auth_server && radius->auth_sock < 0) in radius_client_send()
777 radius_client_init_auth(radius); in radius_client_send()
779 if (conf->auth_server == NULL || radius->auth_sock < 0 || in radius_client_send()
781 hostapd_logger(radius->ctx, NULL, in radius_client_send()
791 s = radius->auth_sock; in radius_client_send()
795 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_client_send()
796 HOSTAPD_LEVEL_DEBUG, "Sending RADIUS message to %s " in radius_client_send()
804 radius_client_handle_send_error(radius, s, msg_type); in radius_client_send()
806 radius_client_list_add(radius, msg, msg_type, shared_secret, in radius_client_send()
815 struct radius_client_data *radius = eloop_ctx; in radius_client_receive() local
816 struct hostapd_radius_servers *conf = radius->conf; in radius_client_receive()
830 handlers = radius->acct_handlers; in radius_client_receive()
831 num_handlers = radius->num_acct_handlers; in radius_client_receive()
834 handlers = radius->auth_handlers; in radius_client_receive()
835 num_handlers = radius->num_auth_handlers; in radius_client_receive()
841 wpa_printf(MSG_INFO, "recv[RADIUS]: %s", strerror(errno)); in radius_client_receive()
844 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_client_receive()
845 HOSTAPD_LEVEL_DEBUG, "Received %d bytes from RADIUS " in radius_client_receive()
848 wpa_printf(MSG_INFO, "RADIUS: Possibly too long UDP frame for our buffer - dropping it"); in radius_client_receive()
854 wpa_printf(MSG_INFO, "RADIUS: Parsing incoming frame failed"); in radius_client_receive()
860 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_client_receive()
861 HOSTAPD_LEVEL_DEBUG, "Received RADIUS message"); in radius_client_receive()
881 req = radius->msgs; in radius_client_receive()
884 * alternative RADIUS servers (?) */ in radius_client_receive()
897 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_client_receive()
899 "No matching RADIUS request found (type=%d " in radius_client_receive()
908 hostapd_logger(radius->ctx, req->addr, HOSTAPD_MODULE_RADIUS, in radius_client_receive()
910 "Received RADIUS packet matched with a pending " in radius_client_receive()
915 /* Remove ACKed RADIUS packet from retransmit list */ in radius_client_receive()
919 radius->msgs = req->next; in radius_client_receive()
920 radius->num_msgs--; in radius_client_receive()
947 hostapd_logger(radius->ctx, req->addr, HOSTAPD_MODULE_RADIUS, in radius_client_receive()
948 HOSTAPD_LEVEL_DEBUG, "No RADIUS RX handler found " in radius_client_receive()
961 * radius_client_get_id - Get an identifier for a new RADIUS message
962 * @radius: RADIUS client context from radius_client_init()
966 * for a new RADIUS message.
968 u8 radius_client_get_id(struct radius_client_data *radius) in radius_client_get_id() argument
971 u8 id = radius->next_radius_identifier++; in radius_client_get_id()
974 * using new reply from the RADIUS server with an old request */ in radius_client_get_id()
975 entry = radius->msgs; in radius_client_get_id()
979 hostapd_logger(radius->ctx, entry->addr, in radius_client_get_id()
982 "Removing pending RADIUS message, " in radius_client_get_id()
987 radius->msgs = entry->next; in radius_client_get_id()
1004 * radius_client_flush - Flush all pending RADIUS client messages
1005 * @radius: RADIUS client context from radius_client_init()
1008 void radius_client_flush(struct radius_client_data *radius, int only_auth) in radius_client_flush() argument
1012 if (!radius) in radius_client_flush()
1016 entry = radius->msgs; in radius_client_flush()
1023 radius->msgs = entry->next; in radius_client_flush()
1028 radius->num_msgs--; in radius_client_flush()
1035 if (radius->msgs == NULL) in radius_client_flush()
1036 eloop_cancel_timeout(radius_client_timer, radius, NULL); in radius_client_flush()
1040 static void radius_client_update_acct_msgs(struct radius_client_data *radius, in radius_client_update_acct_msgs() argument
1046 if (!radius) in radius_client_update_acct_msgs()
1049 for (entry = radius->msgs; entry; entry = entry->next) { in radius_client_update_acct_msgs()
1061 radius_change_server(struct radius_client_data *radius, in radius_change_server() argument
1075 struct hostapd_radius_servers *conf = radius->conf; in radius_change_server()
1080 hostapd_logger(radius->ctx, NULL, HOSTAPD_MODULE_RADIUS, in radius_change_server()
1090 radius_client_flush(radius, 1); in radius_change_server()
1097 /* Pending RADIUS packets used different shared secret, so in radius_change_server()
1100 * since they would require more changes and the new RADIUS in radius_change_server()
1105 radius_client_flush(radius, 1); in radius_change_server()
1108 radius, nserv->shared_secret, in radius_change_server()
1114 for (entry = radius->msgs; oserv && entry; entry = entry->next) { in radius_change_server()
1123 if (radius->msgs) { in radius_change_server()
1124 eloop_cancel_timeout(radius_client_timer, radius, NULL); in radius_change_server()
1126 radius_client_timer, radius, NULL); in radius_change_server()
1157 "RADIUS: No server socket available (af=%d sock=%d sock6=%d auth=%d", in radius_change_server()
1188 wpa_printf(MSG_INFO, "bind[radius]: %s", in radius_change_server()
1197 wpa_printf(MSG_INFO, "disconnect[radius]: %s", strerror(errno)); in radius_change_server()
1200 wpa_printf(MSG_INFO, "connect[radius]: %s", strerror(errno)); in radius_change_server()
1210 wpa_printf(MSG_DEBUG, "RADIUS local address: %s:%u", in radius_change_server()
1220 wpa_printf(MSG_DEBUG, "RADIUS local address: %s:%u", in radius_change_server()
1232 radius->auth_sock = sel_sock; in radius_change_server()
1234 radius->acct_sock = sel_sock; in radius_change_server()
1242 struct radius_client_data *radius = eloop_ctx; in radius_retry_primary_timer() local
1243 struct hostapd_radius_servers *conf = radius->conf; in radius_retry_primary_timer()
1246 if (radius->auth_sock >= 0 && conf->auth_servers && in radius_retry_primary_timer()
1250 if (radius_change_server(radius, conf->auth_server, oserv, in radius_retry_primary_timer()
1251 radius->auth_serv_sock, in radius_retry_primary_timer()
1252 radius->auth_serv_sock6, 1) < 0) { in radius_retry_primary_timer()
1254 radius_change_server(radius, oserv, conf->auth_server, in radius_retry_primary_timer()
1255 radius->auth_serv_sock, in radius_retry_primary_timer()
1256 radius->auth_serv_sock6, 1); in radius_retry_primary_timer()
1260 if (radius->acct_sock >= 0 && conf->acct_servers && in radius_retry_primary_timer()
1264 if (radius_change_server(radius, conf->acct_server, oserv, in radius_retry_primary_timer()
1265 radius->acct_serv_sock, in radius_retry_primary_timer()
1266 radius->acct_serv_sock6, 0) < 0) { in radius_retry_primary_timer()
1268 radius_change_server(radius, oserv, conf->acct_server, in radius_retry_primary_timer()
1269 radius->acct_serv_sock, in radius_retry_primary_timer()
1270 radius->acct_serv_sock6, 0); in radius_retry_primary_timer()
1276 radius_retry_primary_timer, radius, in radius_retry_primary_timer()
1290 wpa_printf(MSG_ERROR, "RADIUS: Failed to set IP_MTU_DISCOVER: %s", in radius_client_disable_pmtu_discovery()
1297 static void radius_close_auth_sockets(struct radius_client_data *radius) in radius_close_auth_sockets() argument
1299 radius->auth_sock = -1; in radius_close_auth_sockets()
1301 if (radius->auth_serv_sock >= 0) { in radius_close_auth_sockets()
1302 eloop_unregister_read_sock(radius->auth_serv_sock); in radius_close_auth_sockets()
1303 close(radius->auth_serv_sock); in radius_close_auth_sockets()
1304 radius->auth_serv_sock = -1; in radius_close_auth_sockets()
1307 if (radius->auth_serv_sock6 >= 0) { in radius_close_auth_sockets()
1308 eloop_unregister_read_sock(radius->auth_serv_sock6); in radius_close_auth_sockets()
1309 close(radius->auth_serv_sock6); in radius_close_auth_sockets()
1310 radius->auth_serv_sock6 = -1; in radius_close_auth_sockets()
1316 static void radius_close_acct_sockets(struct radius_client_data *radius) in radius_close_acct_sockets() argument
1318 radius->acct_sock = -1; in radius_close_acct_sockets()
1320 if (radius->acct_serv_sock >= 0) { in radius_close_acct_sockets()
1321 eloop_unregister_read_sock(radius->acct_serv_sock); in radius_close_acct_sockets()
1322 close(radius->acct_serv_sock); in radius_close_acct_sockets()
1323 radius->acct_serv_sock = -1; in radius_close_acct_sockets()
1326 if (radius->acct_serv_sock6 >= 0) { in radius_close_acct_sockets()
1327 eloop_unregister_read_sock(radius->acct_serv_sock6); in radius_close_acct_sockets()
1328 close(radius->acct_serv_sock6); in radius_close_acct_sockets()
1329 radius->acct_serv_sock6 = -1; in radius_close_acct_sockets()
1335 static int radius_client_init_auth(struct radius_client_data *radius) in radius_client_init_auth() argument
1337 struct hostapd_radius_servers *conf = radius->conf; in radius_client_init_auth()
1340 radius_close_auth_sockets(radius); in radius_client_init_auth()
1342 radius->auth_serv_sock = socket(PF_INET, SOCK_DGRAM, 0); in radius_client_init_auth()
1343 if (radius->auth_serv_sock < 0) in radius_client_init_auth()
1344 wpa_printf(MSG_INFO, "RADIUS: socket[PF_INET,SOCK_DGRAM]: %s", in radius_client_init_auth()
1347 radius_client_disable_pmtu_discovery(radius->auth_serv_sock); in radius_client_init_auth()
1352 radius->auth_serv_sock6 = socket(PF_INET6, SOCK_DGRAM, 0); in radius_client_init_auth()
1353 if (radius->auth_serv_sock6 < 0) in radius_client_init_auth()
1354 wpa_printf(MSG_INFO, "RADIUS: socket[PF_INET6,SOCK_DGRAM]: %s", in radius_client_init_auth()
1363 radius_change_server(radius, conf->auth_server, NULL, in radius_client_init_auth()
1364 radius->auth_serv_sock, radius->auth_serv_sock6, in radius_client_init_auth()
1367 if (radius->auth_serv_sock >= 0 && in radius_client_init_auth()
1368 eloop_register_read_sock(radius->auth_serv_sock, in radius_client_init_auth()
1369 radius_client_receive, radius, in radius_client_init_auth()
1371 wpa_printf(MSG_INFO, "RADIUS: Could not register read socket for authentication server"); in radius_client_init_auth()
1372 radius_close_auth_sockets(radius); in radius_client_init_auth()
1377 if (radius->auth_serv_sock6 >= 0 && in radius_client_init_auth()
1378 eloop_register_read_sock(radius->auth_serv_sock6, in radius_client_init_auth()
1379 radius_client_receive, radius, in radius_client_init_auth()
1381 wpa_printf(MSG_INFO, "RADIUS: Could not register read socket for authentication server"); in radius_client_init_auth()
1382 radius_close_auth_sockets(radius); in radius_client_init_auth()
1391 static int radius_client_init_acct(struct radius_client_data *radius) in radius_client_init_acct() argument
1393 struct hostapd_radius_servers *conf = radius->conf; in radius_client_init_acct()
1396 radius_close_acct_sockets(radius); in radius_client_init_acct()
1398 radius->acct_serv_sock = socket(PF_INET, SOCK_DGRAM, 0); in radius_client_init_acct()
1399 if (radius->acct_serv_sock < 0) in radius_client_init_acct()
1400 wpa_printf(MSG_INFO, "RADIUS: socket[PF_INET,SOCK_DGRAM]: %s", in radius_client_init_acct()
1403 radius_client_disable_pmtu_discovery(radius->acct_serv_sock); in radius_client_init_acct()
1408 radius->acct_serv_sock6 = socket(PF_INET6, SOCK_DGRAM, 0); in radius_client_init_acct()
1409 if (radius->acct_serv_sock6 < 0) in radius_client_init_acct()
1410 wpa_printf(MSG_INFO, "RADIUS: socket[PF_INET6,SOCK_DGRAM]: %s", in radius_client_init_acct()
1419 radius_change_server(radius, conf->acct_server, NULL, in radius_client_init_acct()
1420 radius->acct_serv_sock, radius->acct_serv_sock6, in radius_client_init_acct()
1423 if (radius->acct_serv_sock >= 0 && in radius_client_init_acct()
1424 eloop_register_read_sock(radius->acct_serv_sock, in radius_client_init_acct()
1425 radius_client_receive, radius, in radius_client_init_acct()
1427 wpa_printf(MSG_INFO, "RADIUS: Could not register read socket for accounting server"); in radius_client_init_acct()
1428 radius_close_acct_sockets(radius); in radius_client_init_acct()
1433 if (radius->acct_serv_sock6 >= 0 && in radius_client_init_acct()
1434 eloop_register_read_sock(radius->acct_serv_sock6, in radius_client_init_acct()
1435 radius_client_receive, radius, in radius_client_init_acct()
1437 wpa_printf(MSG_INFO, "RADIUS: Could not register read socket for accounting server"); in radius_client_init_acct()
1438 radius_close_acct_sockets(radius); in radius_client_init_acct()
1448 * radius_client_init - Initialize RADIUS client
1450 * @conf: RADIUS client configuration (RADIUS servers)
1451 * Returns: Pointer to private RADIUS client context or %NULL on failure
1454 * the lifetime of the RADIUS client, i.e., until radius_client_deinit() is
1460 struct radius_client_data *radius; in radius_client_init() local
1462 radius = os_zalloc(sizeof(struct radius_client_data)); in radius_client_init()
1463 if (radius == NULL) in radius_client_init()
1466 radius->ctx = ctx; in radius_client_init()
1467 radius->conf = conf; in radius_client_init()
1468 radius->auth_serv_sock = radius->acct_serv_sock = in radius_client_init()
1469 radius->auth_serv_sock6 = radius->acct_serv_sock6 = in radius_client_init()
1470 radius->auth_sock = radius->acct_sock = -1; in radius_client_init()
1472 if (conf->auth_server && radius_client_init_auth(radius)) { in radius_client_init()
1473 radius_client_deinit(radius); in radius_client_init()
1477 if (conf->acct_server && radius_client_init_acct(radius)) { in radius_client_init()
1478 radius_client_deinit(radius); in radius_client_init()
1484 radius_retry_primary_timer, radius, in radius_client_init()
1487 return radius; in radius_client_init()
1492 * radius_client_deinit - Deinitialize RADIUS client
1493 * @radius: RADIUS client context from radius_client_init()
1495 void radius_client_deinit(struct radius_client_data *radius) in radius_client_deinit() argument
1497 if (!radius) in radius_client_deinit()
1500 radius_close_auth_sockets(radius); in radius_client_deinit()
1501 radius_close_acct_sockets(radius); in radius_client_deinit()
1503 eloop_cancel_timeout(radius_retry_primary_timer, radius, NULL); in radius_client_deinit()
1505 radius_client_flush(radius, 0); in radius_client_deinit()
1506 os_free(radius->auth_handlers); in radius_client_deinit()
1507 os_free(radius->acct_handlers); in radius_client_deinit()
1508 os_free(radius); in radius_client_deinit()
1513 * radius_client_flush_auth - Flush pending RADIUS messages for an address
1514 * @radius: RADIUS client context from radius_client_init()
1517 * This function can be used to remove pending RADIUS authentication messages
1522 void radius_client_flush_auth(struct radius_client_data *radius, in radius_client_flush_auth() argument
1528 entry = radius->msgs; in radius_client_flush_auth()
1532 hostapd_logger(radius->ctx, addr, in radius_client_flush_auth()
1535 "Removing pending RADIUS authentication" in radius_client_flush_auth()
1541 radius->msgs = entry->next; in radius_client_flush_auth()
1546 radius->num_msgs--; in radius_client_flush_auth()
1652 * radius_client_get_mib - Get RADIUS client MIB information
1653 * @radius: RADIUS client context from radius_client_init()
1658 int radius_client_get_mib(struct radius_client_data *radius, char *buf, in radius_client_get_mib() argument
1666 if (!radius) in radius_client_get_mib()
1669 conf = radius->conf; in radius_client_get_mib()
1677 radius : NULL); in radius_client_get_mib()
1687 radius : NULL); in radius_client_get_mib()
1695 void radius_client_reconfig(struct radius_client_data *radius, in radius_client_reconfig() argument
1698 if (radius) in radius_client_reconfig()
1699 radius->conf = conf; in radius_client_reconfig()