Replace deprecated APIs of Glib v2.62.3 with suggested GLib APIs
[platform/core/connectivity/net-config.git] / src / wifi-config.c
index 751c3b5..97b9c6d 100755 (executable)
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <glib.h>
 #include <unistd.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include <vconf.h>
 
@@ -31,6 +35,8 @@
 #include "util.h"
 #include "neterror.h"
 #include "wifi-config.h"
+#include "netsupplicant.h"
+#include "wifi-key-encryption.h"
 
 #define CONNMAN_STORAGE         "/var/lib/connman"
 
 
 #define WIFI_CONFIG_PREFIX      "wifi_"
 #define MAC_ADDRESS_LENGTH             12
-#define WIFI_PREFIX_LENGTH             MAC_ADDRESS_LENGTH + 6  // wifi_485a3f2f506a_
-#define PROFILE_PREFIX_LENGTH  WIFI_PREFIX_LENGTH + 21 // /net/connman/service/wifi_485a3f2f506a_
+#define WIFI_PREFIX_LENGTH             MAC_ADDRESS_LENGTH + 6  /* wifi_485a3f2f506a_ */
+#define PROFILE_PREFIX_LENGTH  WIFI_PREFIX_LENGTH + 21 /* /net/connman/service/wifi_485a3f2f506a_ */
 
 #define WIFI_MAC_ADD_LENGTH            17
 #define WIFI_MAC_ADD_PATH              "/sys/class/net/wlan0/address"
 
+#define        NET_DNS_ADDR_MAX                2
+
+#define MAX_WIFI_PROFILES              200
+
 struct wifi_eap_config {
        gchar *anonymous_identity;
        gchar *ca_cert;
        gchar *client_cert;
        gchar *private_key;
+       gchar *private_key_password;
        gchar *identity;
        gchar *eap_type;
        gchar *eap_auth_type;
        gchar *subject_match;
 };
 
+typedef struct {
+       gchar *ip_address;
+       gchar *subnet_mask;
+       gchar *gateway_address;
+       gchar *dns_address[NET_DNS_ADDR_MAX];
+       int prefix_length;
+       int dns_count;
+       gchar *ip_type;
+       gchar *dns_type;
+} wifi_ip_info_s;
+
 struct wifi_config {
        gchar *name;
        gchar *ssid;
@@ -66,8 +88,10 @@ struct wifi_config {
        gboolean favorite;
        gboolean autoconnect;
        gchar *is_hidden;
+       gboolean is_created;
        gchar *proxy_address;
        struct wifi_eap_config *eap_config;
+       wifi_ip_info_s *ip_info;
        gchar *last_error;
 };
 
@@ -82,17 +106,35 @@ static void __free_wifi_configuration(struct wifi_config *conf)
        g_free(conf->security_type);
        g_free(conf->is_hidden);
        g_free(conf->proxy_address);
+       g_free(conf->last_error);
        if (conf->eap_config) {
                g_free(conf->eap_config->anonymous_identity);
                g_free(conf->eap_config->ca_cert);
                g_free(conf->eap_config->client_cert);
                g_free(conf->eap_config->private_key);
+               g_free(conf->eap_config->private_key_password);
                g_free(conf->eap_config->identity);
                g_free(conf->eap_config->eap_type);
                g_free(conf->eap_config->eap_auth_type);
                g_free(conf->eap_config->subject_match);
                g_free(conf->eap_config);
        }
+
+       if (conf->ip_info) {
+               g_free(conf->ip_info->ip_type);
+               g_free(conf->ip_info->ip_address);
+               g_free(conf->ip_info->subnet_mask);
+               g_free(conf->ip_info->gateway_address);
+               g_free(conf->ip_info->dns_type);
+               conf->ip_info->prefix_length = 0;
+
+               int i = 0, count = conf->ip_info->dns_count;
+               while (i < count) {
+                       g_free(conf->ip_info->dns_address[i]);
+                       i++;
+               }
+               g_free(conf->ip_info);
+       }
        g_free(conf);
 }
 
@@ -102,56 +144,58 @@ static gboolean __get_mac_address(gchar **mac_address)
        gchar *tmp = NULL;
        gchar mac[13] = { 0, };
        gint i = 0, j = 0;
-#if defined TIZEN_TV
-       FILE *fp = NULL;
-       char buf[WIFI_MAC_ADD_LENGTH + 1];
-       if (0 == access(WIFI_MAC_ADD_PATH, F_OK))
-               fp = fopen(WIFI_MAC_ADD_PATH, "r");
-
-       if (fp == NULL) {
-               ERR("Failed to open file %s\n", WIFI_MAC_ADD_PATH);
-               *mac_address = NULL;
-               return FALSE;
-       }
 
-       if (fgets(buf, sizeof(buf), fp) == NULL) {
-               ERR("Failed to get MAC info from %s\n", WIFI_MAC_ADD_PATH);
-               *mac_address = NULL;
-               fclose(fp);
-               return FALSE;
-       }
-       tmp_mac = (char *)g_try_malloc0(WIFI_MAC_ADD_LENGTH + 1);
-       if (tmp_mac == NULL) {
-               ERR("malloc() failed");
-               *mac_address = NULL;
+       if (TIZEN_TV) {
+               FILE *fp = NULL;
+               char buf[WIFI_MAC_ADD_LENGTH + 1];
+               if (0 == access(WIFI_MAC_ADD_PATH, F_OK))
+                       fp = fopen(WIFI_MAC_ADD_PATH, "r");
+
+               if (fp == NULL) {
+                       ERR("Failed to open file %s\n", WIFI_MAC_ADD_PATH);
+                       *mac_address = NULL;
+                       return FALSE;
+               }
+
+               if (fgets(buf, sizeof(buf), fp) == NULL) {
+                       ERR("Failed to get MAC info from %s\n", WIFI_MAC_ADD_PATH);
+                       *mac_address = NULL;
+                       fclose(fp);
+                       return FALSE;
+               }
+               tmp_mac = (gchar *)malloc(WIFI_MAC_ADD_LENGTH + 1);
+               if (tmp_mac == NULL) {
+                       ERR("malloc() failed");
+                       *mac_address = NULL;
+                       fclose(fp);
+                       return FALSE;
+               }
+               memset(tmp_mac, 0, WIFI_MAC_ADD_LENGTH + 1);
+               g_strlcpy(tmp_mac, buf, WIFI_MAC_ADD_LENGTH + 1);
                fclose(fp);
-               return FALSE;
-       }
-       g_strlcpy(tmp_mac, buf, WIFI_MAC_ADD_LENGTH + 1);
-       fclose(fp);
-#else
-       tmp_mac = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
-       if (tmp_mac == NULL) {
-               ERR("vconf_get_str(WIFI_BSSID_ADDRESS) Failed");
-               *mac_address = NULL;
-               return FALSE;
+       } else {
+               tmp_mac = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+               if (tmp_mac == NULL) {
+                       ERR("vconf_get_str(WIFI_BSSID_ADDRESS) Failed");
+                       *mac_address = NULL;
+                       return FALSE;
+               }
        }
-#endif
        tmp = g_ascii_strdown(tmp_mac, (gssize)strlen(tmp_mac));
-       g_free(tmp_mac);
-       while (tmp[i]) {
-               if (tmp[i] != ':') {
+       free(tmp_mac);
+       while (tmp && tmp[i]) {
+               if (tmp[i] != ':')
                        mac[j++] = tmp[i];
-               }
                i++;
        }
        mac[12] = '\0';
        *mac_address = g_strdup(mac);
+       g_free(tmp);
 
        return TRUE;
 }
 
-static gboolean __get_group_name(const gchar *prefix, const gchar *config_id, gchar **group_name)
+gboolean wifi_config_get_group_name(const gchar *prefix, const gchar *config_id, gchar **group_name)
 {
        gchar *mac_address = NULL;
        gchar *g_name = NULL;
@@ -160,6 +204,7 @@ static gboolean __get_group_name(const gchar *prefix, const gchar *config_id, gc
        ret = __get_mac_address(&mac_address);
        if ((ret != TRUE) || (strlen(mac_address) == 0)) {
                ERR("Cannot get WIFI MAC address");
+               g_free(mac_address);
                return FALSE;
        }
 
@@ -215,10 +260,10 @@ static GKeyFile *__get_configuration_keyfile(const gchar *group_name)
        path = g_strdup_printf(CONNMAN_STORAGE "/%s/settings", group_name);
 
        keyfile = netconfig_keyfile_load(path);
-       if (keyfile == NULL) {
+       if (keyfile == NULL)
                ERR("keyfile[%s] is NULL", path);
-               g_free(path);
-       }
+
+       g_free(path);
 
        return keyfile;
 }
@@ -258,7 +303,6 @@ static gboolean __remove_configuration(const gchar *pathname)
                ERR("Cannot remove [%s]", pathname);
                return FALSE;
        }
-
        return TRUE;
 }
 
@@ -269,7 +313,7 @@ static gboolean _load_configuration(const gchar *config_id, struct wifi_config *
        gboolean hidden = FALSE;
        gboolean ret = FALSE;
 
-       ret = __get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
+       ret = wifi_config_get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
        if (ret != TRUE) {
                ERR("Fail to get_wifi_config_group_name");
                return FALSE;
@@ -283,33 +327,126 @@ static gboolean _load_configuration(const gchar *config_id, struct wifi_config *
        }
 
        config->name = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_NAME, NULL);
-       ret = __get_security_type(config_id, &config->security_type);
-       if (ret != TRUE) {
+       DBG("name [%s]", config->name);
+
+       __get_security_type(config_id, &config->security_type);
+       if (config->security_type == NULL) {
                ERR("Fail to _get_security_type");
                g_key_file_free(keyfile);
                g_free(group_name);
                return FALSE;
        }
+       DBG("security_type [%s]", config->security_type);
+
+       config->passphrase = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_PASSPHRASE, NULL);
+       DBG("passphrase []");
+
        config->proxy_address = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, NULL);
+       if (config->proxy_address)
+               DBG("proxy_address [%s]", config->proxy_address);
+
        hidden = g_key_file_get_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, NULL);
-       if (hidden) {
+       if (hidden)
                config->is_hidden = g_strdup("TRUE");
-       } else {
+       else
                config->is_hidden = g_strdup("FALSE");
+       DBG("is_hidden [%s]", config->is_hidden);
+
+       if (config->ip_info) {
+               GError *error = NULL;
+               config->ip_info->ip_type = g_key_file_get_string(keyfile, group_name,
+                               WIFI_CONFIG_IPV4_METHOD, NULL);
+               if (config->ip_info->ip_type)
+                       DBG("IPv4.Method:%s", config->ip_info->ip_type);
+
+               config->ip_info->ip_address = g_key_file_get_string(keyfile, group_name,
+                               WIFI_CONFIG_IPV4_ADDRESS, NULL);
+               if (config->ip_info->ip_address)
+                       DBG("IPv4.Address:%s", config->ip_info->ip_address);
+
+               int prefix_len;
+               in_addr_t addr;
+               struct in_addr netmask;
+               char *mask;
+               prefix_len = g_key_file_get_integer(keyfile, group_name,
+                               WIFI_CONFIG_IPV4_SUBNET_MASK, &error);
+               if (error != NULL) {
+                       DBG("g_key_file_get_integer failed error[%d: %s]", error->code, error->message);
+                       g_error_free(error);
+               } else {
+                       if (prefix_len > 0 && prefix_len < 32) {
+                               addr = 0xffffffff << (32 - prefix_len);
+                               netmask.s_addr = htonl(addr);
+                               mask = inet_ntoa(netmask);
+                               config->ip_info->subnet_mask = g_strdup(mask);
+                       }
+                       if (config->ip_info->subnet_mask)
+                               DBG("IPv4.SubnetMask:%s", config->ip_info->subnet_mask);
+               }
+
+               config->ip_info->gateway_address = g_key_file_get_string(keyfile,
+                                                       group_name, WIFI_CONFIG_IPV4_GATEWAY_ADDRESS, NULL);
+               if (config->ip_info->gateway_address)
+                       DBG("IPv4.gateway:%s", config->ip_info->gateway_address);
+
+               config->ip_info->dns_type = g_key_file_get_string(keyfile, group_name,
+                                                         WIFI_CONFIG_IPV4_DNS_METHOD, NULL);
+               if (config->ip_info->dns_type)
+                       DBG("DNS.IPv4Method:%s", config->ip_info->dns_type);
+
+               char **nameservers;
+               gsize length;
+               nameservers = g_key_file_get_string_list(keyfile, group_name,
+                                                                WIFI_CONFIG_DNS_ADDRESS, &length, NULL);
+               if (nameservers) {
+                       if (length > 0) {
+                               config->ip_info->dns_count = length;
+                               int i = 0;
+                               while (i < NET_DNS_ADDR_MAX && nameservers[i]) {
+                                       config->ip_info->dns_address[i] = g_strdup(nameservers[i]);
+                                       DBG("DNSAddress[%d]:%s", i+1, config->ip_info->dns_address[i]);
+                                       i += 1;
+                               }
+                       }
+                       g_strfreev(nameservers);
+               }
        }
 
+
        if (g_strcmp0(config->security_type, WIFI_SECURITY_EAP) == 0) {
                config->eap_config->anonymous_identity = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, NULL);
                config->eap_config->ca_cert = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_CACERT, NULL);
                config->eap_config->client_cert = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_CLIENTCERT, NULL);
                config->eap_config->private_key = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_PRIVATEKEY, NULL);
+               config->eap_config->private_key_password = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_PRIVATEKEY_PASSWORD, NULL);
                config->eap_config->identity = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_IDENTITY, NULL);
                config->eap_config->eap_type = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_TYPE, NULL);
                config->eap_config->eap_auth_type = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_AUTH_TYPE, NULL);
                config->eap_config->subject_match = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_SUBJECT_MATCH, NULL);
+
+               if (config->eap_config->anonymous_identity)
+                       DBG("anonymous_identity [%s]", config->eap_config->anonymous_identity);
+               if (config->eap_config->ca_cert)
+                       DBG("ca_cert [%s]", config->eap_config->ca_cert);
+               if (config->eap_config->client_cert)
+                       DBG("client_cert [%s]", config->eap_config->client_cert);
+               if (config->eap_config->private_key)
+                       DBG("private_key [%s]", config->eap_config->private_key);
+               if (config->eap_config->private_key_password)
+                       DBG("private_key_password [%s]", config->eap_config->private_key_password);
+               if (config->eap_config->identity)
+                       DBG("identity [%s]", config->eap_config->identity);
+               if (config->eap_config->eap_type)
+                       DBG("eap_type [%s]", config->eap_config->eap_type);
+               if (config->eap_config->eap_auth_type)
+                       DBG("eap_auth_type [%s]", config->eap_config->eap_auth_type);
+               if (config->eap_config->subject_match)
+                       DBG("subject_match [%s]", config->eap_config->subject_match);
        }
 
        config->last_error = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_FAILURE, NULL);
+       if (config->last_error)
+               DBG("last_error [%s]", config->last_error);
 
        g_key_file_free(keyfile);
        g_free(group_name);
@@ -317,14 +454,14 @@ static gboolean _load_configuration(const gchar *config_id, struct wifi_config *
        return TRUE;
 }
 
-static gboolean _save_configuration(const gchar *config_id, GKeyFile *keyfile)
+gboolean wifi_config_save_configuration(const gchar *config_id, GKeyFile *keyfile)
 {
        gchar *dir;
        gchar *path;
        gchar *group_name;
        gboolean ret = FALSE;
 
-       ret = __get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
+       ret = wifi_config_get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
        if (ret != TRUE) {
                ERR("Fail to get_wifi_config_group_name");
                return FALSE;
@@ -362,7 +499,7 @@ static gboolean _remove_configuration(const gchar *config_id)
        gchar *dir;
        gchar *group_name;
 
-       ret = __get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
+       ret = wifi_config_get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
        if (ret != TRUE) {
                ERR("Fail to get_wifi_config_group_name");
                return FALSE;
@@ -394,7 +531,7 @@ static gboolean _set_field(const gchar *config_id, const gchar *key, const gchar
        GKeyFile *keyfile;
        gchar *group_name;
 
-       ret = __get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
+       ret = wifi_config_get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
        if (ret != TRUE) {
                ERR("Fail to get_wifi_config_group_name");
                return FALSE;
@@ -404,18 +541,18 @@ static gboolean _set_field(const gchar *config_id, const gchar *key, const gchar
        keyfile = __get_configuration_keyfile(group_name);
        if (keyfile == NULL) {
                ERR("Fail to __get_configuration_keyfile");
+               g_free(group_name);
                return FALSE;
        }
 
        if (g_strcmp0(key, WIFI_CONFIG_PROXY_METHOD) == 0) {
                g_key_file_set_string(keyfile, group_name, key, value);
-       }else if (g_strcmp0(key, WIFI_CONFIG_PROXY_SERVER) == 0) {
+       } else if (g_strcmp0(key, WIFI_CONFIG_PROXY_SERVER) == 0) {
                g_key_file_set_string(keyfile, group_name, key, value);
        } else if (g_strcmp0(key, WIFI_CONFIG_HIDDEN) == 0) {
                gboolean hidden = FALSE;
-               if (g_strcmp0(value, "TRUE") == 0) {
+               if (g_strcmp0(value, "TRUE") == 0)
                        hidden = TRUE;
-               }
                g_key_file_set_boolean(keyfile, group_name, key, hidden);
        } else if (g_strcmp0(key, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY) == 0) {
                g_key_file_set_string(keyfile, group_name, key, value);
@@ -438,7 +575,7 @@ static gboolean _set_field(const gchar *config_id, const gchar *key, const gchar
                ret = FALSE;
        }
 
-       _save_configuration(config_id, keyfile);
+       wifi_config_save_configuration(config_id, keyfile);
 
        g_key_file_free(keyfile);
        g_free(group_name);
@@ -454,7 +591,7 @@ static gboolean _get_field(const gchar *config_id, const gchar *key, gchar **val
        gboolean hidden = FALSE;
        gboolean ret = FALSE;
 
-       ret = __get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
+       ret = wifi_config_get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
        if (ret != TRUE) {
                ERR("Fail to get_wifi_config_group_name");
                return FALSE;
@@ -464,6 +601,7 @@ static gboolean _get_field(const gchar *config_id, const gchar *key, gchar **val
        keyfile = __get_configuration_keyfile(group_name);
        if (keyfile == NULL) {
                ERR("Fail to __get_configuration_keyfile");
+               g_free(group_name);
                return FALSE;
        }
 
@@ -475,11 +613,10 @@ static gboolean _get_field(const gchar *config_id, const gchar *key, gchar **val
                val = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, NULL);
        } else if (g_strcmp0(key, WIFI_CONFIG_HIDDEN) == 0) {
                hidden = g_key_file_get_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, NULL);
-               if (hidden) {
+               if (hidden)
                        val = g_strdup("TRUE");
-               } else {
+               else
                        val = g_strdup("FALSE");
-               }
        } else if (g_strcmp0(key, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY) == 0) {
                val = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, NULL);
        } else if (g_strcmp0(key, WIFI_CONFIG_EAP_CACERT) == 0) {
@@ -515,7 +652,6 @@ static gboolean _get_field(const gchar *config_id, const gchar *key, gchar **val
 static GSList *_get_list(void)
 {
        GSList *list = NULL;
-       struct dirent ent_struct;
        struct dirent *dp = NULL;
        DIR *dir;
 
@@ -525,7 +661,7 @@ static GSList *_get_list(void)
                return NULL;
        }
 
-       while ((readdir_r(dir, &ent_struct, &dp) == 0) && dp) {
+       while ((dp = readdir(dir)) != NULL) {
                if (g_strcmp0(dp->d_name, ".") == 0 || g_strcmp0(dp->d_name, "..") == 0 ||
                                strncmp(dp->d_name, WIFI_CONFIG_PREFIX, strlen(WIFI_CONFIG_PREFIX)) != 0) {
                        continue;
@@ -565,7 +701,320 @@ gboolean wifi_config_remove_configuration(const gchar *config_id)
        return ret;
 }
 
-// dbus method
+int __netconfig_hex_char_to_num(char c)
+{
+       if (c >= '0' && c <= '9')
+               return c - '0';
+
+       if (c >= 'a' && c <= 'f')
+               return c - 'a' + 10;
+
+       if (c >= 'A' && c <= 'F')
+               return c - 'A' + 10;
+
+       return -1;
+}
+
+int __netconfig_hex_to_byte(const char *hex)
+{
+       int a, b;
+
+       a = __netconfig_hex_char_to_num(*hex++);
+       if (a < 0)
+               return -1;
+
+       b = __netconfig_hex_char_to_num(*hex++);
+       if (b < 0)
+               return -1;
+
+       return (a << 4) | b;
+}
+
+int __netconfig_hex_str_to_bin(const char *hex, unsigned char *buf, size_t len)
+{
+       size_t i;
+       int a;
+       const char *ipos = hex;
+       unsigned char *opos = buf;
+
+       for (i = 0; i < len; i++) {
+               a = __netconfig_hex_to_byte(ipos);
+               if (a < 0)
+                       return -1;
+
+               *opos++ = a;
+               ipos += 2;
+       }
+
+       return 0;
+}
+
+static int __netconfig_byte_to_txt(const unsigned char *src, char **dst, int src_len)
+{
+       int dst_length = 0;
+       int i = 0;
+       char *buf = NULL;
+
+       if (src_len <= 0) {
+               ERR("Invalid parameter.");
+               return -1;
+       }
+
+       *dst = (char *) g_try_malloc0((2*src_len)+1);
+       if (!(*dst)) {
+               ERR("failed to allocate memory to buffer.");
+               return -1;
+       }
+
+       buf = (*dst);
+
+       for (i = 0; i < src_len; i++) {
+               snprintf(buf, 3, "%02x", src[i]);
+               buf += 2;
+               dst_length += 2;
+       }
+
+       return dst_length;
+}
+
+static int __netconfig_unpack_ay_malloc(unsigned char **dst, GVariantIter *iter)
+{
+       GVariantIter *iter_copy = NULL;
+       int length = 0;
+       char tmp = 0;
+       unsigned char *tmp_dst = NULL;
+
+       if (!dst || *dst || !iter) {
+               ERR("Invalid parameter");
+               return 0;
+       }
+
+       iter_copy = g_variant_iter_copy(iter);
+
+       while (g_variant_iter_loop(iter, "y", &tmp))
+               length++;
+       g_variant_iter_free(iter);
+
+       tmp_dst = (unsigned char *)g_try_malloc0(length + 1);
+       if (!tmp_dst) {
+               ERR("failed to allocate memory");
+               g_variant_iter_free(iter_copy);
+               return 0;
+       }
+
+       length = 0;
+       while (g_variant_iter_loop(iter_copy, "y", &tmp_dst[length]))
+               length++;
+       g_variant_iter_free(iter_copy);
+
+       if (length == 0) {
+               g_free(tmp_dst);
+               tmp_dst = NULL;
+       } else {
+               tmp_dst[length] = '\0';
+       }
+
+       *dst = tmp_dst;
+       DBG("Length [%d]", length);
+       return length;
+}
+
+gboolean _add_vsie(int frame_id, const char* vsie)
+{
+       GVariant *params = NULL;
+       GVariant *message = NULL;
+       GVariantBuilder *bytearray_builder = NULL;
+       char *if_path;
+       int i = 0;
+       size_t vsie_len = 0;
+
+       unsigned char *bytearray = NULL;
+       size_t bytearray_len = 0;
+
+       if (frame_id >= NETCONFIG_VSIE_FRAME_MAX) {
+               DBG("Invalid parameter, frame-id: %d", frame_id);
+               return FALSE;
+       }
+
+       vsie_len = strlen(vsie);
+       if (vsie_len == 0) {
+               DBG("vsie length is zero");
+               return FALSE;
+       }
+
+       bytearray_len = (vsie_len % 2) ? ((vsie_len / 2) + 1) : (vsie_len / 2);
+
+       bytearray = (unsigned char *) g_try_malloc0(bytearray_len);
+       if (bytearray == NULL) {
+               DBG("Failed to allocate memory to bytearray");
+               return FALSE;
+       }
+
+       if (__netconfig_hex_str_to_bin(vsie, bytearray, bytearray_len) < 0) {
+               DBG("invalid vsie string");
+               g_free(bytearray);
+               return FALSE;
+       }
+
+       bytearray_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       for (i = 0; i < bytearray_len; i++)
+               g_variant_builder_add(bytearray_builder, "y", bytearray[i]);
+
+       params = g_variant_new("(iay)", frame_id, bytearray_builder);
+       g_variant_builder_unref(bytearray_builder);
+
+       if_path = netconfig_wifi_get_supplicant_interface();
+
+       if (if_path == NULL) {
+               ERR("Fail to get wpa_supplicant DBus path");
+               g_free(bytearray);
+               return FALSE;
+       }
+
+       message = netconfig_supplicant_invoke_dbus_method(SUPPLICANT_SERVICE,
+                       if_path, SUPPLICANT_INTERFACE ".Interface", "VendorElemAdd", params);
+
+       g_free(if_path);
+       if (message == NULL) {
+               ERR("Failed to send command to wpa_supplicant");
+               g_free(bytearray);
+               return FALSE;
+       }
+
+       DBG("Succeeded to add vsie: Frame ID[%d], VSIE[%s]", frame_id, vsie);
+
+       g_free(bytearray);
+       return TRUE;
+}
+
+gboolean _get_vsie(int frame_id, char **vsie)
+{
+       GVariant *params = NULL;
+       GVariant *message = NULL;
+       char *if_path;
+
+       if (frame_id >= NETCONFIG_VSIE_FRAME_MAX) {
+               DBG("Invalid parameter, frame-id: %d", frame_id);
+               return FALSE;
+       }
+
+       if_path = netconfig_wifi_get_supplicant_interface();
+       if (if_path == NULL) {
+               ERR("Fail to get wpa_supplicant DBus path");
+               return FALSE;
+       }
+
+       params = g_variant_new("(i)", frame_id);
+
+       message = netconfig_supplicant_invoke_dbus_method(SUPPLICANT_SERVICE,
+                       if_path, SUPPLICANT_INTERFACE ".Interface", "VendorElemGet", params);
+
+       g_free(if_path);
+       if (message == NULL) {
+               ERR("Failed to send command to wpa_supplicant");
+               return FALSE;
+       } else {
+               GVariantIter *iter = NULL;
+               unsigned char *vsie_bytes = NULL;
+               int vsie_len = 0;
+               int ret = 0;
+
+               g_variant_get(message, "(ay)", &iter);
+               if (iter == NULL) {
+                       ERR("vsie is not present");
+                       return FALSE;
+               }
+
+               vsie_len = __netconfig_unpack_ay_malloc(&vsie_bytes, iter);
+               if (vsie_bytes == NULL) {
+                       ERR("vsie_bytes not allocated");
+                       return FALSE;
+               }
+
+               ret = __netconfig_byte_to_txt(vsie_bytes, vsie, vsie_len);
+               if (ret < 0) {
+                       g_free(vsie_bytes);
+                       ERR("vsie not allocated.");
+                       return FALSE;
+               }
+
+               g_free(vsie_bytes);
+       }
+
+       ERR("Succeeded to get vsie: Frame ID[%d], VSIE[%s]", frame_id, *vsie);
+
+       return TRUE;
+
+}
+
+gboolean _remove_vsie(int frame_id, const char *vsie)
+{
+       GVariant *params = NULL;
+       GVariant *message = NULL;
+       GVariantBuilder *bytearray_builder = NULL;
+       char *if_path;
+       int i = 0;
+       size_t vsie_len = 0;
+
+       unsigned char *bytearray = NULL;
+       size_t bytearray_len = 0;
+
+       if (frame_id >= NETCONFIG_VSIE_FRAME_MAX) {
+               DBG("Invalid parameter, frame-id: %d", frame_id);
+               return FALSE;
+       }
+
+       vsie_len = strlen(vsie);
+       if (vsie_len == 0) {
+               DBG("vsie length is zero");
+               return FALSE;
+       }
+
+       bytearray_len = (vsie_len % 2) ? ((vsie_len / 2) + 1) : (vsie_len / 2);
+
+       bytearray = (unsigned char *) g_try_malloc0(bytearray_len);
+       if (bytearray == NULL) {
+               DBG("Failed to allocate memory to bytearray");
+               return FALSE;
+       }
+
+       if (__netconfig_hex_str_to_bin(vsie, bytearray, bytearray_len) < 0) {
+               DBG("invalid vsie string");
+               g_free(bytearray);
+               return FALSE;
+       }
+
+       bytearray_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       for (i = 0; i < bytearray_len; i++)
+               g_variant_builder_add(bytearray_builder, "y", bytearray[i]);
+
+       params = g_variant_new("(iay)", frame_id, bytearray_builder);
+       g_variant_builder_unref(bytearray_builder);
+
+       if_path = netconfig_wifi_get_supplicant_interface();
+       if (if_path == NULL) {
+               ERR("Fail to get wpa_supplicant DBus path");
+               g_free(bytearray);
+               return FALSE;
+       }
+
+       message = netconfig_supplicant_invoke_dbus_method(SUPPLICANT_SERVICE,
+                       if_path, SUPPLICANT_INTERFACE ".Interface", "VendorElemRem", params);
+
+       g_free(if_path);
+       if (message == NULL) {
+               ERR("Failed to send command to wpa_supplicant");
+               g_free(bytearray);
+               return FALSE;
+       }
+
+       DBG("Succeeded to remove vsie: Frame ID[%d], VSIE[%s]", frame_id, vsie);
+
+       g_free(bytearray);
+       return TRUE;
+}
+
+/* dbus method */
 gboolean handle_get_config_ids(Wifi *wifi, GDBusMethodInvocation *context)
 {
        guint i = 0;
@@ -573,13 +1022,13 @@ gboolean handle_get_config_ids(Wifi *wifi, GDBusMethodInvocation *context)
        guint length;
        gchar **result = NULL;
 
-       g_return_val_if_fail(wifi != NULL, FALSE);
+       g_return_val_if_fail(wifi != NULL, TRUE);
 
        config_ids = _get_list();
        if (config_ids == NULL) {
-               netconfig_error_no_profile(context);
                ERR("Fail to get config list");
-               return FALSE;
+               netconfig_error_no_profile(context);
+               return TRUE;
        }
 
        length = g_slist_length(config_ids);
@@ -592,7 +1041,11 @@ gboolean handle_get_config_ids(Wifi *wifi, GDBusMethodInvocation *context)
        config_ids = g_slist_nth(config_ids, 0);
        g_slist_free_full(config_ids, g_free);
 
-       wifi_complete_get_config_ids(wifi, context, (const gchar * const*)result);
+       wifi_complete_get_config_ids(wifi, context, (const gchar * const *)result);
+
+       for (i = 0; i < length; i++)
+               if (result[i])
+                       g_free(result[i]);
 
        if (result)
                g_free(result);
@@ -607,45 +1060,93 @@ gboolean handle_load_configuration(Wifi *wifi, GDBusMethodInvocation *context,
        GVariantBuilder *b = NULL;
        struct wifi_config *conf = NULL;
 
-       g_return_val_if_fail(wifi != NULL, FALSE);
+       g_return_val_if_fail(wifi != NULL, TRUE);
 
        conf = g_new0(struct wifi_config, 1);
+       conf->ip_info = g_new0(wifi_ip_info_s, 1);
 
        ret = _load_configuration(config_id, conf);
        if (ret != TRUE) {
+               g_free(conf->ip_info);
                g_free(conf);
                ERR("Fail to _load_configuration");
                netconfig_error_no_profile(context);
-               return FALSE;
+               return TRUE;
        }
 
        b = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_NAME, g_variant_new_string(conf->name));
        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_SECURITY_TYPE, g_variant_new_string(conf->security_type));
+       g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PASSPHRASE, g_variant_new_string(conf->passphrase));
        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_HIDDEN, g_variant_new_string(conf->is_hidden));
-       if (conf->proxy_address != NULL) {
+
+       if (conf->proxy_address != NULL)
                g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string(conf->proxy_address));
-               g_free(conf->proxy_address);
-       } else {
+       else
                g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string("NONE"));
+
+       if (conf->ip_info->ip_type != NULL)
+               g_variant_builder_add(b, "{sv}", WIFI_CONFIG_IPV4_METHOD, g_variant_new_string(conf->ip_info->ip_type));
+
+       if (conf->ip_info->ip_address != NULL)
+               g_variant_builder_add(b, "{sv}", WIFI_CONFIG_IPV4_ADDRESS, g_variant_new_string(conf->ip_info->ip_address));
+
+       if (conf->ip_info->subnet_mask != NULL)
+               g_variant_builder_add(b, "{sv}", WIFI_CONFIG_IPV4_SUBNET_MASK, g_variant_new_string(conf->ip_info->subnet_mask));
+
+       if (conf->ip_info->prefix_length > 0)
+               g_variant_builder_add(b, "{sv}", WIFI_CONFIG_IPV6_PREFIX_LEN, g_variant_new_int32(conf->ip_info->prefix_length));
+
+       if (conf->ip_info->gateway_address != NULL)
+               g_variant_builder_add(b, "{sv}", WIFI_CONFIG_IPV4_GATEWAY_ADDRESS, g_variant_new_string(conf->ip_info->gateway_address));
+
+       if (conf->ip_info->dns_type != NULL)
+               g_variant_builder_add(b, "{sv}", WIFI_CONFIG_IPV4_DNS_METHOD, g_variant_new_string(conf->ip_info->dns_type));
+
+       int i = 0, count = conf->ip_info->dns_count;
+       while (i < count) {
+               if (conf->ip_info->dns_address[i] != NULL)
+                       g_variant_builder_add(b, "{sv}", WIFI_CONFIG_DNS_ADDRESS, g_variant_new_string(conf->ip_info->dns_address[i]));
+
+               i += 1;
        }
-       if (conf->last_error != NULL) {
+
+       if (conf->last_error != NULL)
                g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string(conf->last_error));
-               g_free(conf->last_error);
-       } else {
+       else
                g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string("ERROR_NONE"));
-       }
 
-       g_free(conf->name);
-       g_free(conf->security_type);
-       g_free(conf->is_hidden);
-       g_free(conf);
+       __free_wifi_configuration(conf);
 
        wifi_complete_load_configuration(wifi, context, g_variant_builder_end(b));
        g_variant_builder_unref(b);
        return TRUE;
 }
 
+static unsigned char __netconfig_convert_netmask_to_prefixlen(
+                                                         const char *netmask)
+{
+       unsigned char bits;
+       in_addr_t mask;
+       in_addr_t host;
+
+       if (!netmask)
+               return 32;
+
+       mask = inet_network(netmask);
+       host = ~mask;
+
+       /* a valid netmask must be 2^n - 1 */
+       if ((host & (host + 1)) != 0)
+               return -1;
+
+       bits = 0;
+       for (; mask; mask <<= 1)
+               ++bits;
+
+       return bits;
+}
+
 gboolean handle_save_configuration(Wifi *wifi, GDBusMethodInvocation *context,
                const gchar *config_id, GVariant *configuration)
 {
@@ -656,52 +1157,109 @@ gboolean handle_save_configuration(Wifi *wifi, GDBusMethodInvocation *context,
        GVariant *value;
        gchar *field;
        gchar *group_name = NULL;
+       int order = 0;
 
        if ((wifi == NULL) || (config_id == NULL) || (configuration == NULL)) {
                ERR("Invalid parameter");
                netconfig_error_invalid_parameter(context);
-               SLOG(LOG_INFO, "MDM_LOG_USER", "Object=wifi-profile, AccessType=Create, Result=Failed");
-               return FALSE;
+               return TRUE;
        }
 
-       ERR("save_configuration [%s]", config_id);
-
        conf = g_new0(struct wifi_config, 1);
+       conf->ip_info = g_new0(wifi_ip_info_s, 1);
 
        g_variant_get(configuration, "a{sv}", &iter);
        while (g_variant_iter_loop(iter, "{sv}", &field, &value)) {
                if (g_strcmp0(field, WIFI_CONFIG_NAME) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->name = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("name [%s]", conf->name);
+                               DBG("name [%s]", conf->name);
                        } else {
                                conf->name = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_SSID) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->ssid = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("ssid [%s]", conf->ssid);
+                               DBG("ssid [%s]", conf->ssid);
                        } else {
                                conf->ssid = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_PASSPHRASE) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->passphrase = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("passphrase []");
+                               DBG("passphrase []");
                        } else {
                                conf->passphrase = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_HIDDEN) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->is_hidden = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("is_hidden [%s]", conf->is_hidden);
+                               DBG("is_hidden [%s]", conf->is_hidden);
                        } else {
                                conf->is_hidden = NULL;
                        }
+               } else if (g_strcmp0(field, WIFI_CONFIG_CREATED) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_BOOLEAN)) {
+                               conf->is_created = g_variant_get_boolean(value);
+                               DBG("is_created [%d]", conf->is_created);
+                       } else {
+                               conf->is_created = FALSE;
+                       }
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_METHOD) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
+                               conf->ip_info->ip_type = g_strdup(g_variant_get_string(value, NULL));
+                               DBG("IP config type [%s]", conf->ip_info->ip_type);
+                       } else {
+                               conf->ip_info->ip_type = NULL;
+                       }
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_ADDRESS) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
+                               conf->ip_info->ip_address = g_strdup(g_variant_get_string(value, NULL));
+                               DBG("IP address [%s]", conf->ip_info->ip_address);
+                       } else {
+                               conf->ip_info->ip_address = NULL;
+                       }
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_SUBNET_MASK) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
+                               conf->ip_info->subnet_mask = g_strdup(g_variant_get_string(value, NULL));
+                               DBG("Subnet Mask [%s]", conf->ip_info->subnet_mask);
+                       } else {
+                               conf->ip_info->subnet_mask = NULL;
+                       }
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV6_PREFIX_LEN) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_INT32)) {
+                               conf->ip_info->prefix_length = g_variant_get_int32(value);
+                               DBG("IPv6 Prefix Length [%d]", conf->ip_info->prefix_length);
+                       } else {
+                               conf->ip_info->prefix_length = 0;
+                       }
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_GATEWAY_ADDRESS) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
+                               conf->ip_info->gateway_address = g_strdup(g_variant_get_string(value, NULL));
+                               DBG("Gateway address [%s]", conf->ip_info->gateway_address);
+                       } else {
+                               conf->ip_info->gateway_address = NULL;
+                       }
+               } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_DNS_METHOD) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
+                               conf->ip_info->dns_type = g_strdup(g_variant_get_string(value, NULL));
+                               DBG("DNS config type [%s]", conf->ip_info->dns_type);
+                       } else {
+                               conf->ip_info->dns_type = NULL;
+                       }
+               } else if (g_strcmp0(field, WIFI_CONFIG_DNS_ADDRESS) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
+                               conf->ip_info->dns_address[order] = g_strdup(g_variant_get_string(value, NULL));
+                               DBG("DNS address [%s]", conf->ip_info->dns_address[order]);
+                               conf->ip_info->dns_count = order + 1;
+                               order++;
+                       } else {
+                               conf->ip_info->dns_address[order++] = NULL;
+                       }
                } else if (g_strcmp0(field, WIFI_CONFIG_PROXYADDRESS) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->proxy_address = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("proxy_address [%s]", conf->proxy_address);
+                               DBG("proxy_address [%s]", conf->proxy_address);
                        } else {
                                conf->proxy_address = NULL;
                        }
@@ -710,23 +1268,66 @@ gboolean handle_save_configuration(Wifi *wifi, GDBusMethodInvocation *context,
        conf->favorite = TRUE;
        conf->autoconnect = TRUE;
 
-       ret = __get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
+       ret = wifi_config_get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
        if (ret != TRUE) {
+               __free_wifi_configuration(conf);
                ERR("Fail to get_wifi_config_group_name");
-               return FALSE;
+               netconfig_error_fail_save_congifuration(context);
+               return TRUE;
        }
 
        keyfile = g_key_file_new();
        g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_NAME, conf->name);
        g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_SSID, conf->ssid);
 
-       if (conf->passphrase != NULL)
+       if (conf->passphrase != NULL) {
+               gchar *enc_data = NULL;
+
+               if (conf->is_created == true)
+                       enc_data = _netconfig_encrypt_passphrase(conf->passphrase);
+               else
+                       enc_data = g_strdup(conf->passphrase);
+
+               if (!enc_data) {
+                       ERR("Failed to encrypt the passphrase");
+               } else {
+                       g_free(conf->passphrase);
+                       conf->passphrase = enc_data;
+               }
+
                g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PASSPHRASE, conf->passphrase);
+       }
 
        g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_FAVORITE, conf->favorite);
        g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_AUTOCONNECT, conf->autoconnect);
 
-       // Optional field
+#if GLIB_CHECK_VERSION(2,62,0)
+       gint64 real_time = 0;
+       GDateTime *dt_real_time = NULL;
+
+       real_time = g_get_real_time();
+       dt_real_time = g_date_time_new_from_unix_utc(real_time);
+       if (dt_real_time) {
+               gchar *str = g_date_time_format_iso8601(dt_real_time);
+               g_date_time_unref(dt_real_time);
+               if (str) {
+                       g_key_file_set_string(keyfile, group_name,
+                                             WIFI_CONFIG_MODIFIED, str);
+                       g_free(str);
+               }
+       }
+#else /* GLIB_CHECK_VERSION(2,62,0) */
+       GTimeVal modified;
+       g_get_current_time(&modified);
+       gchar *str = g_time_val_to_iso8601(&modified);
+       if (str) {
+               g_key_file_set_string(keyfile, group_name,
+                                     WIFI_CONFIG_MODIFIED, str);
+               g_free(str);
+       }
+#endif /* GLIB_CHECK_VERSION(2,62,0) */
+
+       /* Optional field */
        if (conf->proxy_address != NULL) {
                g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_METHOD, "manual");
                g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, conf->proxy_address);
@@ -734,32 +1335,80 @@ gboolean handle_save_configuration(Wifi *wifi, GDBusMethodInvocation *context,
 
        if (conf->is_hidden != NULL) {
                gboolean hidden = FALSE;
-               if (g_strcmp0(conf->is_hidden, "TRUE") == 0) {
+               if (g_strcmp0(conf->is_hidden, "TRUE") == 0)
                        hidden = TRUE;
-               }
                g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, hidden);
        }
 
-       ret = _save_configuration(config_id, keyfile);
+       if (conf->ip_info->ip_type != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_IPV4_METHOD, conf->ip_info->ip_type);
+
+       if (conf->ip_info->ip_address != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_IPV4_ADDRESS, conf->ip_info->ip_address);
+
+       if (conf->ip_info->subnet_mask != NULL) {
+               unsigned char prefix_len;
+               prefix_len = __netconfig_convert_netmask_to_prefixlen(
+                               conf->ip_info->subnet_mask);
+               if (prefix_len > 0 && prefix_len < 32)
+                       g_key_file_set_integer(keyfile, group_name,
+                                       WIFI_CONFIG_IPV4_SUBNET_MASK, prefix_len);
+       }
+
+       if (conf->ip_info->prefix_length > 0)
+               g_key_file_set_integer(keyfile, group_name,
+                               WIFI_CONFIG_IPV6_PREFIX_LEN, conf->ip_info->prefix_length);
+
+       if (conf->ip_info->gateway_address != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_IPV4_GATEWAY_ADDRESS, conf->ip_info->gateway_address);
+
+       if (conf->ip_info->dns_type != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_IPV4_DNS_METHOD, conf->ip_info->dns_type);
+
+       int i = 0, count = conf->ip_info->dns_count;
+       while (i < count) {
+               if (conf->ip_info->dns_address[i] != NULL)
+                       g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_DNS_ADDRESS,
+                                                                 conf->ip_info->dns_address[i]);
+
+               i += 1;
+       }
+
+       ret = wifi_config_save_configuration(config_id, keyfile);
        if (ret == TRUE) {
-               SLOG(LOG_INFO, "MDM_LOG_USER", "Object=wifi-profile, AccessType=Create, Result=Succeed");
+               INFO("Success to save configuration [%s]", config_id);
                wifi_complete_save_configuration(wifi, context);
+               char *file;
+               if (get_files_count(CONNMAN_STORAGE) > MAX_WIFI_PROFILES) {
+                       file = get_least_recently_profile(CONNMAN_STORAGE);
+                       if (file) {
+                               gchar *profileName = g_strdup_printf(CONNMAN_STORAGE "/%s", file);
+                               INFO("least modified file:  %s", profileName);
+                               if (profileName) {
+                                       if (__remove_configuration(profileName) != TRUE)
+                                               DBG("Failed to remove profile: [%s]", profileName);
+                               } else
+                                       ERR("Profile: [%s] does not exist", file);
+
+                               g_free(profileName);
+                       }
+               }
        } else {
-               SLOG(LOG_INFO, "MDM_LOG_USER", "Object=wifi-profile, AccessType=Create, Result=Failed");
+               INFO("Fail to save configuration [%s]", config_id);
                netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailSaveConfiguration");
        }
 
        g_key_file_free(keyfile);
-       g_free(conf->name);
-       g_free(conf->ssid);
-       g_free(conf->passphrase);
-       g_free(conf->is_hidden);
-       g_free(conf->proxy_address);
-       g_free(conf);
+       g_free(group_name);
+       __free_wifi_configuration(conf);
 
        g_variant_iter_free(iter);
 
-       return ret;
+       return TRUE;
 }
 
 gboolean handle_load_eap_configuration(Wifi *wifi, GDBusMethodInvocation *context,
@@ -769,77 +1418,81 @@ gboolean handle_load_eap_configuration(Wifi *wifi, GDBusMethodInvocation *contex
        GVariantBuilder *b = NULL;
        struct wifi_config *conf = NULL;
 
-       g_return_val_if_fail(wifi != NULL, FALSE);
+       g_return_val_if_fail(wifi != NULL, TRUE);
 
        conf = g_new0(struct wifi_config, 1);
        conf->eap_config = g_new0(struct wifi_eap_config, 1);
+       conf->ip_info = g_new0(wifi_ip_info_s, 1);
 
        ret = _load_configuration(config_id, conf);
        if (ret != TRUE) {
                g_free(conf->eap_config);
+               g_free(conf->ip_info);
                g_free(conf);
                ERR("Fail to _load_configuration");
                netconfig_error_no_profile(context);
-               return FALSE;
+               return TRUE;
        }
 
        b = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_NAME, g_variant_new_string(conf->name));
        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_SECURITY_TYPE, g_variant_new_string(conf->security_type));
        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_HIDDEN, g_variant_new_string(conf->is_hidden));
-       if (conf->proxy_address != NULL) {
+       if (conf->proxy_address != NULL)
                g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string(conf->proxy_address));
-               g_free(conf->proxy_address);
-       } else {
+       else
                g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string("NONE"));
-       }
-       if (conf->last_error != NULL) {
+
+       if (conf->last_error != NULL)
                g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string(conf->last_error));
-               g_free(conf->last_error);
-       } else {
+       else
                g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string("ERROR_NONE"));
-       }
+
        if (conf->eap_config != NULL) {
-               if (conf->eap_config->anonymous_identity != NULL) {
+               if (conf->eap_config->anonymous_identity != NULL)
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, g_variant_new_string(conf->eap_config->anonymous_identity));
-               } else {
+               else
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, g_variant_new_string("NONE"));
-               }
-               if (conf->eap_config->ca_cert != NULL) {
+
+               if (conf->eap_config->ca_cert != NULL)
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CACERT, g_variant_new_string(conf->eap_config->ca_cert));
-               } else {
+               else
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CACERT, g_variant_new_string("NONE"));
-               }
-               if (conf->eap_config->client_cert != NULL) {
+
+               if (conf->eap_config->client_cert != NULL)
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CLIENTCERT, g_variant_new_string(conf->eap_config->client_cert));
-               } else {
+               else
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CLIENTCERT, g_variant_new_string("NONE"));
-               }
-               if (conf->eap_config->private_key != NULL) {
+
+               if (conf->eap_config->private_key != NULL)
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY, g_variant_new_string(conf->eap_config->private_key));
-               } else {
+               else
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY, g_variant_new_string("NONE"));
-               }
-               if (conf->eap_config->identity != NULL) {
+
+               if (conf->eap_config->private_key_password != NULL)
+                       g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY_PASSWORD, g_variant_new_string(conf->eap_config->private_key_password));
+               else
+                       g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY_PASSWORD, g_variant_new_string("NONE"));
+
+               if (conf->eap_config->identity != NULL)
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_IDENTITY, g_variant_new_string(conf->eap_config->identity));
-               } else {
+               else
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_IDENTITY, g_variant_new_string("NONE"));
-               }
-               if (conf->eap_config->eap_type != NULL) {
+
+               if (conf->eap_config->eap_type != NULL)
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_TYPE, g_variant_new_string(conf->eap_config->eap_type));
-               } else {
+               else
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_TYPE, g_variant_new_string("NONE"));
-               }
-               if (conf->eap_config->eap_auth_type != NULL) {
+
+               if (conf->eap_config->eap_auth_type != NULL)
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_AUTH_TYPE, g_variant_new_string(conf->eap_config->eap_auth_type));
-               } else {
+               else
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_AUTH_TYPE, g_variant_new_string("NONE"));
-               }
-               if (conf->eap_config->subject_match != NULL) {
+
+               if (conf->eap_config->subject_match != NULL)
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_SUBJECT_MATCH, g_variant_new_string(conf->eap_config->subject_match));
-               } else {
+               else
                        g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_SUBJECT_MATCH, g_variant_new_string("NONE"));
-               }
        }
 
        __free_wifi_configuration(conf);
@@ -863,12 +1516,9 @@ gboolean handle_save_eap_configuration(Wifi *wifi, GDBusMethodInvocation *contex
        if ((wifi == NULL) || (config_id == NULL) || (configuration == NULL)) {
                ERR("Invalid parameter");
                netconfig_error_invalid_parameter(context);
-               SLOG(LOG_INFO, "MDM_LOG_USER", "Object=wifi-profile, AccessType=Create, Result=Failed");
-               return FALSE;
+               return TRUE;
        }
 
-       INFO("save [%s]", config_id);
-
        conf = g_new0(struct wifi_config, 1);
        conf->eap_config = g_new0(struct wifi_eap_config, 1);
 
@@ -877,91 +1527,105 @@ gboolean handle_save_eap_configuration(Wifi *wifi, GDBusMethodInvocation *contex
                if (g_strcmp0(field, WIFI_CONFIG_NAME) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->name = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("name [%s]", conf->name);
+                               DBG("name [%s]", conf->name);
                        } else {
                                conf->name = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_SSID) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->ssid = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("ssid [%s]", conf->ssid);
+                               DBG("ssid [%s]", conf->ssid);
                        } else {
                                conf->ssid = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_PASSPHRASE) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->passphrase = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("passphrase [%s]", conf->passphrase);
+                               DBG("passphrase [%s]", conf->passphrase);
                        } else {
                                conf->passphrase = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_HIDDEN) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->is_hidden = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("is_hidden [%s]", conf->is_hidden);
+                               DBG("is_hidden [%s]", conf->is_hidden);
                        } else {
                                conf->is_hidden = NULL;
                        }
+               } else if (g_strcmp0(field, WIFI_CONFIG_CREATED) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_BOOLEAN)) {
+                               conf->is_created = g_variant_get_boolean(value);
+                               DBG("is_created [%d]", conf->is_created);
+                       } else {
+                               conf->is_created = FALSE;
+                       }
                } else if (g_strcmp0(field, WIFI_CONFIG_PROXYADDRESS) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->proxy_address = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("proxy_address [%s]", conf->proxy_address);
+                               DBG("proxy_address [%s]", conf->proxy_address);
                        } else {
                                conf->proxy_address = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->eap_config->anonymous_identity = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("anonymous_identity [%s]", conf->eap_config->anonymous_identity);
+                               DBG("anonymous_identity [%s]", conf->eap_config->anonymous_identity);
                        } else {
                                conf->eap_config->anonymous_identity = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_EAP_CACERT) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->eap_config->ca_cert = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("ca_cert [%s]", conf->eap_config->ca_cert);
+                               DBG("ca_cert [%s]", conf->eap_config->ca_cert);
                        } else {
                                conf->eap_config->ca_cert = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_EAP_CLIENTCERT) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->eap_config->client_cert = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("client_cert [%s]", conf->eap_config->client_cert);
+                               DBG("client_cert [%s]", conf->eap_config->client_cert);
                        } else {
                                conf->eap_config->client_cert = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_EAP_PRIVATEKEY) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->eap_config->private_key = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("private_key [%s]", conf->eap_config->private_key);
+                               DBG("private_key [%s]", conf->eap_config->private_key);
                        } else {
                                conf->eap_config->private_key = NULL;
                        }
+               } else if (g_strcmp0(field, WIFI_CONFIG_EAP_PRIVATEKEY_PASSWORD) == 0) {
+                       if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
+                               conf->eap_config->private_key_password = g_strdup(g_variant_get_string(value, NULL));
+                               DBG("private_key_password[%s]", conf->eap_config->private_key_password);
+                       } else {
+                               conf->eap_config->private_key_password = NULL;
+                       }
                } else if (g_strcmp0(field, WIFI_CONFIG_EAP_IDENTITY) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->eap_config->identity = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("identity [%s]", conf->eap_config->identity);
+                               DBG("identity [%s]", conf->eap_config->identity);
                        } else {
                                conf->eap_config->identity = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_EAP_TYPE) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->eap_config->eap_type = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("eap_type [%s]", conf->eap_config->eap_type);
+                               DBG("eap_type [%s]", conf->eap_config->eap_type);
                        } else {
                                conf->eap_config->eap_type = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_EAP_AUTH_TYPE) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->eap_config->eap_auth_type = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("eap_auth_type [%s]", conf->eap_config->eap_auth_type);
+                               DBG("eap_auth_type [%s]", conf->eap_config->eap_auth_type);
                        } else {
                                conf->eap_config->eap_auth_type = NULL;
                        }
                } else if (g_strcmp0(field, WIFI_CONFIG_EAP_SUBJECT_MATCH) == 0) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) {
                                conf->eap_config->subject_match = g_strdup(g_variant_get_string(value, NULL));
-                               ERR("subject_match [%s]", conf->eap_config->subject_match);
+                               DBG("subject_match [%s]", conf->eap_config->subject_match);
                        } else {
                                conf->eap_config->subject_match = NULL;
                        }
@@ -970,24 +1634,38 @@ gboolean handle_save_eap_configuration(Wifi *wifi, GDBusMethodInvocation *contex
        conf->favorite = TRUE;
        conf->autoconnect = TRUE;
 
-       ret = __get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
+       ret = wifi_config_get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
        if (ret != TRUE) {
                __free_wifi_configuration(conf);
                ERR("Fail to get_wifi_config_group_name");
-               return FALSE;
+               return TRUE;
        }
 
        keyfile = g_key_file_new();
        g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_NAME, conf->name);
        g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_SSID, conf->ssid);
 
-       if (conf->passphrase != NULL)
+       if (conf->passphrase != NULL) {
+               gchar *enc_data = NULL;
+
+               if (conf->is_created == true)
+                       enc_data = _netconfig_encrypt_passphrase(conf->passphrase);
+               else
+                       enc_data = g_strdup(conf->passphrase);
+
+               if (!enc_data) {
+                       ERR("Failed to encrypt the passphrase");
+               } else {
+                       g_free(conf->passphrase);
+                       conf->passphrase = enc_data;
+               }
                g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PASSPHRASE, conf->passphrase);
+       }
 
        g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_FAVORITE, conf->favorite);
        g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_AUTOCONNECT, conf->autoconnect);
 
-       // Optional field
+       /* Optional field */
        if (conf->proxy_address != NULL) {
                g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_METHOD, "manual");
                g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, conf->proxy_address);
@@ -995,27 +1673,63 @@ gboolean handle_save_eap_configuration(Wifi *wifi, GDBusMethodInvocation *contex
 
        if (conf->is_hidden != NULL) {
                gboolean hidden = FALSE;
-               if (g_strcmp0(conf->is_hidden, "TRUE") == 0) {
+               if (g_strcmp0(conf->is_hidden, "TRUE") == 0)
                        hidden = TRUE;
-               }
                g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, hidden);
        }
 
-       ret = _save_configuration(config_id, keyfile);
+       if (conf->eap_config->anonymous_identity != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, conf->eap_config->anonymous_identity);
+
+       if (conf->eap_config->ca_cert != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_EAP_CACERT, conf->eap_config->ca_cert);
+
+       if (conf->eap_config->client_cert != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_EAP_CLIENTCERT, conf->eap_config->client_cert);
+
+       if (conf->eap_config->private_key != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_EAP_PRIVATEKEY, conf->eap_config->private_key);
+
+       if (conf->eap_config->private_key_password != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_EAP_PRIVATEKEY_PASSWORD, conf->eap_config->private_key_password);
+
+       if (conf->eap_config->identity != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_EAP_IDENTITY, conf->eap_config->identity);
+
+       if (conf->eap_config->eap_type != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_EAP_TYPE, conf->eap_config->eap_type);
+
+       if (conf->eap_config->eap_auth_type != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_EAP_AUTH_TYPE, conf->eap_config->eap_auth_type);
+
+       if (conf->eap_config->subject_match != NULL)
+               g_key_file_set_string(keyfile, group_name,
+                       WIFI_CONFIG_EAP_SUBJECT_MATCH, conf->eap_config->subject_match);
+
+       ret = wifi_config_save_configuration(config_id, keyfile);
        if (ret == TRUE) {
-               SLOG(LOG_INFO, "MDM_LOG_USER", "Object=wifi-profile, AccessType=Create, Result=Succeed");
+               INFO("Success to save eap configuration [%s]", config_id);
                wifi_complete_save_eap_configuration(wifi, context);
        } else {
-               SLOG(LOG_INFO, "MDM_LOG_USER", "Object=wifi-profile, AccessType=Create, Result=Failed");
+               INFO("Fail to save eap configuration [%s]", config_id);
                netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailSaveEapConfiguration");
        }
 
        g_key_file_free(keyfile);
+       g_free(group_name);
        __free_wifi_configuration(conf);
 
        g_variant_iter_free(iter);
 
-       return ret;
+       return TRUE;
 }
 
 gboolean handle_remove_configuration(Wifi *wifi, GDBusMethodInvocation *context, const gchar *config_id)
@@ -1025,22 +1739,22 @@ gboolean handle_remove_configuration(Wifi *wifi, GDBusMethodInvocation *context,
        if ((wifi == NULL) || (config_id == NULL)) {
                ERR("Invalid parameter");
                netconfig_error_invalid_parameter(context);
-               return FALSE;
+               return TRUE;
        }
 
        ret = _remove_configuration(config_id);
        if (ret != TRUE) {
-               // no configuration or error
+               /* no configuration or error */
                ERR("No [%s] configuration", config_id);
                netconfig_error_no_profile(context);
-               return FALSE;
+               return TRUE;
        }
 
        wifi_complete_remove_configuration(wifi, context);
-       return ret;
+       return TRUE;
 }
 
-// config field key / value
+/* config field key / value */
 /*
  * [wifi_macaddress_config_id]
  * Name=name (mandatory)
@@ -1066,18 +1780,18 @@ gboolean handle_set_config_field(Wifi *wifi, GDBusMethodInvocation *context,
        gboolean ret = FALSE;
        gchar *keyfile_key = NULL;
 
-       g_return_val_if_fail(wifi != NULL, FALSE);
-       g_return_val_if_fail(config_id != NULL, FALSE);
-       g_return_val_if_fail(key != NULL, FALSE);
+       g_return_val_if_fail(wifi != NULL, TRUE);
+       g_return_val_if_fail(config_id != NULL, TRUE);
+       g_return_val_if_fail(key != NULL, TRUE);
 
-       DBG("Key[%s] Value[%d]", key, value);
+       DBG("Key[%s] Value[%s]", key, value);
 
        if (g_strcmp0(key, WIFI_CONFIG_PROXYADDRESS) == 0) {
                ret = _set_field(config_id, WIFI_CONFIG_PROXY_METHOD, "manual");
                if (!ret) {
                        ERR("Fail to [%s]set_wifi_config_field(%s/manual)", config_id, WIFI_CONFIG_PROXY_METHOD);
                        netconfig_error_invalid_parameter(context);
-                       return FALSE;
+                       return TRUE;
                }
                keyfile_key = g_strdup_printf("%s", WIFI_CONFIG_PROXY_SERVER);
        } else if (g_strcmp0(key, WIFI_CONFIG_HIDDEN) == 0) {
@@ -1101,20 +1815,19 @@ gboolean handle_set_config_field(Wifi *wifi, GDBusMethodInvocation *context,
        } else {
                ERR("Not supported key[%s]", key);
                netconfig_error_invalid_parameter(context);
-               return FALSE;
+               return TRUE;
        }
 
        ret = _set_field(config_id, keyfile_key, (const gchar *)value);
        if (!ret) {
                ERR("Fail to [%s]set_wifi_config_field(%s/%s)", config_id, key, value);
-               ret = FALSE;
        }
 
        if (keyfile_key != NULL)
                g_free(keyfile_key);
 
-       wifi_complete_set_config_field(wifi,context);
-       return ret;
+       wifi_complete_set_config_field(wifi, context);
+       return TRUE;
 }
 
 gboolean handle_get_config_passphrase(Wifi *wifi, GDBusMethodInvocation *context, const gchar *config_id)
@@ -1125,18 +1838,83 @@ gboolean handle_get_config_passphrase(Wifi *wifi, GDBusMethodInvocation *context
        if ((wifi == NULL) || (config_id == NULL)) {
                ERR("Invalid parameter");
                netconfig_error_invalid_parameter(context);
-               return FALSE;
+               return TRUE;
        }
 
        ret = _get_field(config_id, WIFI_CONFIG_PASSPHRASE, &passphrase);
        if (!ret) {
                ERR("Fail to [%s] _get_field(%s)", config_id, WIFI_CONFIG_PASSPHRASE);
                netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "OperationFailed");
-               return FALSE;
+               return TRUE;
        }
 
        wifi_complete_get_config_passphrase(wifi, context, passphrase);
        g_free(passphrase);
 
-       return ret;
+       return TRUE;
+}
+
+gboolean handle_add_vsie(Wifi *wifi, GDBusMethodInvocation *context,
+               int frame_id, const gchar *vsie)
+{
+       DBG("Frame ID: [%d] VSIE: [%s]", frame_id, vsie);
+
+       g_return_val_if_fail(wifi != NULL, TRUE);
+       g_return_val_if_fail(vsie != NULL, TRUE);
+
+       gboolean ret = FALSE;
+
+       ret = _add_vsie(frame_id, vsie);
+       if (!ret) {
+               DBG("Failed to add vsie: %s", vsie);
+               netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "OperationFailed");
+               return TRUE;
+       }
+
+       wifi_complete_add_vsie(wifi, context);
+       return TRUE;
+}
+
+gboolean handle_get_vsie(Wifi *wifi, GDBusMethodInvocation *context,
+               int frame_id)
+{
+       DBG("Frame ID: [%d]", frame_id);
+
+       g_return_val_if_fail(wifi != NULL, TRUE);
+
+       gboolean ret = FALSE;
+       gchar *vsie = NULL;
+
+       ret = _get_vsie(frame_id, &vsie);
+       if (!ret) {
+               DBG("Failed to get vsie for frame:[%d]", frame_id);
+               netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "OperationFailed");
+               return TRUE;
+       }
+
+       DBG("Received vsie: %s", vsie);
+       wifi_complete_get_vsie(wifi, context, vsie);
+
+       return TRUE;
+}
+
+gboolean handle_remove_vsie(Wifi *wifi, GDBusMethodInvocation *context,
+               int frame_id, const gchar *vsie)
+{
+       DBG("Frame ID: [%d] VSIE: [%s]", frame_id, vsie);
+
+       g_return_val_if_fail(wifi != NULL, TRUE);
+       g_return_val_if_fail(vsie != NULL, TRUE);
+
+       gboolean ret = FALSE;
+
+       ret = _remove_vsie(frame_id, vsie);
+       if (!ret) {
+               DBG("Failed to remove vsie: %s", vsie);
+               netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "OperationFailed");
+               return TRUE;
+       }
+
+       wifi_complete_remove_vsie(wifi, context);
+       return TRUE;
 }