Deleted Added
full compact
ieee802_11_auth.c (281806) ieee802_11_auth.c (289549)
1/*
2 * hostapd / IEEE 802.11 authentication (ACL)
3 * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 *
8 * Access control list for IEEE 802.11 authentication can uses statically

--- 385 unchanged lines hidden (view full) ---

394 prev = entry;
395 entry = entry->next;
396 }
397}
398
399
400/**
401 * hostapd_acl_expire - ACL cache expiration callback
1/*
2 * hostapd / IEEE 802.11 authentication (ACL)
3 * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 *
8 * Access control list for IEEE 802.11 authentication can uses statically

--- 385 unchanged lines hidden (view full) ---

394 prev = entry;
395 entry = entry->next;
396 }
397}
398
399
400/**
401 * hostapd_acl_expire - ACL cache expiration callback
402 * @eloop_ctx: struct hostapd_data *
403 * @timeout_ctx: Not used
402 * @hapd: struct hostapd_data *
404 */
403 */
405static void hostapd_acl_expire(void *eloop_ctx, void *timeout_ctx)
404void hostapd_acl_expire(struct hostapd_data *hapd)
406{
405{
407 struct hostapd_data *hapd = eloop_ctx;
408 struct os_reltime now;
409
410 os_get_reltime(&now);
411 hostapd_acl_expire_cache(hapd, &now);
412 hostapd_acl_expire_queries(hapd, &now);
406 struct os_reltime now;
407
408 os_get_reltime(&now);
409 hostapd_acl_expire_cache(hapd, &now);
410 hostapd_acl_expire_queries(hapd, &now);
413
414 eloop_register_timeout(10, 0, hostapd_acl_expire, hapd, NULL);
415}
416
417
418static void decode_tunnel_passwords(struct hostapd_data *hapd,
419 const u8 *shared_secret,
420 size_t shared_secret_len,
421 struct radius_msg *msg,
422 struct radius_msg *req,

--- 133 unchanged lines hidden (view full) ---

556 cache->radius_cui = os_zalloc(len + 1);
557 if (cache->radius_cui)
558 os_memcpy(cache->radius_cui, buf, len);
559 }
560
561 if (hapd->conf->wpa_psk_radius == PSK_RADIUS_REQUIRED &&
562 !cache->psk)
563 cache->accepted = HOSTAPD_ACL_REJECT;
411}
412
413
414static void decode_tunnel_passwords(struct hostapd_data *hapd,
415 const u8 *shared_secret,
416 size_t shared_secret_len,
417 struct radius_msg *msg,
418 struct radius_msg *req,

--- 133 unchanged lines hidden (view full) ---

552 cache->radius_cui = os_zalloc(len + 1);
553 if (cache->radius_cui)
554 os_memcpy(cache->radius_cui, buf, len);
555 }
556
557 if (hapd->conf->wpa_psk_radius == PSK_RADIUS_REQUIRED &&
558 !cache->psk)
559 cache->accepted = HOSTAPD_ACL_REJECT;
560
561 if (cache->vlan_id &&
562 !hostapd_vlan_id_valid(hapd->conf->vlan, cache->vlan_id)) {
563 hostapd_logger(hapd, query->addr,
564 HOSTAPD_MODULE_RADIUS,
565 HOSTAPD_LEVEL_INFO,
566 "Invalid VLAN ID %d received from RADIUS server",
567 cache->vlan_id);
568 cache->vlan_id = 0;
569 }
570 if (hapd->conf->ssid.dynamic_vlan == DYNAMIC_VLAN_REQUIRED &&
571 !cache->vlan_id)
572 cache->accepted = HOSTAPD_ACL_REJECT;
564 } else
565 cache->accepted = HOSTAPD_ACL_REJECT;
566 cache->next = hapd->acl_cache;
567 hapd->acl_cache = cache;
568
569#ifdef CONFIG_DRIVER_RADIUS_ACL
570 hostapd_drv_set_radius_acl_auth(hapd, query->addr, cache->accepted,
571 cache->session_timeout);

--- 25 unchanged lines hidden (view full) ---

597 * Returns: 0 on success, -1 on failure
598 */
599int hostapd_acl_init(struct hostapd_data *hapd)
600{
601#ifndef CONFIG_NO_RADIUS
602 if (radius_client_register(hapd->radius, RADIUS_AUTH,
603 hostapd_acl_recv_radius, hapd))
604 return -1;
573 } else
574 cache->accepted = HOSTAPD_ACL_REJECT;
575 cache->next = hapd->acl_cache;
576 hapd->acl_cache = cache;
577
578#ifdef CONFIG_DRIVER_RADIUS_ACL
579 hostapd_drv_set_radius_acl_auth(hapd, query->addr, cache->accepted,
580 cache->session_timeout);

--- 25 unchanged lines hidden (view full) ---

606 * Returns: 0 on success, -1 on failure
607 */
608int hostapd_acl_init(struct hostapd_data *hapd)
609{
610#ifndef CONFIG_NO_RADIUS
611 if (radius_client_register(hapd->radius, RADIUS_AUTH,
612 hostapd_acl_recv_radius, hapd))
613 return -1;
605
606 eloop_register_timeout(10, 0, hostapd_acl_expire, hapd, NULL);
607#endif /* CONFIG_NO_RADIUS */
608
609 return 0;
610}
611
612
613/**
614 * hostapd_acl_deinit - Deinitialize IEEE 802.11 ACL
615 * @hapd: hostapd BSS data
616 */
617void hostapd_acl_deinit(struct hostapd_data *hapd)
618{
619 struct hostapd_acl_query_data *query, *prev;
620
621#ifndef CONFIG_NO_RADIUS
614#endif /* CONFIG_NO_RADIUS */
615
616 return 0;
617}
618
619
620/**
621 * hostapd_acl_deinit - Deinitialize IEEE 802.11 ACL
622 * @hapd: hostapd BSS data
623 */
624void hostapd_acl_deinit(struct hostapd_data *hapd)
625{
626 struct hostapd_acl_query_data *query, *prev;
627
628#ifndef CONFIG_NO_RADIUS
622 eloop_cancel_timeout(hostapd_acl_expire, hapd, NULL);
623
624 hostapd_acl_cache_free(hapd->acl_cache);
625#endif /* CONFIG_NO_RADIUS */
626
627 query = hapd->acl_queries;
628 while (query) {
629 prev = query;
630 query = query->next;
631 hostapd_acl_query_free(prev);

--- 12 unchanged lines hidden ---
629 hostapd_acl_cache_free(hapd->acl_cache);
630#endif /* CONFIG_NO_RADIUS */
631
632 query = hapd->acl_queries;
633 while (query) {
634 prev = query;
635 query = query->next;
636 hostapd_acl_query_free(prev);

--- 12 unchanged lines hidden ---