Fixed Ethernet over EAP enabled status on device reboot. 87/249787/1 accepted/tizen/unified/20210129.002155 submit/tizen/20210125.084818 submit/tizen/20210126.062930 submit/tizen/20210127.105449
authorNiraj Kumar Goit <niraj.g@samsung.com>
Wed, 16 Dec 2020 15:41:40 +0000 (21:11 +0530)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Wed, 16 Dec 2020 15:42:07 +0000 (21:12 +0530)
Change-Id: Ia60491d9e2187ad1f5138a0e3477e0634bcb0b82
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
include/connection_extension.h
include/net_connection_private.h
packaging/capi-network-connection.spec
src/connection_profile.c
src/libnetwork.c
test/connection_test.c
unittest/mock/connection-mock.c

index 4d6038c..bee17ca 100755 (executable)
@@ -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
index 08f27ea..48ef312 100755 (executable)
@@ -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);
 
index 26d0699..3e31541 100755 (executable)
@@ -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
index 9d7ca8f..1b3e0d3 100755 (executable)
@@ -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;
index 401841c..36892a3 100755 (executable)
@@ -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;
index 5213018..d47f4e9 100755 (executable)
@@ -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;
index 02fc8c7..681a759 100755 (executable)
@@ -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;
 }