branch | RCL_3 |
changeset 46 | c74b3d9f6b9e |
parent 45 | bad0cc58d154 |
45:bad0cc58d154 | 46:c74b3d9f6b9e |
---|---|
14 * Description: EAP and WLAN authentication protocols. |
14 * Description: EAP and WLAN authentication protocols. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 /* |
18 /* |
19 * %version: 115 % |
19 * %version: 86.1.2.1.1 % |
20 */ |
20 */ |
21 |
21 |
22 // This is enumeration of EAPOL source code. |
22 // This is enumeration of EAPOL source code. |
23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
24 #undef EAP_FILE_NUMBER_ENUM |
24 #undef EAP_FILE_NUMBER_ENUM |
48 #include "eap_buffer.h" |
48 #include "eap_buffer.h" |
49 #include "eap_config.h" |
49 #include "eap_config.h" |
50 #include "eap_array_algorithms.h" |
50 #include "eap_array_algorithms.h" |
51 #include "eap_state_notification.h" |
51 #include "eap_state_notification.h" |
52 #include "eap_automatic_variable.h" |
52 #include "eap_automatic_variable.h" |
53 #include "eapol_key_state_string.h" |
|
54 |
53 |
55 // LOCAL CONSTANTS |
54 // LOCAL CONSTANTS |
56 |
55 |
57 enum eapol_am_core_timer_id_e |
56 enum eapol_am_core_timer_id_e |
58 { |
57 { |
83 // ================= MEMBER FUNCTIONS ======================= |
82 // ================= MEMBER FUNCTIONS ======================= |
84 |
83 |
85 EAP_FUNC_EXPORT eapol_wlan_authentication_c * eapol_wlan_authentication_c::new_eapol_wlan_authentication( |
84 EAP_FUNC_EXPORT eapol_wlan_authentication_c * eapol_wlan_authentication_c::new_eapol_wlan_authentication( |
86 abs_eap_am_tools_c * const tools, |
85 abs_eap_am_tools_c * const tools, |
87 abs_eapol_wlan_authentication_c * const partner, |
86 abs_eapol_wlan_authentication_c * const partner, |
88 const bool is_client_when_true |
87 const bool is_client_when_true, |
88 const abs_eapol_wlan_database_reference_if_c * const wlan_database_reference |
|
89 ) |
89 ) |
90 { |
90 { |
91 EAP_TRACE_DEBUG( |
91 EAP_TRACE_DEBUG( |
92 tools, |
92 tools, |
93 TRACE_FLAGS_DEFAULT, |
93 TRACE_FLAGS_DEFAULT, |
95 |
95 |
96 EAP_TRACE_RETURN_STRING(tools, "returns to partner: eapol_wlan_authentication_c::new_eapol_wlan_authentication()"); |
96 EAP_TRACE_RETURN_STRING(tools, "returns to partner: eapol_wlan_authentication_c::new_eapol_wlan_authentication()"); |
97 |
97 |
98 eapol_am_wlan_authentication_c * m_am_wauth = eapol_am_wlan_authentication_c::new_eapol_am_wlan_authentication( |
98 eapol_am_wlan_authentication_c * m_am_wauth = eapol_am_wlan_authentication_c::new_eapol_am_wlan_authentication( |
99 tools, |
99 tools, |
100 is_client_when_true); |
100 is_client_when_true, |
101 wlan_database_reference); |
|
101 if (m_am_wauth == 0 |
102 if (m_am_wauth == 0 |
102 || m_am_wauth->get_is_valid() == false) |
103 || m_am_wauth->get_is_valid() == false) |
103 { |
104 { |
104 // ERROR. |
105 // ERROR. |
105 if (m_am_wauth != 0) |
106 if (m_am_wauth != 0) |
155 const bool is_client_when_true) |
156 const bool is_client_when_true) |
156 : m_partner(partner) |
157 : m_partner(partner) |
157 , m_am_wauth(am_wauth) |
158 , m_am_wauth(am_wauth) |
158 , m_ethernet_core(0) |
159 , m_ethernet_core(0) |
159 , m_am_tools(tools) |
160 , m_am_tools(tools) |
160 //, m_selected_eap_types(tools) |
161 , m_selected_eap_types(tools) |
161 , m_wpa_preshared_key_hash(tools) |
162 , m_wpa_preshared_key_hash(tools) |
162 , m_authentication_type(eapol_key_authentication_type_none) |
163 , m_authentication_type(eapol_key_authentication_type_none) |
163 , m_802_11_authentication_mode(eapol_key_802_11_authentication_mode_none) |
164 , m_802_11_authentication_mode(eapol_key_802_11_authentication_mode_none) |
164 , m_received_WPA_IE(tools) // WLM must give only the WPA IE to EAPOL |
165 , m_received_WPA_IE(tools) // WLM must give only the WPA IE to EAPOL |
165 , m_sent_WPA_IE(tools) |
166 , m_sent_WPA_IE(tools) |
396 |
397 |
397 // |
398 // |
398 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::start_authentication( |
399 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::start_authentication( |
399 const eap_variable_data_c * const SSID, |
400 const eap_variable_data_c * const SSID, |
400 const eapol_key_authentication_type_e selected_eapol_key_authentication_type, |
401 const eapol_key_authentication_type_e selected_eapol_key_authentication_type, |
401 const eap_variable_data_c * const preshared_key, // This does include WPA pre-shared key or WPS PIN. |
402 const eap_variable_data_c * const wpa_preshared_key, |
402 const bool WPA_override_enabled, |
403 const bool WPA_override_enabled |
404 #if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
405 , |
|
403 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
406 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
407 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
404 ) |
408 ) |
405 { |
409 { |
406 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
410 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
407 |
411 |
408 EAP_TRACE_DEBUG( |
412 EAP_TRACE_DEBUG( |
412 (m_is_client == true) ? "client": "server")); |
416 (m_is_client == true) ? "client": "server")); |
413 |
417 |
414 EAP_TRACE_DEBUG( |
418 EAP_TRACE_DEBUG( |
415 m_am_tools, |
419 m_am_tools, |
416 TRACE_FLAGS_DEFAULT, |
420 TRACE_FLAGS_DEFAULT, |
417 (EAPL("Starting authentication, selected_eapol_key_authentication_type=%d=%s.\n"), |
421 (EAPL("Starting authentication, selected_eapol_key_authentication_type = %d.\n"), |
418 selected_eapol_key_authentication_type, |
422 selected_eapol_key_authentication_type)); |
419 eapol_key_state_string_c::get_eapol_key_authentication_type_string(selected_eapol_key_authentication_type))); |
|
420 |
423 |
421 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::start_authentication()"); |
424 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::start_authentication()"); |
422 |
425 |
423 eap_status_e status(eap_status_ok); |
426 eap_status_e status(eap_status_ok); |
424 |
427 |
437 (m_is_client == true) ? "client": "server")); |
440 (m_is_client == true) ? "client": "server")); |
438 |
441 |
439 status = m_am_wauth->set_wlan_parameters( |
442 status = m_am_wauth->set_wlan_parameters( |
440 SSID, |
443 SSID, |
441 WPA_override_enabled, |
444 WPA_override_enabled, |
442 preshared_key, |
445 wpa_preshared_key, |
443 selected_eapol_key_authentication_type); |
446 selected_eapol_key_authentication_type); |
444 if (status != eap_status_ok) |
447 if (status != eap_status_ok) |
445 { |
448 { |
446 (void) internal_disassociation(false, 0); // Note we have no addresses yet. |
449 (void) disassociation(0); // Note we have no addresses yet. |
447 |
450 |
448 (void) eapol_indication( |
451 (void) eapol_indication( |
449 0, // Note we have no addresses yet. |
452 0, // Note we have no addresses yet. |
450 eapol_wlan_authentication_state_failed_completely); |
453 eapol_wlan_authentication_state_failed_completely); |
451 |
454 |
453 } |
456 } |
454 |
457 |
455 EAP_TRACE_DEBUG( |
458 EAP_TRACE_DEBUG( |
456 m_am_tools, |
459 m_am_tools, |
457 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
460 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
458 (EAPL("calls: eapol_wlan_authentication_c::start_authentication(): m_am_wauth->reset_wpa_configuration(): %s.\n"), |
461 (EAPL("calls: eapol_wlan_authentication_c::start_authentication(): m_am_wauth->reset_eap_configuration(): %s.\n"), |
459 (m_is_client == true) ? "client": "server")); |
462 (m_is_client == true) ? "client": "server")); |
460 |
463 |
461 status = m_am_wauth->reset_wpa_configuration(); |
464 status = m_am_wauth->reset_eap_configuration(); |
462 if (status != eap_status_ok) |
465 if (status != eap_status_ok) |
463 { |
466 { |
464 (void) internal_disassociation(false, 0); // Note we have no addresses yet. |
467 (void) disassociation(0); // Note we have no addresses yet. |
465 |
468 |
466 (void) eapol_indication( |
469 (void) eapol_indication( |
467 0, // Note we have no addresses yet. |
470 0, // Note we have no addresses yet. |
468 eapol_wlan_authentication_state_failed_completely); |
471 eapol_wlan_authentication_state_failed_completely); |
469 |
472 |
474 m_am_tools, |
477 m_am_tools, |
475 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
478 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
476 (EAPL("calls: eapol_wlan_authentication_c::start_authentication(): m_am_wauth->get_selected_eap_types(): %s.\n"), |
479 (EAPL("calls: eapol_wlan_authentication_c::start_authentication(): m_am_wauth->get_selected_eap_types(): %s.\n"), |
477 (m_is_client == true) ? "client": "server")); |
480 (m_is_client == true) ? "client": "server")); |
478 |
481 |
482 status = m_am_wauth->get_selected_eap_types(&m_selected_eap_types); |
|
483 if (status != eap_status_ok) |
|
484 { |
|
485 return EAP_STATUS_RETURN(m_am_tools, status); |
|
486 } |
|
487 |
|
479 EAP_TRACE_DEBUG( |
488 EAP_TRACE_DEBUG( |
480 m_am_tools, |
489 m_am_tools, |
481 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
490 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
482 (EAPL("calls: eapol_wlan_authentication_c::start_authentication(): m_am_wauth->get_wlan_configuration(): %s.\n"), |
491 (EAPL("calls: eapol_wlan_authentication_c::start_authentication(): m_am_wauth->get_wlan_configuration(): %s.\n"), |
483 (m_is_client == true) ? "client": "server")); |
492 (m_is_client == true) ? "client": "server")); |
489 return EAP_STATUS_RETURN(m_am_tools, status); |
498 return EAP_STATUS_RETURN(m_am_tools, status); |
490 } |
499 } |
491 |
500 |
492 // Start new authentication from scratch. |
501 // Start new authentication from scratch. |
493 |
502 |
503 if (m_authentication_type == eapol_key_authentication_type_RSNA_PSK |
|
504 || m_authentication_type == eapol_key_authentication_type_WPA_PSK) |
|
505 { |
|
506 // WPA Pre-shared key mode |
|
507 m_802_11_authentication_mode = eapol_key_802_11_authentication_mode_open; |
|
508 |
|
509 if (m_authentication_type == eapol_key_authentication_type_RSNA_PSK) |
|
510 { |
|
511 EAP_TRACE_ALWAYS( |
|
512 m_am_tools, |
|
513 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
514 (EAPL("start_authentication(): Trying auth mode OPEN and WPA2-PSK.\n"))); |
|
515 } |
|
516 else |
|
517 { |
|
518 EAP_TRACE_ALWAYS( |
|
519 m_am_tools, |
|
520 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
521 (EAPL("start_authentication(): Trying auth mode OPEN and WPA-PSK.\n"))); |
|
522 } |
|
523 } |
|
524 else //if (wpa_preshared_key == 0 |
|
525 //|| wpa_preshared_key->get_is_valid_data() == false |
|
526 //|| WPA_override_enabled == false) |
|
527 { |
|
528 // Check the first enabled type |
|
529 eap_type_selection_c * eap_type = 0; |
|
530 u32_t ind_type = 0ul; |
|
531 |
|
532 for (ind_type = 0; ind_type < m_selected_eap_types.get_object_count(); ind_type++) |
|
533 { |
|
534 // Check if type is enabled |
|
535 eap_type = m_selected_eap_types.get_object(ind_type); |
|
536 |
|
537 if (eap_type->get_is_enabled() == true) |
|
538 { |
|
539 break; |
|
540 } |
|
541 } |
|
542 |
|
543 if (ind_type >= m_selected_eap_types.get_object_count()) |
|
544 { |
|
545 // No enabled EAP types. |
|
546 EAP_TRACE_ALWAYS( |
|
547 m_am_tools, |
|
548 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
549 (EAPL("No enabled EAP types.\n"))); |
|
550 EAP_TRACE_ALWAYS( |
|
551 m_am_tools, |
|
552 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
553 (EAPL("Indication sent to WLM: eap_status_failed_completely.\n"))); |
|
554 |
|
555 (void) disassociation(0); // Note we have no addresses yet. |
|
556 |
|
557 status = eapol_indication( |
|
558 0, // Note we have no addresses yet. |
|
559 eapol_wlan_authentication_state_failed_completely); |
|
560 if (status != eap_status_ok) |
|
561 { |
|
562 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
563 return EAP_STATUS_RETURN(m_am_tools, status); |
|
564 } |
|
565 |
|
566 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
567 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
568 } |
|
569 |
|
570 // reset index (start from the first enabled EAP type) |
|
571 m_current_eap_index = ind_type; |
|
572 |
|
573 if (eap_type->get_type() == eap_type_leap) |
|
574 { |
|
575 if (m_authentication_type == eapol_key_authentication_type_dynamic_WEP) |
|
576 { |
|
577 // LEAP uses it's own 802.11 authentication mode when 802.1X (dynamic WEP) is used. |
|
578 m_802_11_authentication_mode = eapol_key_802_11_authentication_mode_leap; |
|
579 |
|
580 EAP_TRACE_ALWAYS( |
|
581 m_am_tools, |
|
582 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
583 (EAPL("start_authentication(): Trying auth mode LEAP (802.1x mode).\n"))); |
|
584 } |
|
585 else |
|
586 { |
|
587 // If security mode is WPA or RSNA then even LEAP uses open authentication! |
|
588 m_802_11_authentication_mode = eapol_key_802_11_authentication_mode_open; |
|
589 |
|
590 EAP_TRACE_ALWAYS( |
|
591 m_am_tools, |
|
592 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
593 (EAPL("start_authentication(): Trying auth mode OPEN (LEAP in WPA mode).\n"))); |
|
594 } |
|
595 |
|
596 } |
|
597 else |
|
598 { |
|
599 m_802_11_authentication_mode = eapol_key_802_11_authentication_mode_open; |
|
600 |
|
601 EAP_TRACE_ALWAYS( |
|
602 m_am_tools, |
|
603 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
604 (EAPL("start_authentication(): Trying auth mode OPEN.\n"))); |
|
605 } |
|
606 } |
|
607 |
|
608 #if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
494 WAUTH_ENTER_MUTEX(m_am_tools); |
609 WAUTH_ENTER_MUTEX(m_am_tools); |
495 EAP_TRACE_DEBUG( |
610 EAP_TRACE_DEBUG( |
496 m_am_tools, |
611 m_am_tools, |
497 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
612 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
498 (EAPL("calls eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->create_state(): %s.\n"), |
613 (EAPL("calls eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->create_state(): %s.\n"), |
499 (m_is_client == true) ? "client": "server")); |
614 (m_is_client == true) ? "client": "server")); |
500 status = m_ethernet_core->create_state( |
615 status = m_ethernet_core->create_state( |
501 receive_network_id, |
616 receive_network_id, |
502 m_authentication_type |
617 selected_eapol_key_authentication_type |
503 ); |
618 ); |
504 EAP_TRACE_DEBUG( |
619 EAP_TRACE_DEBUG( |
505 m_am_tools, |
620 m_am_tools, |
506 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
621 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
507 (EAPL("returns from eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->create_state(): %s, status = %s.\n"), |
622 (EAPL("returns from eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->create_state(): %s, status = %s.\n"), |
508 (m_is_client == true) ? "client": "server", |
623 (m_is_client == true) ? "client": "server", |
509 eap_status_string_c::get_status_string(status))); |
624 eap_status_string_c::get_status_string(status))); |
510 WAUTH_LEAVE_MUTEX(m_am_tools); |
625 WAUTH_LEAVE_MUTEX(m_am_tools); |
511 if (status != eap_status_ok) |
626 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
512 { |
627 |
513 return EAP_STATUS_RETURN(m_am_tools, status); |
628 |
514 } |
629 EAP_TRACE_DEBUG( |
515 |
630 m_am_tools, |
516 if (m_authentication_type == eapol_key_authentication_type_RSNA_PSK |
631 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
517 || m_authentication_type == eapol_key_authentication_type_WPA_PSK) |
632 (EAPL("calls partner: eapol_wlan_authentication_c::start_authentication(): m_partner->associate(%d).\n"), |
518 { |
633 m_802_11_authentication_mode)); |
519 // WPA Pre-shared key mode |
634 |
520 m_802_11_authentication_mode = eapol_key_802_11_authentication_mode_open; |
635 status = m_partner->associate(m_802_11_authentication_mode); |
521 |
636 (void)EAP_STATUS_RETURN(m_am_tools, status); |
522 if (m_authentication_type == eapol_key_authentication_type_RSNA_PSK) |
637 |
523 { |
638 EAP_TRACE_DEBUG( |
524 EAP_TRACE_ALWAYS( |
639 m_am_tools, |
525 m_am_tools, |
640 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
526 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
641 (EAPL("returns from partner: eapol_wlan_authentication_c::start_authentication(): %s: m_partner->associate(): status = %s\n"), |
527 (EAPL("start_authentication(): Trying auth mode OPEN and WPA2-PSK.\n"))); |
642 (m_is_client == true) ? "client": "server", |
528 } |
643 eap_status_string_c::get_status_string(status))); |
529 else |
|
530 { |
|
531 EAP_TRACE_ALWAYS( |
|
532 m_am_tools, |
|
533 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
534 (EAPL("start_authentication(): Trying auth mode OPEN and WPA-PSK.\n"))); |
|
535 } |
|
536 |
|
537 status = complete_get_802_11_authentication_mode( |
|
538 eap_status_ok, |
|
539 receive_network_id, |
|
540 m_802_11_authentication_mode); |
|
541 } |
|
542 else //if (preshared_key == 0 |
|
543 //|| preshared_key->get_is_valid_data() == false |
|
544 //|| WPA_override_enabled == false) |
|
545 { |
|
546 WAUTH_ENTER_MUTEX(m_am_tools); |
|
547 EAP_TRACE_DEBUG( |
|
548 m_am_tools, |
|
549 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
550 (EAPL("calls eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->get_802_11_authentication_mode(): %s.\n"), |
|
551 (m_is_client == true) ? "client": "server")); |
|
552 status = m_ethernet_core->get_802_11_authentication_mode( |
|
553 receive_network_id, |
|
554 m_authentication_type, |
|
555 SSID, |
|
556 preshared_key); |
|
557 EAP_TRACE_DEBUG( |
|
558 m_am_tools, |
|
559 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
560 (EAPL("returns from eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->get_802_11_authentication_mode(): %s, status = %s.\n"), |
|
561 (m_is_client == true) ? "client": "server", |
|
562 eap_status_string_c::get_status_string(status))); |
|
563 WAUTH_LEAVE_MUTEX(m_am_tools); |
|
564 if (status != eap_status_ok) |
|
565 { |
|
566 return EAP_STATUS_RETURN(m_am_tools, status); |
|
567 } |
|
568 } |
|
569 |
644 |
570 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
645 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
571 return EAP_STATUS_RETURN(m_am_tools, status); |
646 return EAP_STATUS_RETURN(m_am_tools, status); |
572 } |
647 } |
573 |
648 |
640 EAP_TRACE_ALWAYS( |
715 EAP_TRACE_ALWAYS( |
641 m_am_tools, |
716 m_am_tools, |
642 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
717 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
643 (EAPL("Indication sent to WLM: eap_status_this_ap_failed.\n"))); |
718 (EAPL("Indication sent to WLM: eap_status_this_ap_failed.\n"))); |
644 |
719 |
645 (void) internal_disassociation(false, receive_network_id); |
720 (void) disassociation(receive_network_id); |
646 |
721 |
647 status = eapol_indication( |
722 status = eapol_indication( |
648 receive_network_id, |
723 receive_network_id, |
649 eapol_wlan_authentication_state_this_ap_failed); |
724 eapol_wlan_authentication_state_this_ap_failed); |
650 if (status != eap_status_ok) |
725 if (status != eap_status_ok) |
754 m_am_tools, |
829 m_am_tools, |
755 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
830 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
756 (EAPL("calls: eapol_wlan_authentication_c::complete_association(): this->disassociation(): %s.\n"), |
831 (EAPL("calls: eapol_wlan_authentication_c::complete_association(): this->disassociation(): %s.\n"), |
757 (m_is_client == true) ? "client": "server")); |
832 (m_is_client == true) ? "client": "server")); |
758 |
833 |
759 (void) internal_disassociation(false, receive_network_id); |
834 (void) disassociation(receive_network_id); |
760 |
835 |
761 status = eapol_indication( |
836 status = eapol_indication( |
762 receive_network_id, |
837 receive_network_id, |
763 eapol_wlan_authentication_state_failed_completely); |
838 eapol_wlan_authentication_state_failed_completely); |
764 if (status != eap_status_ok) |
839 if (status != eap_status_ok) |
772 } |
847 } |
773 |
848 |
774 if (m_authentication_type == eapol_key_authentication_type_RSNA_EAP |
849 if (m_authentication_type == eapol_key_authentication_type_RSNA_EAP |
775 || m_authentication_type == eapol_key_authentication_type_WPA_EAP |
850 || m_authentication_type == eapol_key_authentication_type_WPA_EAP |
776 || m_authentication_type == eapol_key_authentication_type_dynamic_WEP |
851 || m_authentication_type == eapol_key_authentication_type_dynamic_WEP |
777 || m_authentication_type == eapol_key_authentication_type_WPS |
852 || m_authentication_type == eapol_key_authentication_type_WFA_SC |
778 #if defined(EAP_USE_WPXM) |
853 #if defined(EAP_USE_WPXM) |
779 || m_authentication_type == eapol_key_authentication_type_WPXM |
854 || m_authentication_type == eapol_key_authentication_type_WPXM |
780 #endif //#if defined(EAP_USE_WPXM) |
855 #endif //#if defined(EAP_USE_WPXM) |
781 || m_authentication_type == eapol_key_authentication_type_EAP_authentication_no_encryption |
856 || m_authentication_type == eapol_key_authentication_type_EAP_authentication_no_encryption |
782 ) |
857 ) |
947 } |
1022 } |
948 |
1023 |
949 EAP_TRACE_DEBUG( |
1024 EAP_TRACE_DEBUG( |
950 m_am_tools, |
1025 m_am_tools, |
951 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
1026 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
952 (EAPL("calls: eapol_wlan_authentication_c::start_reassociation(): m_am_wauth->reset_wpa_configuration(): %s.\n"), |
1027 (EAPL("calls: eapol_wlan_authentication_c::start_reassociation(): m_am_wauth->reset_eap_configuration(): %s.\n"), |
953 (m_is_client == true) ? "client": "server")); |
1028 (m_is_client == true) ? "client": "server")); |
954 |
1029 |
955 status = m_am_wauth->reset_wpa_configuration(); |
1030 status = m_am_wauth->reset_eap_configuration(); |
956 if (status != eap_status_ok) |
1031 if (status != eap_status_ok) |
957 { |
1032 { |
958 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1033 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
959 return EAP_STATUS_RETURN(m_am_tools, status); |
1034 return EAP_STATUS_RETURN(m_am_tools, status); |
960 } |
1035 } |
1003 m_authentication_type = selected_eapol_key_authentication_type; |
1078 m_authentication_type = selected_eapol_key_authentication_type; |
1004 |
1079 |
1005 EAP_TRACE_DEBUG( |
1080 EAP_TRACE_DEBUG( |
1006 m_am_tools, |
1081 m_am_tools, |
1007 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
1082 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
1008 (EAPL("calls partner: eapol_wlan_authentication_c::start_reassociation(): %s: m_partner->reassociate(): m_authentication_type=%d=%s.\n"), |
1083 (EAPL("calls partner: eapol_wlan_authentication_c::start_reassociation(): %s: m_partner->reassociate(): m_authentication_type=%d.\n"), |
1009 (m_is_client == true) ? "client": "server", |
1084 (m_is_client == true) ? "client": "server", |
1010 m_authentication_type, |
1085 m_authentication_type)); |
1011 eapol_key_state_string_c::get_eapol_key_authentication_type_string(m_authentication_type))); |
|
1012 |
1086 |
1013 status = m_partner->reassociate( |
1087 status = m_partner->reassociate( |
1014 &send_network_id, |
1088 &send_network_id, |
1015 m_authentication_type, |
1089 m_authentication_type, |
1016 &reassociation_PMKID); |
1090 &reassociation_PMKID); |
1134 (EAPL("partner calls: eapol_wlan_authentication_c::packet_process(): %s\n"), |
1208 (EAPL("partner calls: eapol_wlan_authentication_c::packet_process(): %s\n"), |
1135 (m_is_client == true) ? "client": "server")); |
1209 (m_is_client == true) ? "client": "server")); |
1136 |
1210 |
1137 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::packet_process()"); |
1211 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::packet_process()"); |
1138 |
1212 |
1139 #if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
|
1140 |
|
1141 if (packet_length < eapol_ethernet_header_wr_c::get_header_length()) |
1213 if (packet_length < eapol_ethernet_header_wr_c::get_header_length()) |
1142 { |
1214 { |
1143 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1215 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1144 return EAP_STATUS_RETURN(m_am_tools, eap_status_too_short_message); |
1216 return EAP_STATUS_RETURN(m_am_tools, eap_status_too_short_message); |
1145 } |
1217 } |
1146 |
1218 |
1147 #endif //#if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
|
1148 |
|
1149 eapol_ethernet_header_wr_c eth_header( |
1219 eapol_ethernet_header_wr_c eth_header( |
1150 m_am_tools, |
1220 m_am_tools, |
1151 packet_data->get_header_buffer(packet_length), |
1221 packet_data->get_header_buffer(packet_length), |
1152 packet_length); |
1222 packet_length); |
1153 |
1223 |
1154 eap_status_e status(eap_status_process_general_error); |
1224 eap_status_e status(eap_status_process_general_error); |
1155 |
1225 |
1156 #if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
|
1157 if (eth_header.get_type() == eapol_ethernet_type_pae |
1226 if (eth_header.get_type() == eapol_ethernet_type_pae |
1158 || eth_header.get_type() == eapol_ethernet_type_preauthentication) |
1227 || eth_header.get_type() == eapol_ethernet_type_preauthentication) |
1159 #endif //#if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
|
1160 |
|
1161 { |
1228 { |
1162 // Forward the packet to the Ethernet layer of the EAPOL stack. |
1229 // Forward the packet to the Ethernet layer of the EAPOL stack. |
1163 // Ignore return value. Failure is signalled using state_notification. |
1230 // Ignore return value. Failure is signalled using state_notification. |
1164 WAUTH_ENTER_MUTEX(m_am_tools); |
1231 WAUTH_ENTER_MUTEX(m_am_tools); |
1165 EAP_TRACE_DEBUG( |
1232 EAP_TRACE_DEBUG( |
1179 eap_status_string_c::get_status_string(status))); |
1246 eap_status_string_c::get_status_string(status))); |
1180 WAUTH_LEAVE_MUTEX(m_am_tools); |
1247 WAUTH_LEAVE_MUTEX(m_am_tools); |
1181 |
1248 |
1182 EAP_GENERAL_HEADER_COPY_ERROR_PARAMETERS(packet_data, ð_header); |
1249 EAP_GENERAL_HEADER_COPY_ERROR_PARAMETERS(packet_data, ð_header); |
1183 } |
1250 } |
1184 #if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
|
1185 else |
1251 else |
1186 { |
1252 { |
1187 EAP_TRACE_DEBUG( |
1253 EAP_TRACE_DEBUG( |
1188 m_am_tools, |
1254 m_am_tools, |
1189 TRACE_FLAGS_DEFAULT, |
1255 TRACE_FLAGS_DEFAULT, |
1190 (EAPL("Not supported ethernet type 0x%04x\n"), eth_header.get_type())); |
1256 (EAPL("Not supported ethernet type 0x%04x\n"), eth_header.get_type())); |
1191 status = eap_status_ethernet_type_not_supported; |
1257 status = eap_status_ethernet_type_not_supported; |
1192 } |
1258 } |
1193 #endif //#if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
|
1194 |
1259 |
1195 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1260 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1196 return EAP_STATUS_RETURN(m_am_tools, status); |
1261 return EAP_STATUS_RETURN(m_am_tools, status); |
1197 } |
1262 } |
1198 |
1263 |
1800 eap_header_string_c eap_string; |
1865 eap_header_string_c eap_string; |
1801 |
1866 |
1802 EAP_TRACE_DEBUG( |
1867 EAP_TRACE_DEBUG( |
1803 m_am_tools, |
1868 m_am_tools, |
1804 TRACE_FLAGS_DEFAULT, |
1869 TRACE_FLAGS_DEFAULT, |
1805 (EAPL("eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0xfe%06x%08x=%s\n"), |
1870 (EAPL("eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0x%08x=%s\n"), |
1806 (state->get_is_client() == true ? "client": "server"), |
1871 (state->get_is_client() == true ? "client": "server"), |
1807 state->get_protocol_layer(), |
1872 state->get_protocol_layer(), |
1808 state->get_protocol_layer_string(), |
1873 state->get_protocol_layer_string(), |
1809 state->get_protocol(), |
1874 state->get_protocol(), |
1810 state->get_protocol_string(), |
1875 state->get_protocol_string(), |
1811 state->get_eap_type().get_vendor_id(), |
1876 convert_eap_type_to_u32_t(state->get_eap_type()), |
1812 state->get_eap_type().get_vendor_type(), |
1877 eap_string.get_eap_type_string(state->get_eap_type()))); |
1813 eap_header_string_c::get_eap_type_string(state->get_eap_type()))); |
|
1814 |
1878 |
1815 EAP_TRACE_DEBUG( |
1879 EAP_TRACE_DEBUG( |
1816 m_am_tools, |
1880 m_am_tools, |
1817 TRACE_FLAGS_DEFAULT, |
1881 TRACE_FLAGS_DEFAULT, |
1818 (EAPL("eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
1882 (EAPL("eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
1821 state->get_current_state_string(), |
1885 state->get_current_state_string(), |
1822 state->get_authentication_error(), |
1886 state->get_authentication_error(), |
1823 status_string.get_status_string(state->get_authentication_error()))); |
1887 status_string.get_status_string(state->get_authentication_error()))); |
1824 } |
1888 } |
1825 |
1889 |
1890 |
|
1891 #if !defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
1892 |
|
1893 EAP_TRACE_DEBUG( |
|
1894 m_am_tools, |
|
1895 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
1896 (EAPL("calls partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
|
1897 (m_is_client == true) ? "client": "server")); |
|
1898 |
|
1899 // Calls lower layer. |
|
1900 // Note the optimization prevents most of the state notifications to lower layer. |
|
1901 m_partner->state_notification(state); |
|
1902 |
|
1903 EAP_TRACE_DEBUG( |
|
1904 m_am_tools, |
|
1905 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
1906 (EAPL("returns from partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
|
1907 (m_is_client == true) ? "client": "server")); |
|
1908 |
|
1909 #endif //#if !defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
1826 |
1910 |
1827 if(state->get_protocol_layer() == eap_protocol_layer_general) |
1911 if(state->get_protocol_layer() == eap_protocol_layer_general) |
1828 { |
1912 { |
1829 if (state->get_current_state() == eap_general_state_authentication_cancelled) |
1913 if (state->get_current_state() == eap_general_state_authentication_cancelled) |
1830 { |
1914 { |
1873 eap_header_string_c eap_string; |
1957 eap_header_string_c eap_string; |
1874 |
1958 |
1875 EAP_TRACE_ERROR( |
1959 EAP_TRACE_ERROR( |
1876 m_am_tools, |
1960 m_am_tools, |
1877 TRACE_FLAGS_DEFAULT, |
1961 TRACE_FLAGS_DEFAULT, |
1878 (EAPL("ERROR: eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0xfe%06x%08x=%s\n"), |
1962 (EAPL("ERROR: eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0x%08x=%s\n"), |
1879 (state->get_is_client() == true ? "client": "server"), |
1963 (state->get_is_client() == true ? "client": "server"), |
1880 state->get_protocol_layer(), |
1964 state->get_protocol_layer(), |
1881 state->get_protocol_layer_string(), |
1965 state->get_protocol_layer_string(), |
1882 state->get_protocol(), |
1966 state->get_protocol(), |
1883 state->get_protocol_string(), |
1967 state->get_protocol_string(), |
1884 state->get_eap_type().get_vendor_id(), |
1968 convert_eap_type_to_u32_t(state->get_eap_type()), |
1885 state->get_eap_type().get_vendor_type(), |
1969 eap_string.get_eap_type_string(state->get_eap_type()))); |
1886 eap_header_string_c::get_eap_type_string(state->get_eap_type()))); |
|
1887 |
1970 |
1888 EAP_TRACE_ERROR( |
1971 EAP_TRACE_ERROR( |
1889 m_am_tools, |
1972 m_am_tools, |
1890 TRACE_FLAGS_DEFAULT, |
1973 TRACE_FLAGS_DEFAULT, |
1891 (EAPL("ERROR: eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
1974 (EAPL("ERROR: eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
1893 state->get_current_state(), |
1976 state->get_current_state(), |
1894 state->get_current_state_string(), |
1977 state->get_current_state_string(), |
1895 state->get_authentication_error(), |
1978 state->get_authentication_error(), |
1896 status_string.get_status_string(state->get_authentication_error()))); |
1979 status_string.get_status_string(state->get_authentication_error()))); |
1897 |
1980 |
1981 #if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
1898 EAP_TRACE_DEBUG( |
1982 EAP_TRACE_DEBUG( |
1899 m_am_tools, |
1983 m_am_tools, |
1900 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
1984 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
1901 (EAPL("calls partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
1985 (EAPL("calls partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
1902 (m_is_client == true) ? "client": "server")); |
1986 (m_is_client == true) ? "client": "server")); |
1908 EAP_TRACE_DEBUG( |
1992 EAP_TRACE_DEBUG( |
1909 m_am_tools, |
1993 m_am_tools, |
1910 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
1994 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
1911 (EAPL("returns from partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
1995 (EAPL("returns from partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
1912 (m_is_client == true) ? "client": "server")); |
1996 (m_is_client == true) ? "client": "server")); |
1997 |
|
1998 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
1913 |
1999 |
1914 (void) cancel_timer_this_ap_failed(); |
2000 (void) cancel_timer_this_ap_failed(); |
1915 |
2001 |
1916 set_timer( |
2002 set_timer( |
1917 this, |
2003 this, |
1933 eap_header_string_c eap_string; |
2019 eap_header_string_c eap_string; |
1934 |
2020 |
1935 EAP_TRACE_DEBUG( |
2021 EAP_TRACE_DEBUG( |
1936 m_am_tools, |
2022 m_am_tools, |
1937 TRACE_FLAGS_DEFAULT, |
2023 TRACE_FLAGS_DEFAULT, |
1938 (EAPL("eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0xfe%06x%08x=%s\n"), |
2024 (EAPL("eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0x%08x=%s\n"), |
1939 (state->get_is_client() == true ? "client": "server"), |
2025 (state->get_is_client() == true ? "client": "server"), |
1940 state->get_protocol_layer(), |
2026 state->get_protocol_layer(), |
1941 state->get_protocol_layer_string(), |
2027 state->get_protocol_layer_string(), |
1942 state->get_protocol(), |
2028 state->get_protocol(), |
1943 state->get_protocol_string(), |
2029 state->get_protocol_string(), |
1944 state->get_eap_type().get_vendor_id(), |
2030 convert_eap_type_to_u32_t(state->get_eap_type()), |
1945 state->get_eap_type().get_vendor_type(), |
2031 eap_string.get_eap_type_string(state->get_eap_type()))); |
1946 eap_header_string_c::get_eap_type_string(state->get_eap_type()))); |
|
1947 |
2032 |
1948 EAP_TRACE_DEBUG( |
2033 EAP_TRACE_DEBUG( |
1949 m_am_tools, |
2034 m_am_tools, |
1950 TRACE_FLAGS_DEFAULT, |
2035 TRACE_FLAGS_DEFAULT, |
1951 (EAPL("eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
2036 (EAPL("eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
1992 m_am_tools, |
2077 m_am_tools, |
1993 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2078 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
1994 (EAPL("calls: eapol_wlan_authentication_c::state_notification(): m_am_wauth->authentication_finished(): %s.\n"), |
2079 (EAPL("calls: eapol_wlan_authentication_c::state_notification(): m_am_wauth->authentication_finished(): %s.\n"), |
1995 (m_is_client == true) ? "client": "server")); |
2080 (m_is_client == true) ? "client": "server")); |
1996 |
2081 |
2082 #if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
2083 |
|
1997 EAP_TRACE_DEBUG( |
2084 EAP_TRACE_DEBUG( |
1998 m_am_tools, |
2085 m_am_tools, |
1999 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2086 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2000 (EAPL("calls partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2087 (EAPL("calls partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2001 (m_is_client == true) ? "client": "server")); |
2088 (m_is_client == true) ? "client": "server")); |
2008 m_am_tools, |
2095 m_am_tools, |
2009 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2096 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2010 (EAPL("returns from partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2097 (EAPL("returns from partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2011 (m_is_client == true) ? "client": "server")); |
2098 (m_is_client == true) ? "client": "server")); |
2012 |
2099 |
2100 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
2101 |
|
2013 m_am_wauth->authentication_finished( |
2102 m_am_wauth->authentication_finished( |
2014 true, |
2103 true, |
2015 state->get_eap_type(), |
2104 state->get_eap_type(), |
2016 m_authentication_type); |
2105 m_authentication_type); |
2017 |
2106 |
2107 #if defined(USE_EAP_EXPANDED_TYPES) |
|
2018 if (state->get_eap_type() == eap_expanded_type_simple_config.get_type()) |
2108 if (state->get_eap_type() == eap_expanded_type_simple_config.get_type()) |
2019 { |
2109 { |
2020 increment_authentication_counter(); |
2110 increment_authentication_counter(); |
2021 m_successful_authentications++; |
2111 m_successful_authentications++; |
2022 |
2112 |
2033 { |
2123 { |
2034 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2124 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2035 return; |
2125 return; |
2036 } |
2126 } |
2037 } |
2127 } |
2128 #endif //#if defined(USE_EAP_EXPANDED_TYPES) |
|
2129 |
|
2038 } |
2130 } |
2039 break; |
2131 break; |
2040 case eap_state_authentication_terminated_unsuccessfully: |
2132 case eap_state_authentication_terminated_unsuccessfully: |
2041 { |
2133 { |
2042 increment_authentication_counter(); |
2134 increment_authentication_counter(); |
2043 m_failed_authentications++; |
2135 m_failed_authentications++; |
2044 |
2136 |
2137 #if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
2138 |
|
2045 EAP_TRACE_DEBUG( |
2139 EAP_TRACE_DEBUG( |
2046 m_am_tools, |
2140 m_am_tools, |
2047 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2141 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2048 (EAPL("calls partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2142 (EAPL("calls partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2049 (m_is_client == true) ? "client": "server")); |
2143 (m_is_client == true) ? "client": "server")); |
2055 EAP_TRACE_DEBUG( |
2149 EAP_TRACE_DEBUG( |
2056 m_am_tools, |
2150 m_am_tools, |
2057 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2151 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2058 (EAPL("returns from partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2152 (EAPL("returns from partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2059 (m_is_client == true) ? "client": "server")); |
2153 (m_is_client == true) ? "client": "server")); |
2154 |
|
2155 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
2060 |
2156 |
2061 EAP_TRACE_DEBUG( |
2157 EAP_TRACE_DEBUG( |
2062 m_am_tools, |
2158 m_am_tools, |
2063 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2159 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2064 (EAPL("calls: eapol_wlan_authentication_c::state_notification(): m_am_wauth->authentication_finished(): %s.\n"), |
2160 (EAPL("calls: eapol_wlan_authentication_c::state_notification(): m_am_wauth->authentication_finished(): %s.\n"), |
2272 m_am_tools, |
2368 m_am_tools, |
2273 TRACE_FLAGS_DEFAULT, |
2369 TRACE_FLAGS_DEFAULT, |
2274 (EAPL("EAPOL_WLAN_AUTHENTICATION_TIMER_FAILED_COMPLETELY_ID elapsed: ") |
2370 (EAPL("EAPOL_WLAN_AUTHENTICATION_TIMER_FAILED_COMPLETELY_ID elapsed: ") |
2275 EAPL("Indication sent to WLM: eap_status_failed_completely.\n"))); |
2371 EAPL("Indication sent to WLM: eap_status_failed_completely.\n"))); |
2276 |
2372 |
2277 (void) disassociation_mutex_must_be_reserved(false, &receive_network_id); |
2373 (void) disassociation_mutex_must_be_reserved(&receive_network_id); |
2278 |
2374 |
2279 eap_status_e status = eapol_indication( |
2375 eap_status_e status = eapol_indication( |
2280 &receive_network_id, |
2376 &receive_network_id, |
2281 eapol_wlan_authentication_state_failed_completely); |
2377 eapol_wlan_authentication_state_failed_completely); |
2282 if (status != eap_status_ok) |
2378 if (status != eap_status_ok) |
2293 m_am_tools, |
2389 m_am_tools, |
2294 TRACE_FLAGS_DEFAULT, |
2390 TRACE_FLAGS_DEFAULT, |
2295 (EAPL("EAPOL_WLAN_AUTHENTICATION_TIMER_THIS_AP_FAILED_ID elapsed: ") |
2391 (EAPL("EAPOL_WLAN_AUTHENTICATION_TIMER_THIS_AP_FAILED_ID elapsed: ") |
2296 EAPL("Indication sent to WLM: eap_status_this_ap_failed.\n"))); |
2392 EAPL("Indication sent to WLM: eap_status_this_ap_failed.\n"))); |
2297 |
2393 |
2298 (void) disassociation_mutex_must_be_reserved(false, &receive_network_id); |
2394 (void) disassociation_mutex_must_be_reserved(&receive_network_id); |
2299 |
2395 |
2300 eap_status_e status = eapol_indication( |
2396 eap_status_e status = eapol_indication( |
2301 &receive_network_id, |
2397 &receive_network_id, |
2302 eapol_wlan_authentication_state_this_ap_failed); |
2398 eapol_wlan_authentication_state_this_ap_failed); |
2303 if (status != eap_status_ok) |
2399 if (status != eap_status_ok) |
2314 m_am_tools, |
2410 m_am_tools, |
2315 TRACE_FLAGS_DEFAULT, |
2411 TRACE_FLAGS_DEFAULT, |
2316 (EAPL("EAPOL_WLAN_AUTHENTICATION_TIMER_NO_RESPONSE_ID elapsed: ") |
2412 (EAPL("EAPOL_WLAN_AUTHENTICATION_TIMER_NO_RESPONSE_ID elapsed: ") |
2317 EAPL("Indication sent to WLM: eap_status_no_response.\n"))); |
2413 EAPL("Indication sent to WLM: eap_status_no_response.\n"))); |
2318 |
2414 |
2319 (void) disassociation_mutex_must_be_reserved(false, &receive_network_id); |
2415 (void) disassociation_mutex_must_be_reserved(&receive_network_id); |
2320 |
2416 |
2321 eap_status_e status = eapol_indication( |
2417 eap_status_e status = eapol_indication( |
2322 &receive_network_id, |
2418 &receive_network_id, |
2323 eapol_wlan_authentication_state_no_response); |
2419 eapol_wlan_authentication_state_no_response); |
2324 if (status != eap_status_ok) |
2420 if (status != eap_status_ok) |
2335 m_am_tools, |
2431 m_am_tools, |
2336 TRACE_FLAGS_DEFAULT, |
2432 TRACE_FLAGS_DEFAULT, |
2337 (EAPL("EAPOL_WLAN_AUTHENTICATION_TIMER_AUTHENTICATION_CANCELLED_ID elapsed: ") |
2433 (EAPL("EAPOL_WLAN_AUTHENTICATION_TIMER_AUTHENTICATION_CANCELLED_ID elapsed: ") |
2338 EAPL("Indication sent to WLM: eapol_wlan_authentication_state_authentication_cancelled.\n"))); |
2434 EAPL("Indication sent to WLM: eapol_wlan_authentication_state_authentication_cancelled.\n"))); |
2339 |
2435 |
2340 (void) disassociation_mutex_must_be_reserved(false, &receive_network_id); |
2436 (void) disassociation_mutex_must_be_reserved(&receive_network_id); |
2341 } |
2437 } |
2342 break; |
2438 break; |
2343 |
2439 |
2344 default: |
2440 default: |
2345 break; |
2441 break; |
2434 |
2530 |
2435 // |
2531 // |
2436 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::unload_module( |
2532 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::unload_module( |
2437 const eap_type_value_e type) |
2533 const eap_type_value_e type) |
2438 { |
2534 { |
2439 EAP_UNREFERENCED_PARAMETER(type); |
|
2440 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2535 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2441 |
2536 |
2442 EAP_TRACE_DEBUG( |
2537 EAP_TRACE_DEBUG( |
2443 m_am_tools, |
2538 m_am_tools, |
2444 TRACE_FLAGS_DEFAULT, |
2539 TRACE_FLAGS_DEFAULT, |
2455 m_am_tools, |
2550 m_am_tools, |
2456 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2551 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2457 (EAPL("calls: eapol_wlan_authentication_c::unload_module(): m_am_wauth->unload_module(): %s.\n"), |
2552 (EAPL("calls: eapol_wlan_authentication_c::unload_module(): m_am_wauth->unload_module(): %s.\n"), |
2458 (m_is_client == true) ? "client": "server")); |
2553 (m_is_client == true) ? "client": "server")); |
2459 |
2554 |
2460 #if 0 |
|
2461 |
|
2462 status = m_am_wauth->unload_module(type); |
2555 status = m_am_wauth->unload_module(type); |
2463 |
|
2464 #else |
|
2465 |
|
2466 status = eap_status_not_supported; |
|
2467 |
|
2468 #endif |
|
2469 |
|
2470 |
2556 |
2471 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2557 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2472 return EAP_STATUS_RETURN(m_am_tools, status); |
2558 return EAP_STATUS_RETURN(m_am_tools, status); |
2473 } |
2559 } |
2474 |
2560 |
2499 eap_status_e status = m_ethernet_core->eap_acknowledge(receive_network_id); |
2585 eap_status_e status = m_ethernet_core->eap_acknowledge(receive_network_id); |
2500 EAP_TRACE_DEBUG( |
2586 EAP_TRACE_DEBUG( |
2501 m_am_tools, |
2587 m_am_tools, |
2502 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2588 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2503 (EAPL("returns from eapol: eapol_wlan_authentication_c::eap_acknowledge(): m_ethernet_core->eap_acknowledge(): %s, status = %s.\n"), |
2589 (EAPL("returns from eapol: eapol_wlan_authentication_c::eap_acknowledge(): m_ethernet_core->eap_acknowledge(): %s, status = %s.\n"), |
2504 (m_is_client == true) ? "client": "server", |
|
2505 eap_status_string_c::get_status_string(status))); |
|
2506 WAUTH_LEAVE_MUTEX(m_am_tools); |
|
2507 |
|
2508 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2509 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2510 } |
|
2511 |
|
2512 //-------------------------------------------------- |
|
2513 |
|
2514 // |
|
2515 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::set_eap_database_reference_values( |
|
2516 const eap_variable_data_c * const reference) |
|
2517 { |
|
2518 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2519 |
|
2520 EAP_TRACE_DEBUG( |
|
2521 m_am_tools, |
|
2522 TRACE_FLAGS_DEFAULT, |
|
2523 (EAPL("partner calls: eapol_wlan_authentication_c::set_eap_database_reference_values()\n"))); |
|
2524 |
|
2525 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::set_eap_database_reference_values()"); |
|
2526 |
|
2527 EAP_TRACE_DATA_DEBUG( |
|
2528 m_am_tools, |
|
2529 TRACE_FLAGS_DEFAULT, |
|
2530 (EAPL("eapol_wlan_authentication_c::set_eap_database_reference_values(): reference"), |
|
2531 reference->get_data(), |
|
2532 reference->get_data_length())); |
|
2533 |
|
2534 WAUTH_ENTER_MUTEX(m_am_tools); |
|
2535 EAP_TRACE_DEBUG( |
|
2536 m_am_tools, |
|
2537 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
2538 (EAPL("calls eapol: eapol_wlan_authentication_c::set_eap_database_reference_values(): m_ethernet_core->set_eap_database_reference_values(): %s.\n"), |
|
2539 (m_is_client == true) ? "client": "server")); |
|
2540 eap_status_e status = m_ethernet_core->set_eap_database_reference_values(reference); |
|
2541 EAP_TRACE_DEBUG( |
|
2542 m_am_tools, |
|
2543 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
2544 (EAPL("returns from eapol: eapol_wlan_authentication_c::set_eap_database_reference_values(): m_ethernet_core->set_eap_database_reference_values(): %s, status = %s.\n"), |
|
2545 (m_is_client == true) ? "client": "server", |
|
2546 eap_status_string_c::get_status_string(status))); |
|
2547 WAUTH_LEAVE_MUTEX(m_am_tools); |
|
2548 |
|
2549 if (status != eap_status_ok) |
|
2550 { |
|
2551 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2552 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2553 } |
|
2554 |
|
2555 WAUTH_ENTER_MUTEX(m_am_tools); |
|
2556 EAP_TRACE_DEBUG( |
|
2557 m_am_tools, |
|
2558 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
2559 (EAPL("calls eapol: eapol_wlan_authentication_c::set_eap_database_reference_values(): m_am_wauth->set_eap_database_reference_values(): %s.\n"), |
|
2560 (m_is_client == true) ? "client": "server")); |
|
2561 status = m_am_wauth->set_eap_database_reference_values(reference); |
|
2562 EAP_TRACE_DEBUG( |
|
2563 m_am_tools, |
|
2564 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
2565 (EAPL("returns from eapol: eapol_wlan_authentication_c::set_eap_database_reference_values(): m_am_wauth->set_eap_database_reference_values(): %s, status = %s.\n"), |
|
2566 (m_is_client == true) ? "client": "server", |
2590 (m_is_client == true) ? "client": "server", |
2567 eap_status_string_c::get_status_string(status))); |
2591 eap_status_string_c::get_status_string(status))); |
2568 WAUTH_LEAVE_MUTEX(m_am_tools); |
2592 WAUTH_LEAVE_MUTEX(m_am_tools); |
2569 |
2593 |
2570 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2594 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2580 abs_eap_base_type_c * const partner, |
2604 abs_eap_base_type_c * const partner, |
2581 eap_base_type_c ** const eap_type_if, |
2605 eap_base_type_c ** const eap_type_if, |
2582 const bool is_client_when_true, |
2606 const bool is_client_when_true, |
2583 const eap_am_network_id_c * const receive_network_id) |
2607 const eap_am_network_id_c * const receive_network_id) |
2584 { |
2608 { |
2585 EAP_UNREFERENCED_PARAMETER(type); |
|
2586 EAP_UNREFERENCED_PARAMETER(tunneling_type); |
|
2587 EAP_UNREFERENCED_PARAMETER(eap_type_if); |
|
2588 EAP_UNREFERENCED_PARAMETER(receive_network_id); |
|
2589 EAP_UNREFERENCED_PARAMETER(partner); |
|
2590 EAP_UNREFERENCED_PARAMETER(is_client_when_true); |
|
2591 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2609 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2592 |
2610 |
2593 EAP_TRACE_DEBUG( |
2611 EAP_TRACE_DEBUG( |
2594 m_am_tools, |
2612 m_am_tools, |
2595 TRACE_FLAGS_DEFAULT, |
2613 TRACE_FLAGS_DEFAULT, |
2607 EAP_TRACE_DEBUG( |
2625 EAP_TRACE_DEBUG( |
2608 m_am_tools, |
2626 m_am_tools, |
2609 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2627 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2610 (EAPL("calls: eapol_wlan_authentication_c::load_module(): m_am_wauth->load_module(): %s.\n"), |
2628 (EAPL("calls: eapol_wlan_authentication_c::load_module(): m_am_wauth->load_module(): %s.\n"), |
2611 (m_is_client == true) ? "client": "server")); |
2629 (m_is_client == true) ? "client": "server")); |
2612 |
|
2613 #if 0 |
|
2614 |
2630 |
2615 eap_status_e status = m_am_wauth->load_module( |
2631 eap_status_e status = m_am_wauth->load_module( |
2616 type, |
2632 type, |
2617 tunneling_type, |
2633 tunneling_type, |
2618 partner, |
2634 partner, |
2619 eap_type_if, |
2635 eap_type_if, |
2620 is_client_when_true, |
2636 is_client_when_true, |
2621 receive_network_id); |
2637 receive_network_id); |
2622 |
2638 |
2623 #else |
|
2624 |
|
2625 eap_status_e status = eap_status_not_supported; |
|
2626 |
|
2627 #endif |
|
2628 |
|
2629 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2639 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2630 return EAP_STATUS_RETURN(m_am_tools, status); |
2640 return EAP_STATUS_RETURN(m_am_tools, status); |
2631 } |
2641 } |
2632 |
2642 |
2633 //-------------------------------------------------- |
2643 //-------------------------------------------------- |
2634 |
2644 |
2635 // |
2645 // |
2636 eap_status_e eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved( |
2646 eap_status_e eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved( |
2637 const bool complete_to_lower_layer, |
|
2638 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
2647 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
2639 ) |
2648 ) |
2640 { |
2649 { |
2641 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2650 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2642 |
2651 |
2643 EAP_TRACE_DEBUG( |
2652 EAP_TRACE_DEBUG( |
2644 m_am_tools, |
2653 m_am_tools, |
2645 TRACE_FLAGS_DEFAULT, |
2654 TRACE_FLAGS_DEFAULT, |
2646 (EAPL("eapol calls: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved(): %s, complete_to_lower_layer=%s\n"), |
2655 (EAPL("eapol calls: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved(): %s\n"), |
2647 (m_is_client == true) ? "client": "server", |
2656 (m_is_client == true) ? "client": "server")); |
2648 (complete_to_lower_layer == true) ? "true": "false")); |
|
2649 |
2657 |
2650 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to eapol: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved()"); |
2658 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to eapol: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved()"); |
2651 |
2659 |
2652 // reset index |
2660 // reset index |
2653 m_current_eap_index = 0UL; |
2661 m_current_eap_index = 0UL; |
2660 m_am_tools, |
2668 m_am_tools, |
2661 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2669 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2662 (EAPL("calls eapol: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved(): m_ethernet_core->disassociation(): %s.\n"), |
2670 (EAPL("calls eapol: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved(): m_ethernet_core->disassociation(): %s.\n"), |
2663 (m_is_client == true) ? "client": "server")); |
2671 (m_is_client == true) ? "client": "server")); |
2664 |
2672 |
2665 status = m_ethernet_core->disassociation( |
2673 status = m_ethernet_core->disassociation(receive_network_id); |
2666 complete_to_lower_layer, |
|
2667 receive_network_id); |
|
2668 |
2674 |
2669 EAP_TRACE_DEBUG( |
2675 EAP_TRACE_DEBUG( |
2670 m_am_tools, |
2676 m_am_tools, |
2671 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2677 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2672 (EAPL("returns from eapol: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved(): m_ethernet_core->disassociation(): %s, status = %s.\n"), |
2678 (EAPL("returns from eapol: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved(): m_ethernet_core->disassociation(): %s, status = %s.\n"), |
2712 } |
2718 } |
2713 |
2719 |
2714 //-------------------------------------------------- |
2720 //-------------------------------------------------- |
2715 |
2721 |
2716 // |
2722 // |
2717 eap_status_e eapol_wlan_authentication_c::internal_disassociation( |
|
2718 const bool complete_to_lower_layer, |
|
2719 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
|
2720 ) |
|
2721 { |
|
2722 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2723 |
|
2724 EAP_TRACE_DEBUG( |
|
2725 m_am_tools, |
|
2726 TRACE_FLAGS_DEFAULT, |
|
2727 (EAPL("eapol calls: eapol_wlan_authentication_c::internal_disassociation(): %s, complete_to_lower_layer=%s\n"), |
|
2728 (m_is_client == true) ? "client": "server", |
|
2729 (complete_to_lower_layer == true) ? "true": "false")); |
|
2730 |
|
2731 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to eapol: : eapol_wlan_authentication_c::internal_disassociation()"); |
|
2732 |
|
2733 eap_status_e status(eap_status_ok); |
|
2734 |
|
2735 WAUTH_ENTER_MUTEX(m_am_tools); |
|
2736 status = disassociation_mutex_must_be_reserved( |
|
2737 complete_to_lower_layer, |
|
2738 receive_network_id); |
|
2739 WAUTH_LEAVE_MUTEX(m_am_tools); |
|
2740 |
|
2741 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2742 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2743 } |
|
2744 |
|
2745 //-------------------------------------------------- |
|
2746 |
|
2747 // |
|
2748 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::disassociation( |
2723 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::disassociation( |
2749 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
2724 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
2750 ) |
2725 ) |
2751 { |
2726 { |
2752 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2727 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2753 |
2728 |
2754 EAP_TRACE_DEBUG( |
2729 EAP_TRACE_DEBUG( |
2755 m_am_tools, |
2730 m_am_tools, |
2756 TRACE_FLAGS_DEFAULT, |
2731 TRACE_FLAGS_DEFAULT, |
2757 (EAPL("partner calls: eapol_wlan_authentication_c::disassociation(): %s\n"), |
2732 (EAPL("partner calls: eapol_wlan_authentication_c::disassociation(): %s\n"), |
2758 (m_is_client == true) ? "client": "server")); |
2733 (m_is_client == true) ? "client": "server")); |
2759 |
2734 |
2760 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::disassociation()"); |
2735 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::disassociation()"); |
2761 |
2736 |
2762 eap_status_e status(eap_status_ok); |
2737 eap_status_e status(eap_status_ok); |
2763 |
2738 |
2764 status = internal_disassociation( |
2739 WAUTH_ENTER_MUTEX(m_am_tools); |
2765 true, |
2740 status = disassociation_mutex_must_be_reserved(receive_network_id); |
2766 receive_network_id); |
2741 WAUTH_LEAVE_MUTEX(m_am_tools); |
2767 |
2742 |
2768 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2743 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2769 return EAP_STATUS_RETURN(m_am_tools, status); |
2744 return EAP_STATUS_RETURN(m_am_tools, status); |
2770 } |
2745 } |
2771 |
2746 |
3321 } |
3296 } |
3322 |
3297 |
3323 //-------------------------------------------------- |
3298 //-------------------------------------------------- |
3324 |
3299 |
3325 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::check_is_valid_eap_type( |
3300 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::check_is_valid_eap_type( |
3326 const eap_type_value_e /* eap_type */) |
3301 const eap_type_value_e eap_type) |
3327 { |
3302 { |
3328 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3303 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3329 |
3304 |
3330 EAP_TRACE_DEBUG( |
3305 EAP_TRACE_DEBUG( |
3331 m_am_tools, |
3306 m_am_tools, |
3340 m_am_tools, |
3315 m_am_tools, |
3341 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
3316 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
3342 (EAPL("calls: eapol_wlan_authentication_c::check_is_valid_eap_type(): m_am_wauth->check_is_valid_eap_type(): %s.\n"), |
3317 (EAPL("calls: eapol_wlan_authentication_c::check_is_valid_eap_type(): m_am_wauth->check_is_valid_eap_type(): %s.\n"), |
3343 (m_is_client == true) ? "client": "server")); |
3318 (m_is_client == true) ? "client": "server")); |
3344 |
3319 |
3345 #if 0 |
|
3346 |
|
3347 eap_status_e status = m_am_wauth->check_is_valid_eap_type(eap_type); |
3320 eap_status_e status = m_am_wauth->check_is_valid_eap_type(eap_type); |
3348 |
3321 |
3349 #else |
|
3350 |
|
3351 eap_status_e status = eap_status_not_supported; |
|
3352 |
|
3353 #endif |
|
3354 |
|
3355 |
|
3356 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3322 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3357 return EAP_STATUS_RETURN(m_am_tools, status); |
3323 return EAP_STATUS_RETURN(m_am_tools, status); |
3358 } |
3324 } |
3359 |
3325 |
3360 //-------------------------------------------------- |
3326 //-------------------------------------------------- |
3361 |
3327 |
3362 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::get_eap_type_list( |
3328 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::get_eap_type_list( |
3363 eap_array_c<eap_type_value_e> * const /* eap_type_list */) |
3329 eap_array_c<eap_type_value_e> * const eap_type_list) |
3364 { |
3330 { |
3365 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3331 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3366 |
3332 |
3367 EAP_TRACE_DEBUG( |
3333 EAP_TRACE_DEBUG( |
3368 m_am_tools, |
3334 m_am_tools, |
3375 m_am_tools, |
3341 m_am_tools, |
3376 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
3342 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
3377 (EAPL("calls: eapol_wlan_authentication_c::get_eap_type_list(): m_am_wauth->get_eap_type_list(): %s.\n"), |
3343 (EAPL("calls: eapol_wlan_authentication_c::get_eap_type_list(): m_am_wauth->get_eap_type_list(): %s.\n"), |
3378 (m_is_client == true) ? "client": "server")); |
3344 (m_is_client == true) ? "client": "server")); |
3379 |
3345 |
3380 #if 0 |
|
3381 |
|
3382 eap_status_e status = m_am_wauth->get_eap_type_list(eap_type_list); |
3346 eap_status_e status = m_am_wauth->get_eap_type_list(eap_type_list); |
3383 |
|
3384 #else |
|
3385 |
|
3386 eap_status_e status = eap_status_not_supported; |
|
3387 |
|
3388 #endif |
|
3389 |
3347 |
3390 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3348 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3391 return EAP_STATUS_RETURN(m_am_tools, status); |
3349 return EAP_STATUS_RETURN(m_am_tools, status); |
3392 } |
3350 } |
3393 |
3351 |
3394 //-------------------------------------------------- |
3352 //-------------------------------------------------- |
3395 |
3353 |
3396 eap_status_e eapol_wlan_authentication_c::eapol_indication( |
3354 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::eapol_indication( |
3397 const eap_am_network_id_c * const receive_network_id, ///< source includes remote address, destination includes local address. |
3355 const eap_am_network_id_c * const receive_network_id, ///< source includes remote address, destination includes local address. |
3398 const eapol_wlan_authentication_state_e wlan_authentication_state) |
3356 const eapol_wlan_authentication_state_e wlan_authentication_state) |
3399 { |
3357 { |
3400 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3358 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3401 |
3359 |
3415 // Here we swap the addresses. |
3373 // Here we swap the addresses. |
3416 eap_am_network_id_c tmp_network_id(m_am_tools, |
3374 eap_am_network_id_c tmp_network_id(m_am_tools, |
3417 receive_network_id->get_destination_id(), |
3375 receive_network_id->get_destination_id(), |
3418 receive_network_id->get_source_id(), |
3376 receive_network_id->get_source_id(), |
3419 receive_network_id->get_type()); |
3377 receive_network_id->get_type()); |
3420 |
|
3421 status = send_network_id.set_copy_of_network_id(&tmp_network_id); |
|
3422 if (status != eap_status_ok) |
|
3423 { |
|
3424 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
3425 return EAP_STATUS_RETURN(m_am_tools, status); |
|
3426 } |
|
3427 } |
|
3428 else |
|
3429 { |
|
3430 const u8_t no_address[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}; |
|
3431 |
|
3432 eap_am_network_id_c tmp_network_id( |
|
3433 m_am_tools, |
|
3434 no_address, |
|
3435 sizeof(no_address), |
|
3436 no_address, |
|
3437 sizeof(no_address), |
|
3438 eapol_ethernet_type_pae, |
|
3439 false, |
|
3440 false); |
|
3441 |
3378 |
3442 status = send_network_id.set_copy_of_network_id(&tmp_network_id); |
3379 status = send_network_id.set_copy_of_network_id(&tmp_network_id); |
3443 if (status != eap_status_ok) |
3380 if (status != eap_status_ok) |
3444 { |
3381 { |
3445 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3382 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3498 return EAP_STATUS_RETURN(m_am_tools, status); |
3435 return EAP_STATUS_RETURN(m_am_tools, status); |
3499 } |
3436 } |
3500 |
3437 |
3501 //-------------------------------------------------- |
3438 //-------------------------------------------------- |
3502 |
3439 |
3503 eap_status_e eapol_wlan_authentication_c::create_upper_stack() |
3440 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::create_upper_stack() |
3504 { |
3441 { |
3505 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3442 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3506 |
3443 |
3507 EAP_TRACE_DEBUG( |
3444 EAP_TRACE_DEBUG( |
3508 m_am_tools, |
3445 m_am_tools, |
3955 credential->get_MAC_address()->get_data(), |
3892 credential->get_MAC_address()->get_data(), |
3956 credential->get_MAC_address()->get_data_length())); |
3893 credential->get_MAC_address()->get_data_length())); |
3957 } |
3894 } |
3958 } |
3895 } |
3959 |
3896 |
3960 if (new_password != 0) |
3897 EAP_TRACE_DATA_DEBUG( |
3961 { |
3898 m_am_tools, |
3962 EAP_TRACE_DATA_DEBUG( |
3899 TRACE_FLAGS_DEFAULT, |
3963 m_am_tools, |
3900 (EAPL("SIMPLE_CONFIG: new_password"), |
3964 TRACE_FLAGS_DEFAULT, |
3901 new_password->get_data(), |
3965 (EAPL("SIMPLE_CONFIG: new_password"), |
3902 new_password->get_data_length())); |
3966 new_password->get_data(), |
|
3967 new_password->get_data_length())); |
|
3968 } |
|
3969 |
3903 |
3970 EAP_TRACE_DEBUG( |
3904 EAP_TRACE_DEBUG( |
3971 m_am_tools, |
3905 m_am_tools, |
3972 TRACE_FLAGS_DEFAULT, |
3906 TRACE_FLAGS_DEFAULT, |
3973 (EAPL("SIMPLE_CONFIG: Device_Password_ID=%d\n"), |
3907 (EAPL("SIMPLE_CONFIG: Device_Password_ID=%d\n"), |
3997 return EAP_STATUS_RETURN(m_am_tools, status); |
3931 return EAP_STATUS_RETURN(m_am_tools, status); |
3998 } |
3932 } |
3999 |
3933 |
4000 #endif // #if defined(USE_EAP_SIMPLE_CONFIG) |
3934 #endif // #if defined(USE_EAP_SIMPLE_CONFIG) |
4001 |
3935 |
4002 //-------------------------------------------------- |
3936 //-------------------------------------------------- |
4003 |
3937 |
4004 eap_status_e eapol_wlan_authentication_c::complete_check_pmksa_cache( |
|
4005 EAP_TEMPLATE_CONST eap_array_c<eap_am_network_id_c> * const bssid_sta_receive_network_ids) |
|
4006 { |
|
4007 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4008 |
|
4009 EAP_TRACE_DEBUG( |
|
4010 m_am_tools, |
|
4011 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
4012 (EAPL("calls partner: eapol_wlan_authentication_c::complete_check_pmksa_cache(): %s: m_partner->complete_check_pmksa_cache().\n"), |
|
4013 (m_is_client == true) ? "client": "server")); |
|
4014 |
|
4015 const eap_status_e status = m_partner->complete_check_pmksa_cache( |
|
4016 bssid_sta_receive_network_ids); |
|
4017 |
|
4018 EAP_TRACE_DEBUG( |
|
4019 m_am_tools, |
|
4020 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
4021 (EAPL("returns from partner: eapol_wlan_authentication_c::complete_check_pmksa_cache(): %s: m_partner->complete_check_pmksa_cache(): status = %s\n"), |
|
4022 (m_is_client == true) ? "client": "server", |
|
4023 eap_status_string_c::get_status_string(status))); |
|
4024 |
|
4025 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4026 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4027 } |
|
4028 |
|
4029 //-------------------------------------------------- |
|
4030 |
|
4031 // |
|
4032 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::complete_get_802_11_authentication_mode( |
|
4033 const eap_status_e completion_status, |
|
4034 const eap_am_network_id_c * const /* receive_network_id */, |
|
4035 const eapol_key_802_11_authentication_mode_e mode) |
|
4036 { |
|
4037 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4038 |
|
4039 EAP_TRACE_DEBUG( |
|
4040 m_am_tools, |
|
4041 TRACE_FLAGS_DEFAULT, |
|
4042 (EAPL("eapol calls: eapol_wlan_authentication_c::complete_get_802_11_authentication_mode(): completion_status=%d=%s, mode=%d\n"), |
|
4043 completion_status, |
|
4044 eap_status_string_c::get_status_string(completion_status), |
|
4045 mode)); |
|
4046 |
|
4047 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to eapol: eapol_wlan_authentication_c::complete_get_802_11_authentication_mode()"); |
|
4048 |
|
4049 eap_status_e status(eap_status_ok); |
|
4050 |
|
4051 if (completion_status != eap_status_ok |
|
4052 || mode == eapol_key_802_11_authentication_mode_none) |
|
4053 { |
|
4054 EAP_TRACE_ALWAYS( |
|
4055 m_am_tools, |
|
4056 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
4057 (EAPL("No enabled EAP types.\n"))); |
|
4058 EAP_TRACE_ALWAYS( |
|
4059 m_am_tools, |
|
4060 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
4061 (EAPL("Indication sent to WLM: eap_status_failed_completely.\n"))); |
|
4062 |
|
4063 (void) internal_disassociation(false, 0); // Note we have no addresses yet. |
|
4064 |
|
4065 status = eapol_indication( |
|
4066 0, // Note we have no addresses yet. |
|
4067 eapol_wlan_authentication_state_failed_completely); |
|
4068 if (status != eap_status_ok) |
|
4069 { |
|
4070 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4071 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4072 } |
|
4073 |
|
4074 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4075 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
4076 } |
|
4077 |
|
4078 m_802_11_authentication_mode = mode; |
|
4079 |
|
4080 EAP_TRACE_DEBUG( |
|
4081 m_am_tools, |
|
4082 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
4083 (EAPL("calls partner: eapol_wlan_authentication_c::complete_get_802_11_authentication_mode(): m_partner->associate(%d).\n"), |
|
4084 m_802_11_authentication_mode)); |
|
4085 |
|
4086 status = m_partner->associate(m_802_11_authentication_mode); |
|
4087 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
4088 |
|
4089 EAP_TRACE_DEBUG( |
|
4090 m_am_tools, |
|
4091 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
4092 (EAPL("returns from partner: eapol_wlan_authentication_c::complete_get_802_11_authentication_mode(): %s: m_partner->associate(): status = %s\n"), |
|
4093 (m_is_client == true) ? "client": "server", |
|
4094 eap_status_string_c::get_status_string(status))); |
|
4095 |
|
4096 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4097 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4098 } |
|
4099 |
|
4100 //-------------------------------------------------- |
|
4101 |
|
4102 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::complete_disassociation( |
|
4103 const bool complete_to_lower_layer, |
|
4104 const eap_am_network_id_c * const receive_network_id) |
|
4105 { |
|
4106 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4107 |
|
4108 EAP_TRACE_DEBUG( |
|
4109 m_am_tools, |
|
4110 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
4111 (EAPL("eapol calls: eapol_wlan_authentication_c::complete_disassociation(): %s: m_partner->complete_disassociation(), complete_to_lower_layer=%s.\n"), |
|
4112 (m_is_client == true) ? "client": "server", |
|
4113 (complete_to_lower_layer == true) ? "true": "false")); |
|
4114 |
|
4115 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to eapol: eapol_wlan_authentication_c::complete_disassociation()"); |
|
4116 |
|
4117 eap_status_e status(eap_status_ok); |
|
4118 |
|
4119 if (complete_to_lower_layer == true) |
|
4120 { |
|
4121 EAP_TRACE_DEBUG( |
|
4122 m_am_tools, |
|
4123 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
4124 (EAPL("calls partner: eapol_wlan_authentication_c::complete_disassociation(): %s: m_partner->complete_disassociation(), complete_to_lower_layer=%s.\n"), |
|
4125 (m_is_client == true) ? "client": "server", |
|
4126 (complete_to_lower_layer == true) ? "true": "false")); |
|
4127 |
|
4128 status = m_partner->complete_disassociation( |
|
4129 receive_network_id); |
|
4130 |
|
4131 EAP_TRACE_DEBUG( |
|
4132 m_am_tools, |
|
4133 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
4134 (EAPL("returns from partner: eapol_wlan_authentication_c::complete_disassociation(): %s: m_partner->complete_disassociation(): status = %s\n"), |
|
4135 (m_is_client == true) ? "client": "server", |
|
4136 eap_status_string_c::get_status_string(status))); |
|
4137 } |
|
4138 |
|
4139 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
4140 return EAP_STATUS_RETURN(m_am_tools, status); |
|
4141 } |
|
4142 |
|
4143 //-------------------------------------------------- |
|
4144 // End of file |
3938 // End of file |