156 const bool is_client_when_true) |
155 const bool is_client_when_true) |
157 : m_partner(partner) |
156 : m_partner(partner) |
158 , m_am_wauth(am_wauth) |
157 , m_am_wauth(am_wauth) |
159 , m_ethernet_core(0) |
158 , m_ethernet_core(0) |
160 , m_am_tools(tools) |
159 , m_am_tools(tools) |
161 , m_selected_eap_types(tools) |
160 //, m_selected_eap_types(tools) |
162 , m_wpa_preshared_key_hash(tools) |
161 , m_wpa_preshared_key_hash(tools) |
163 , m_authentication_type(eapol_key_authentication_type_none) |
162 , m_authentication_type(eapol_key_authentication_type_none) |
164 , m_802_11_authentication_mode(eapol_key_802_11_authentication_mode_none) |
163 , m_802_11_authentication_mode(eapol_key_802_11_authentication_mode_none) |
165 , m_received_WPA_IE(tools) // WLM must give only the WPA IE to EAPOL |
164 , m_received_WPA_IE(tools) // WLM must give only the WPA IE to EAPOL |
166 , m_sent_WPA_IE(tools) |
165 , m_sent_WPA_IE(tools) |
397 |
396 |
398 // |
397 // |
399 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::start_authentication( |
398 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::start_authentication( |
400 const eap_variable_data_c * const SSID, |
399 const eap_variable_data_c * const SSID, |
401 const eapol_key_authentication_type_e selected_eapol_key_authentication_type, |
400 const eapol_key_authentication_type_e selected_eapol_key_authentication_type, |
402 const eap_variable_data_c * const wpa_preshared_key, |
401 const eap_variable_data_c * const preshared_key, // This does include WPA pre-shared key or WPS PIN. |
403 const bool WPA_override_enabled |
402 const bool WPA_override_enabled, |
404 #if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
405 , |
|
406 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
403 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) |
|
408 ) |
404 ) |
409 { |
405 { |
410 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
406 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
411 |
407 |
412 EAP_TRACE_DEBUG( |
408 EAP_TRACE_DEBUG( |
498 return EAP_STATUS_RETURN(m_am_tools, status); |
489 return EAP_STATUS_RETURN(m_am_tools, status); |
499 } |
490 } |
500 |
491 |
501 // Start new authentication from scratch. |
492 // Start new authentication from scratch. |
502 |
493 |
|
494 WAUTH_ENTER_MUTEX(m_am_tools); |
|
495 EAP_TRACE_DEBUG( |
|
496 m_am_tools, |
|
497 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
498 (EAPL("calls eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->create_state(): %s.\n"), |
|
499 (m_is_client == true) ? "client": "server")); |
|
500 status = m_ethernet_core->create_state( |
|
501 receive_network_id, |
|
502 m_authentication_type |
|
503 ); |
|
504 EAP_TRACE_DEBUG( |
|
505 m_am_tools, |
|
506 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"), |
|
508 (m_is_client == true) ? "client": "server", |
|
509 eap_status_string_c::get_status_string(status))); |
|
510 WAUTH_LEAVE_MUTEX(m_am_tools); |
|
511 if (status != eap_status_ok) |
|
512 { |
|
513 return EAP_STATUS_RETURN(m_am_tools, status); |
|
514 } |
|
515 |
503 if (m_authentication_type == eapol_key_authentication_type_RSNA_PSK |
516 if (m_authentication_type == eapol_key_authentication_type_RSNA_PSK |
504 || m_authentication_type == eapol_key_authentication_type_WPA_PSK) |
517 || m_authentication_type == eapol_key_authentication_type_WPA_PSK) |
505 { |
518 { |
506 // WPA Pre-shared key mode |
519 // WPA Pre-shared key mode |
507 m_802_11_authentication_mode = eapol_key_802_11_authentication_mode_open; |
520 m_802_11_authentication_mode = eapol_key_802_11_authentication_mode_open; |
518 EAP_TRACE_ALWAYS( |
531 EAP_TRACE_ALWAYS( |
519 m_am_tools, |
532 m_am_tools, |
520 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
533 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
521 (EAPL("start_authentication(): Trying auth mode OPEN and WPA-PSK.\n"))); |
534 (EAPL("start_authentication(): Trying auth mode OPEN and WPA-PSK.\n"))); |
522 } |
535 } |
523 } |
536 |
524 else //if (wpa_preshared_key == 0 |
537 status = complete_get_802_11_authentication_mode( |
525 //|| wpa_preshared_key->get_is_valid_data() == false |
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 |
526 //|| WPA_override_enabled == false) |
544 //|| WPA_override_enabled == false) |
527 { |
545 { |
528 // Check the first enabled type |
546 WAUTH_ENTER_MUTEX(m_am_tools); |
529 eap_type_selection_c * eap_type = 0; |
547 EAP_TRACE_DEBUG( |
530 u32_t ind_type = 0ul; |
548 m_am_tools, |
531 |
549 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
532 for (ind_type = 0; ind_type < m_selected_eap_types.get_object_count(); ind_type++) |
550 (EAPL("calls eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->get_802_11_authentication_mode(): %s.\n"), |
533 { |
551 (m_is_client == true) ? "client": "server")); |
534 // Check if type is enabled |
552 status = m_ethernet_core->get_802_11_authentication_mode( |
535 eap_type = m_selected_eap_types.get_object(ind_type); |
553 receive_network_id, |
536 |
554 m_authentication_type, |
537 if (eap_type->get_is_enabled() == true) |
555 SSID, |
538 { |
556 preshared_key); |
539 break; |
557 EAP_TRACE_DEBUG( |
540 } |
558 m_am_tools, |
541 } |
559 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
542 |
560 (EAPL("returns from eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->get_802_11_authentication_mode(): %s, status = %s.\n"), |
543 if (ind_type >= m_selected_eap_types.get_object_count()) |
561 (m_is_client == true) ? "client": "server", |
544 { |
562 eap_status_string_c::get_status_string(status))); |
545 // No enabled EAP types. |
563 WAUTH_LEAVE_MUTEX(m_am_tools); |
546 EAP_TRACE_ALWAYS( |
564 if (status != eap_status_ok) |
547 m_am_tools, |
565 { |
548 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
566 return EAP_STATUS_RETURN(m_am_tools, status); |
549 (EAPL("No enabled EAP types.\n"))); |
567 } |
550 EAP_TRACE_ALWAYS( |
568 } |
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) |
|
609 WAUTH_ENTER_MUTEX(m_am_tools); |
|
610 EAP_TRACE_DEBUG( |
|
611 m_am_tools, |
|
612 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
613 (EAPL("calls eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->create_state(): %s.\n"), |
|
614 (m_is_client == true) ? "client": "server")); |
|
615 status = m_ethernet_core->create_state( |
|
616 receive_network_id, |
|
617 selected_eapol_key_authentication_type |
|
618 ); |
|
619 EAP_TRACE_DEBUG( |
|
620 m_am_tools, |
|
621 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
622 (EAPL("returns from eapol: eapol_wlan_authentication_c::start_authentication(): m_ethernet_core->create_state(): %s, status = %s.\n"), |
|
623 (m_is_client == true) ? "client": "server", |
|
624 eap_status_string_c::get_status_string(status))); |
|
625 WAUTH_LEAVE_MUTEX(m_am_tools); |
|
626 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
627 |
|
628 |
|
629 EAP_TRACE_DEBUG( |
|
630 m_am_tools, |
|
631 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
632 (EAPL("calls partner: eapol_wlan_authentication_c::start_authentication(): m_partner->associate(%d).\n"), |
|
633 m_802_11_authentication_mode)); |
|
634 |
|
635 status = m_partner->associate(m_802_11_authentication_mode); |
|
636 (void)EAP_STATUS_RETURN(m_am_tools, status); |
|
637 |
|
638 EAP_TRACE_DEBUG( |
|
639 m_am_tools, |
|
640 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
641 (EAPL("returns from partner: eapol_wlan_authentication_c::start_authentication(): %s: m_partner->associate(): status = %s\n"), |
|
642 (m_is_client == true) ? "client": "server", |
|
643 eap_status_string_c::get_status_string(status))); |
|
644 |
569 |
645 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
570 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
646 return EAP_STATUS_RETURN(m_am_tools, status); |
571 return EAP_STATUS_RETURN(m_am_tools, status); |
647 } |
572 } |
648 |
573 |
1208 (EAPL("partner calls: eapol_wlan_authentication_c::packet_process(): %s\n"), |
1134 (EAPL("partner calls: eapol_wlan_authentication_c::packet_process(): %s\n"), |
1209 (m_is_client == true) ? "client": "server")); |
1135 (m_is_client == true) ? "client": "server")); |
1210 |
1136 |
1211 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::packet_process()"); |
1137 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::packet_process()"); |
1212 |
1138 |
|
1139 #if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
|
1140 |
1213 if (packet_length < eapol_ethernet_header_wr_c::get_header_length()) |
1141 if (packet_length < eapol_ethernet_header_wr_c::get_header_length()) |
1214 { |
1142 { |
1215 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1143 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
1216 return EAP_STATUS_RETURN(m_am_tools, eap_status_too_short_message); |
1144 return EAP_STATUS_RETURN(m_am_tools, eap_status_too_short_message); |
1217 } |
1145 } |
1218 |
1146 |
|
1147 #endif //#if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
|
1148 |
1219 eapol_ethernet_header_wr_c eth_header( |
1149 eapol_ethernet_header_wr_c eth_header( |
1220 m_am_tools, |
1150 m_am_tools, |
1221 packet_data->get_header_buffer(packet_length), |
1151 packet_data->get_header_buffer(packet_length), |
1222 packet_length); |
1152 packet_length); |
1223 |
1153 |
1224 eap_status_e status(eap_status_process_general_error); |
1154 eap_status_e status(eap_status_process_general_error); |
1225 |
1155 |
|
1156 #if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
1226 if (eth_header.get_type() == eapol_ethernet_type_pae |
1157 if (eth_header.get_type() == eapol_ethernet_type_pae |
1227 || eth_header.get_type() == eapol_ethernet_type_preauthentication) |
1158 || eth_header.get_type() == eapol_ethernet_type_preauthentication) |
|
1159 #endif //#if !defined(EAPOL_SKIP_ETHERNET_HEADER) |
|
1160 |
1228 { |
1161 { |
1229 // Forward the packet to the Ethernet layer of the EAPOL stack. |
1162 // Forward the packet to the Ethernet layer of the EAPOL stack. |
1230 // Ignore return value. Failure is signalled using state_notification. |
1163 // Ignore return value. Failure is signalled using state_notification. |
1231 WAUTH_ENTER_MUTEX(m_am_tools); |
1164 WAUTH_ENTER_MUTEX(m_am_tools); |
1232 EAP_TRACE_DEBUG( |
1165 EAP_TRACE_DEBUG( |
1865 eap_header_string_c eap_string; |
1800 eap_header_string_c eap_string; |
1866 |
1801 |
1867 EAP_TRACE_DEBUG( |
1802 EAP_TRACE_DEBUG( |
1868 m_am_tools, |
1803 m_am_tools, |
1869 TRACE_FLAGS_DEFAULT, |
1804 TRACE_FLAGS_DEFAULT, |
1870 (EAPL("eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0x%08x=%s\n"), |
1805 (EAPL("eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0xfe%06x%08x=%s\n"), |
1871 (state->get_is_client() == true ? "client": "server"), |
1806 (state->get_is_client() == true ? "client": "server"), |
1872 state->get_protocol_layer(), |
1807 state->get_protocol_layer(), |
1873 state->get_protocol_layer_string(), |
1808 state->get_protocol_layer_string(), |
1874 state->get_protocol(), |
1809 state->get_protocol(), |
1875 state->get_protocol_string(), |
1810 state->get_protocol_string(), |
1876 convert_eap_type_to_u32_t(state->get_eap_type()), |
1811 state->get_eap_type().get_vendor_id(), |
1877 eap_string.get_eap_type_string(state->get_eap_type()))); |
1812 state->get_eap_type().get_vendor_type(), |
|
1813 eap_header_string_c::get_eap_type_string(state->get_eap_type()))); |
1878 |
1814 |
1879 EAP_TRACE_DEBUG( |
1815 EAP_TRACE_DEBUG( |
1880 m_am_tools, |
1816 m_am_tools, |
1881 TRACE_FLAGS_DEFAULT, |
1817 TRACE_FLAGS_DEFAULT, |
1882 (EAPL("eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
1818 (EAPL("eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
1885 state->get_current_state_string(), |
1821 state->get_current_state_string(), |
1886 state->get_authentication_error(), |
1822 state->get_authentication_error(), |
1887 status_string.get_status_string(state->get_authentication_error()))); |
1823 status_string.get_status_string(state->get_authentication_error()))); |
1888 } |
1824 } |
1889 |
1825 |
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) |
|
1910 |
1826 |
1911 if(state->get_protocol_layer() == eap_protocol_layer_general) |
1827 if(state->get_protocol_layer() == eap_protocol_layer_general) |
1912 { |
1828 { |
1913 if (state->get_current_state() == eap_general_state_authentication_cancelled) |
1829 if (state->get_current_state() == eap_general_state_authentication_cancelled) |
1914 { |
1830 { |
1957 eap_header_string_c eap_string; |
1873 eap_header_string_c eap_string; |
1958 |
1874 |
1959 EAP_TRACE_ERROR( |
1875 EAP_TRACE_ERROR( |
1960 m_am_tools, |
1876 m_am_tools, |
1961 TRACE_FLAGS_DEFAULT, |
1877 TRACE_FLAGS_DEFAULT, |
1962 (EAPL("ERROR: eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0x%08x=%s\n"), |
1878 (EAPL("ERROR: eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0xfe%06x%08x=%s\n"), |
1963 (state->get_is_client() == true ? "client": "server"), |
1879 (state->get_is_client() == true ? "client": "server"), |
1964 state->get_protocol_layer(), |
1880 state->get_protocol_layer(), |
1965 state->get_protocol_layer_string(), |
1881 state->get_protocol_layer_string(), |
1966 state->get_protocol(), |
1882 state->get_protocol(), |
1967 state->get_protocol_string(), |
1883 state->get_protocol_string(), |
1968 convert_eap_type_to_u32_t(state->get_eap_type()), |
1884 state->get_eap_type().get_vendor_id(), |
1969 eap_string.get_eap_type_string(state->get_eap_type()))); |
1885 state->get_eap_type().get_vendor_type(), |
|
1886 eap_header_string_c::get_eap_type_string(state->get_eap_type()))); |
1970 |
1887 |
1971 EAP_TRACE_ERROR( |
1888 EAP_TRACE_ERROR( |
1972 m_am_tools, |
1889 m_am_tools, |
1973 TRACE_FLAGS_DEFAULT, |
1890 TRACE_FLAGS_DEFAULT, |
1974 (EAPL("ERROR: eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
1891 (EAPL("ERROR: eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
2019 eap_header_string_c eap_string; |
1933 eap_header_string_c eap_string; |
2020 |
1934 |
2021 EAP_TRACE_DEBUG( |
1935 EAP_TRACE_DEBUG( |
2022 m_am_tools, |
1936 m_am_tools, |
2023 TRACE_FLAGS_DEFAULT, |
1937 TRACE_FLAGS_DEFAULT, |
2024 (EAPL("eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0x%08x=%s\n"), |
1938 (EAPL("eapol_wlan_authentication_c::state_notification() %s: protocol layer %d=%s, protocol %d=%s, EAP-type 0xfe%06x%08x=%s\n"), |
2025 (state->get_is_client() == true ? "client": "server"), |
1939 (state->get_is_client() == true ? "client": "server"), |
2026 state->get_protocol_layer(), |
1940 state->get_protocol_layer(), |
2027 state->get_protocol_layer_string(), |
1941 state->get_protocol_layer_string(), |
2028 state->get_protocol(), |
1942 state->get_protocol(), |
2029 state->get_protocol_string(), |
1943 state->get_protocol_string(), |
2030 convert_eap_type_to_u32_t(state->get_eap_type()), |
1944 state->get_eap_type().get_vendor_id(), |
2031 eap_string.get_eap_type_string(state->get_eap_type()))); |
1945 state->get_eap_type().get_vendor_type(), |
|
1946 eap_header_string_c::get_eap_type_string(state->get_eap_type()))); |
2032 |
1947 |
2033 EAP_TRACE_DEBUG( |
1948 EAP_TRACE_DEBUG( |
2034 m_am_tools, |
1949 m_am_tools, |
2035 TRACE_FLAGS_DEFAULT, |
1950 TRACE_FLAGS_DEFAULT, |
2036 (EAPL("eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
1951 (EAPL("eapol_wlan_authentication_c::state_notification() %s: current state %d=%s, error %d=%s\n"), |
2095 m_am_tools, |
2008 m_am_tools, |
2096 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2009 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2097 (EAPL("returns from partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2010 (EAPL("returns from partner: eapol_wlan_authentication_c::state_notification(): %s: m_partner->state_notification()\n"), |
2098 (m_is_client == true) ? "client": "server")); |
2011 (m_is_client == true) ? "client": "server")); |
2099 |
2012 |
2100 #endif //#if defined(USE_EAPOL_KEY_STATE_OPTIMIZED_4_WAY_HANDSHAKE) |
|
2101 |
|
2102 m_am_wauth->authentication_finished( |
2013 m_am_wauth->authentication_finished( |
2103 true, |
2014 true, |
2104 state->get_eap_type(), |
2015 state->get_eap_type(), |
2105 m_authentication_type); |
2016 m_authentication_type); |
2106 |
2017 |
2107 #if defined(USE_EAP_EXPANDED_TYPES) |
|
2108 if (state->get_eap_type() == eap_expanded_type_simple_config.get_type()) |
2018 if (state->get_eap_type() == eap_expanded_type_simple_config.get_type()) |
2109 { |
2019 { |
2110 increment_authentication_counter(); |
2020 increment_authentication_counter(); |
2111 m_successful_authentications++; |
2021 m_successful_authentications++; |
2112 |
2022 |
2585 eap_status_e status = m_ethernet_core->eap_acknowledge(receive_network_id); |
2499 eap_status_e status = m_ethernet_core->eap_acknowledge(receive_network_id); |
2586 EAP_TRACE_DEBUG( |
2500 EAP_TRACE_DEBUG( |
2587 m_am_tools, |
2501 m_am_tools, |
2588 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2502 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2589 (EAPL("returns from eapol: eapol_wlan_authentication_c::eap_acknowledge(): m_ethernet_core->eap_acknowledge(): %s, status = %s.\n"), |
2503 (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"), |
2590 (m_is_client == true) ? "client": "server", |
2566 (m_is_client == true) ? "client": "server", |
2591 eap_status_string_c::get_status_string(status))); |
2567 eap_status_string_c::get_status_string(status))); |
2592 WAUTH_LEAVE_MUTEX(m_am_tools); |
2568 WAUTH_LEAVE_MUTEX(m_am_tools); |
2593 |
2569 |
2594 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2570 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2625 EAP_TRACE_DEBUG( |
2607 EAP_TRACE_DEBUG( |
2626 m_am_tools, |
2608 m_am_tools, |
2627 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2609 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
2628 (EAPL("calls: eapol_wlan_authentication_c::load_module(): m_am_wauth->load_module(): %s.\n"), |
2610 (EAPL("calls: eapol_wlan_authentication_c::load_module(): m_am_wauth->load_module(): %s.\n"), |
2629 (m_is_client == true) ? "client": "server")); |
2611 (m_is_client == true) ? "client": "server")); |
|
2612 |
|
2613 #if 0 |
2630 |
2614 |
2631 eap_status_e status = m_am_wauth->load_module( |
2615 eap_status_e status = m_am_wauth->load_module( |
2632 type, |
2616 type, |
2633 tunneling_type, |
2617 tunneling_type, |
2634 partner, |
2618 partner, |
2635 eap_type_if, |
2619 eap_type_if, |
2636 is_client_when_true, |
2620 is_client_when_true, |
2637 receive_network_id); |
2621 receive_network_id); |
2638 |
2622 |
|
2623 #else |
|
2624 |
|
2625 eap_status_e status = eap_status_not_supported; |
|
2626 |
|
2627 #endif |
|
2628 |
2639 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2629 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2640 return EAP_STATUS_RETURN(m_am_tools, status); |
2630 return EAP_STATUS_RETURN(m_am_tools, status); |
2641 } |
2631 } |
2642 |
2632 |
2643 //-------------------------------------------------- |
2633 //-------------------------------------------------- |
2644 |
2634 |
2645 // |
2635 // |
2646 eap_status_e eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved( |
2636 eap_status_e eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved( |
|
2637 const bool complete_to_lower_layer, |
2647 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
2638 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
2648 ) |
2639 ) |
2649 { |
2640 { |
2650 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2641 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2651 |
2642 |
2652 EAP_TRACE_DEBUG( |
2643 EAP_TRACE_DEBUG( |
2653 m_am_tools, |
2644 m_am_tools, |
2654 TRACE_FLAGS_DEFAULT, |
2645 TRACE_FLAGS_DEFAULT, |
2655 (EAPL("eapol calls: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved(): %s\n"), |
2646 (EAPL("eapol calls: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved(): %s, complete_to_lower_layer=%s\n"), |
2656 (m_is_client == true) ? "client": "server")); |
2647 (m_is_client == true) ? "client": "server", |
|
2648 (complete_to_lower_layer == true) ? "true": "false")); |
2657 |
2649 |
2658 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to eapol: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved()"); |
2650 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to eapol: eapol_wlan_authentication_c::disassociation_mutex_must_be_reserved()"); |
2659 |
2651 |
2660 // reset index |
2652 // reset index |
2661 m_current_eap_index = 0UL; |
2653 m_current_eap_index = 0UL; |
2718 } |
2712 } |
2719 |
2713 |
2720 //-------------------------------------------------- |
2714 //-------------------------------------------------- |
2721 |
2715 |
2722 // |
2716 // |
|
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 // |
2723 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::disassociation( |
2748 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::disassociation( |
2724 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
2749 const eap_am_network_id_c * const receive_network_id ///< source includes remote address, destination includes local address. |
2725 ) |
2750 ) |
2726 { |
2751 { |
2727 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2752 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
2728 |
2753 |
2729 EAP_TRACE_DEBUG( |
2754 EAP_TRACE_DEBUG( |
2730 m_am_tools, |
2755 m_am_tools, |
2731 TRACE_FLAGS_DEFAULT, |
2756 TRACE_FLAGS_DEFAULT, |
2732 (EAPL("partner calls: eapol_wlan_authentication_c::disassociation(): %s\n"), |
2757 (EAPL("partner calls: eapol_wlan_authentication_c::disassociation(): %s\n"), |
2733 (m_is_client == true) ? "client": "server")); |
2758 (m_is_client == true) ? "client": "server")); |
2734 |
2759 |
2735 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::disassociation()"); |
2760 EAP_TRACE_RETURN_STRING(m_am_tools, "returns to partner: eapol_wlan_authentication_c::disassociation()"); |
2736 |
2761 |
2737 eap_status_e status(eap_status_ok); |
2762 eap_status_e status(eap_status_ok); |
2738 |
2763 |
2739 WAUTH_ENTER_MUTEX(m_am_tools); |
2764 status = internal_disassociation( |
2740 status = disassociation_mutex_must_be_reserved(receive_network_id); |
2765 true, |
2741 WAUTH_LEAVE_MUTEX(m_am_tools); |
2766 receive_network_id); |
2742 |
2767 |
2743 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2768 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
2744 return EAP_STATUS_RETURN(m_am_tools, status); |
2769 return EAP_STATUS_RETURN(m_am_tools, status); |
2745 } |
2770 } |
2746 |
2771 |
3315 m_am_tools, |
3340 m_am_tools, |
3316 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
3341 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
3317 (EAPL("calls: eapol_wlan_authentication_c::check_is_valid_eap_type(): m_am_wauth->check_is_valid_eap_type(): %s.\n"), |
3342 (EAPL("calls: eapol_wlan_authentication_c::check_is_valid_eap_type(): m_am_wauth->check_is_valid_eap_type(): %s.\n"), |
3318 (m_is_client == true) ? "client": "server")); |
3343 (m_is_client == true) ? "client": "server")); |
3319 |
3344 |
|
3345 #if 0 |
|
3346 |
3320 eap_status_e status = m_am_wauth->check_is_valid_eap_type(eap_type); |
3347 eap_status_e status = m_am_wauth->check_is_valid_eap_type(eap_type); |
3321 |
3348 |
|
3349 #else |
|
3350 |
|
3351 eap_status_e status = eap_status_not_supported; |
|
3352 |
|
3353 #endif |
|
3354 |
|
3355 |
3322 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3356 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3323 return EAP_STATUS_RETURN(m_am_tools, status); |
3357 return EAP_STATUS_RETURN(m_am_tools, status); |
3324 } |
3358 } |
3325 |
3359 |
3326 //-------------------------------------------------- |
3360 //-------------------------------------------------- |
3327 |
3361 |
3328 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::get_eap_type_list( |
3362 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::get_eap_type_list( |
3329 eap_array_c<eap_type_value_e> * const eap_type_list) |
3363 eap_array_c<eap_type_value_e> * const /* eap_type_list */) |
3330 { |
3364 { |
3331 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3365 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3332 |
3366 |
3333 EAP_TRACE_DEBUG( |
3367 EAP_TRACE_DEBUG( |
3334 m_am_tools, |
3368 m_am_tools, |
3341 m_am_tools, |
3375 m_am_tools, |
3342 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
3376 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
3343 (EAPL("calls: eapol_wlan_authentication_c::get_eap_type_list(): m_am_wauth->get_eap_type_list(): %s.\n"), |
3377 (EAPL("calls: eapol_wlan_authentication_c::get_eap_type_list(): m_am_wauth->get_eap_type_list(): %s.\n"), |
3344 (m_is_client == true) ? "client": "server")); |
3378 (m_is_client == true) ? "client": "server")); |
3345 |
3379 |
|
3380 #if 0 |
|
3381 |
3346 eap_status_e status = m_am_wauth->get_eap_type_list(eap_type_list); |
3382 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 |
3347 |
3389 |
3348 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3390 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3349 return EAP_STATUS_RETURN(m_am_tools, status); |
3391 return EAP_STATUS_RETURN(m_am_tools, status); |
3350 } |
3392 } |
3351 |
3393 |
3352 //-------------------------------------------------- |
3394 //-------------------------------------------------- |
3353 |
3395 |
3354 EAP_FUNC_EXPORT eap_status_e eapol_wlan_authentication_c::eapol_indication( |
3396 eap_status_e eapol_wlan_authentication_c::eapol_indication( |
3355 const eap_am_network_id_c * const receive_network_id, ///< source includes remote address, destination includes local address. |
3397 const eap_am_network_id_c * const receive_network_id, ///< source includes remote address, destination includes local address. |
3356 const eapol_wlan_authentication_state_e wlan_authentication_state) |
3398 const eapol_wlan_authentication_state_e wlan_authentication_state) |
3357 { |
3399 { |
3358 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3400 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
3359 |
3401 |
3373 // Here we swap the addresses. |
3415 // Here we swap the addresses. |
3374 eap_am_network_id_c tmp_network_id(m_am_tools, |
3416 eap_am_network_id_c tmp_network_id(m_am_tools, |
3375 receive_network_id->get_destination_id(), |
3417 receive_network_id->get_destination_id(), |
3376 receive_network_id->get_source_id(), |
3418 receive_network_id->get_source_id(), |
3377 receive_network_id->get_type()); |
3419 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); |
3378 |
3441 |
3379 status = send_network_id.set_copy_of_network_id(&tmp_network_id); |
3442 status = send_network_id.set_copy_of_network_id(&tmp_network_id); |
3380 if (status != eap_status_ok) |
3443 if (status != eap_status_ok) |
3381 { |
3444 { |
3382 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3445 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
3892 credential->get_MAC_address()->get_data(), |
3955 credential->get_MAC_address()->get_data(), |
3893 credential->get_MAC_address()->get_data_length())); |
3956 credential->get_MAC_address()->get_data_length())); |
3894 } |
3957 } |
3895 } |
3958 } |
3896 |
3959 |
3897 EAP_TRACE_DATA_DEBUG( |
3960 if (new_password != 0) |
3898 m_am_tools, |
3961 { |
3899 TRACE_FLAGS_DEFAULT, |
3962 EAP_TRACE_DATA_DEBUG( |
3900 (EAPL("SIMPLE_CONFIG: new_password"), |
3963 m_am_tools, |
3901 new_password->get_data(), |
3964 TRACE_FLAGS_DEFAULT, |
3902 new_password->get_data_length())); |
3965 (EAPL("SIMPLE_CONFIG: new_password"), |
|
3966 new_password->get_data(), |
|
3967 new_password->get_data_length())); |
|
3968 } |
3903 |
3969 |
3904 EAP_TRACE_DEBUG( |
3970 EAP_TRACE_DEBUG( |
3905 m_am_tools, |
3971 m_am_tools, |
3906 TRACE_FLAGS_DEFAULT, |
3972 TRACE_FLAGS_DEFAULT, |
3907 (EAPL("SIMPLE_CONFIG: Device_Password_ID=%d\n"), |
3973 (EAPL("SIMPLE_CONFIG: Device_Password_ID=%d\n"), |
3931 return EAP_STATUS_RETURN(m_am_tools, status); |
3997 return EAP_STATUS_RETURN(m_am_tools, status); |
3932 } |
3998 } |
3933 |
3999 |
3934 #endif // #if defined(USE_EAP_SIMPLE_CONFIG) |
4000 #endif // #if defined(USE_EAP_SIMPLE_CONFIG) |
3935 |
4001 |
3936 //-------------------------------------------------- |
4002 //-------------------------------------------------- |
3937 |
4003 |
|
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 //-------------------------------------------------- |
3938 // End of file |
4144 // End of file |