From: Niraj Kumar Goit Date: Wed, 16 Dec 2020 15:41:40 +0000 (+0530) Subject: Fixed Ethernet over EAP enabled status on device reboot. X-Git-Tag: accepted/tizen/unified/20210129.002155^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F249787%2F1;p=platform%2Fcore%2Fapi%2Fconnection.git Fixed Ethernet over EAP enabled status on device reboot. Change-Id: Ia60491d9e2187ad1f5138a0e3477e0634bcb0b82 Signed-off-by: Niraj Kumar Goit --- diff --git a/include/connection_extension.h b/include/connection_extension.h index 4d6038c..bee17ca 100755 --- a/include/connection_extension.h +++ b/include/connection_extension.h @@ -326,6 +326,7 @@ int connection_profile_enable_ethernet_eap(connection_profile_h profile, bool en * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation Failed * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported diff --git a/include/net_connection_private.h b/include/net_connection_private.h index 08f27ea..48ef312 100755 --- a/include/net_connection_private.h +++ b/include/net_connection_private.h @@ -203,7 +203,7 @@ int _connection_libnet_set_cellular_subscriber_id(connection_profile_h profile, connection_cellular_subscriber_id_e sim_id); int _connection_libnet_enable_ethernet_eap(bool enable, const char *profilename); -int _connection_libnet_ethernet_eap_enabled(bool *enabled); +int _connection_libnet_ethernet_eap_enabled(const char *profilename, bool *enabled); int _connection_libnet_profile_save_ethernet_eap_config(connection_handle_s *conn_handle, connection_profile_h profile); diff --git a/packaging/capi-network-connection.spec b/packaging/capi-network-connection.spec index 26d0699..3e31541 100755 --- a/packaging/capi-network-connection.spec +++ b/packaging/capi-network-connection.spec @@ -1,7 +1,7 @@ Name: capi-network-connection Summary: Network Connection library in TIZEN C API Version: 1.0.123 -Release: 1 +Release: 2 Group: System/Network License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/connection_profile.c b/src/connection_profile.c index 9d7ca8f..1b3e0d3 100755 --- a/src/connection_profile.c +++ b/src/connection_profile.c @@ -2694,13 +2694,28 @@ EXPORT_API int connection_profile_is_ethernet_eap_enabled(connection_profile_h p return CONNECTION_ERROR_INVALID_PARAMETER; } - int ret = _connection_libnet_ethernet_eap_enabled(enabled); + net_profile_info_t *profile_info = profile; + net_dev_info_t *net_info = __profile_get_net_info(profile_info); + + if (!net_info) { + CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation"); //LCOV_EXCL_LINE + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_OPERATION; //LCOV_EXCL_LINE + } + + if (net_info->use_eapol == true) { + *enabled = net_info->use_eapol; + goto out; + } + + int ret = _connection_libnet_ethernet_eap_enabled(net_info->ProfileName, enabled); if (ret != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to get EAP over Ethernet enabled status."); //LCOV_EXCL_LINE CONN_UNLOCK; //LCOV_EXCL_LINE return ret; //LCOV_EXCL_LINE } +out: CONNECTION_LOG(CONNECTION_INFO, "EAP over Ethernet enabled status: [%s]", enabled ? "true" : "false"); CONN_UNLOCK; diff --git a/src/libnetwork.c b/src/libnetwork.c index 401841c..36892a3 100755 --- a/src/libnetwork.c +++ b/src/libnetwork.c @@ -1392,12 +1392,12 @@ int _connection_libnet_enable_ethernet_eap(bool enable, const char *profilename) return CONNECTION_ERROR_NONE; } -int _connection_libnet_ethernet_eap_enabled(bool *enabled) +int _connection_libnet_ethernet_eap_enabled(const char *profilename, bool *enabled) { int rv = 0; gboolean eap_enabled = false; - rv = net_ethernet_eap_supported(&eap_enabled); + rv = net_ethernet_eap_enabled(profilename, &eap_enabled); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); return CONNECTION_ERROR_PERMISSION_DENIED; diff --git a/test/connection_test.c b/test/connection_test.c index 5213018..d47f4e9 100755 --- a/test/connection_test.c +++ b/test/connection_test.c @@ -2841,6 +2841,12 @@ int test_get_eapol_info(void) if (test_get_user_selected_profile(&profile, true) == false) return -1; + bool enabled = false; + if (connection_profile_is_ethernet_eap_enabled(profile, &enabled) != CONNECTION_ERROR_NONE) { + printf("Failed to get ethernet eap enabled status!!\n"); + } + printf("EAP over Ethernet is %s\n", enabled ? "enabled" : "not enabled"); + if (connection_profile_get_name(profile, &profile_name) != CONNECTION_ERROR_NONE) { printf("Fail to get profile name\n"); return -1; diff --git a/unittest/mock/connection-mock.c b/unittest/mock/connection-mock.c index 02fc8c7..681a759 100755 --- a/unittest/mock/connection-mock.c +++ b/unittest/mock/connection-mock.c @@ -874,9 +874,9 @@ API int net_ethernet_eap_enable(gboolean enable, const char *profilename) return NET_ERR_NONE; } -API int net_ethernet_eap_supported(gboolean *supported) +API int net_ethernet_eap_enabled(const char *profilename, gboolean *enabled) { - *supported = TRUE; + *enabled = TRUE; return NET_ERR_NONE; }