Revert "Added support to add ipv6 route using netlink."
[platform/core/connectivity/net-config.git] / src / utils / util.c
index 8376291..27c2238 100755 (executable)
@@ -17,7 +17,7 @@
  *
  */
 
-#include <app.h>
+#include <dlfcn.h>
 #include <errno.h>
 #include <vconf.h>
 #include <stdio.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
+#include <ctype.h>
 #include <vconf-keys.h>
-#include <syspopup_caller.h>
-#include <bundle.h>
-#include <bundle_internal.h>
-#include <eventsystem.h>
 #include <tzplatform_config.h>
+#include <system_info.h>
 
 #include "log.h"
 #include "util.h"
 #define DBUS_SERVICE_DBUS              "org.freedesktop.DBus"
 #define DBUS_INTERFACE_DBUS            "org.freedesktop.DBus"
 #define MAC_INFO_FILEPATH              tzplatform_mkpath(TZ_SYS_ETC, "/.mac.info")
+#define MAC_ADDRESS_FILEPATH   "/sys/class/net/wlan0/address"
 #define MAC_ADDRESS_MAX_LEN            18
+#define HEADED_PLUGIN_FILEPATH         "/usr/lib/net-config-plugin-headed.so"
+#define TELEPHONY_PLUGIN_FILEPATH      "/usr/lib/net-config-plugin-telephony.so"
 
 static gboolean netconfig_device_picker_test = FALSE;
 static int mdnsd_ref_count = 0;
@@ -55,6 +56,44 @@ typedef struct {
        int conn_id;
 } dnssd_conn_destroy_data;
 
+static gboolean netconfig_plugin_headed_enabled = FALSE;
+static gboolean netconfig_plugin_telephony_enabled = FALSE;
+static void *handle_headed;
+static void *handle_telephony;
+static struct netconfig_headed_plugin_t *headed_plugin;
+static struct netconfig_telephony_plugin_t *telephony_plugin;
+
+static bool is_feature_checked[NETCONFIG_SUPPORTED_FEATURE_MAX] = {0, };
+static bool feature_supported[NETCONFIG_SUPPORTED_FEATURE_MAX] = {0, };
+
+gboolean netconfig_check_passphrase(const gchar *service, const char *passphrase)
+{
+       gsize length;
+
+       if (!passphrase)
+               return FALSE;
+
+       length = strlen(passphrase);
+
+       if (g_str_has_suffix(service, "psk") == TRUE) {
+               if (length == 64) {
+                       for (int i = 0; i < 64; i++)
+                               if (!isxdigit((unsigned char)passphrase[i]))
+                                       return FALSE;
+               } else if (length < 8 || length > 63)
+                       return FALSE;
+       } else if (g_str_has_suffix(service, "wep") == TRUE) {
+               if (length == 10 || length == 26) {
+                       for (int i = 0; i < length; i++)
+                               if (!isxdigit((unsigned char)passphrase[i]))
+                                       return FALSE;
+               } else if (length != 5 && length != 13)
+                       return FALSE;
+       }
+
+       return TRUE;
+}
+
 GKeyFile *netconfig_keyfile_load(const char *pathname)
 {
        GKeyFile *keyfile = NULL;
@@ -197,39 +236,13 @@ static gboolean __netconfig_test_device_picker()
 
 static void __netconfig_pop_device_picker(void)
 {
-#if defined TIZEN_WEARABLE
-       int ret = 0;
-       app_control_h   control = NULL;
-
-       ret = app_control_create(&control);
-       if (APP_CONTROL_ERROR_NONE != ret) {
-               DBG("failed to create app control");
-               return ;
-       }
-
-       app_control_add_extra_data(control, "viewtype", "scanlist");
-
-       app_control_set_app_id(control, "org.tizen.wifi");
-       ret = app_control_send_launch_request(control, NULL, NULL);
-       if (APP_CONTROL_ERROR_NONE == ret)
-               DBG("Launch request sent successfully");
-
-       app_control_destroy(control);
-#else
-       bundle *b = NULL;
-       int wifi_ug_state = 0;
-
-       netconfig_vconf_get_int(VCONFKEY_WIFI_UG_RUN_STATE, &wifi_ug_state);
-       if (wifi_ug_state == VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND)
+       if (!netconfig_plugin_headed_enabled)
                return;
 
-       b = bundle_create();
-
-       DBG("Launch Wi-Fi device picker");
-       syspopup_launch("wifi-qs", b);
+       if (!headed_plugin)
+               return;
 
-       bundle_free(b);
-#endif
+       headed_plugin->pop_device_picker();
 }
 
 static gboolean __netconfig_wifi_try_device_picker(gpointer data)
@@ -307,28 +320,32 @@ void netconfig_wifi_device_picker_service_stop(void)
 
 gboolean netconfig_is_wifi_direct_on(void)
 {
-#if defined TIZEN_P2P_ENABLE
+       if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT))
+               return FALSE;
+
        int wifi_direct_state = 0;
 
        netconfig_vconf_get_int(VCONFKEY_WIFI_DIRECT_STATE, &wifi_direct_state);
 
        DBG("Wi-Fi direct mode %d", wifi_direct_state);
        return (wifi_direct_state != 0) ? TRUE : FALSE;
-#else
-       return FALSE;
-#endif
 }
 
 gboolean netconfig_is_wifi_tethering_on(void)
 {
-#if defined TIZEN_TETHERING_ENABLE
-       int wifi_tethering_state = 0;
+       if (netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_TETHERING)) {
+               int wifi_tethering_state = 0;
+
+               netconfig_vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &wifi_tethering_state);
+               DBG("Wi-Ti tethering mode %d", wifi_tethering_state);
+               if ((wifi_tethering_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI)
+                               || (wifi_tethering_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP)) {
+                       DBG("Mobile AP is on");
+                       return TRUE;
+               }
+       }
 
-       netconfig_vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &wifi_tethering_state);
-       DBG("Wi-Ti tethering mode %d", wifi_tethering_state);
-       if (wifi_tethering_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI)
-               return TRUE;
-#endif
+       DBG("Mobile AP is off");
        return FALSE;
 }
 
@@ -357,7 +374,7 @@ gboolean netconfig_interface_up(const char *ifname)
 
        close(fd);
 
-       DBG("Successfully activated wireless interface");
+       DBG("Successfully activated wireless interface %s", ifname);
        return TRUE;
 }
 
@@ -386,7 +403,7 @@ gboolean netconfig_interface_down(const char *ifname)
 
        close(fd);
 
-       DBG("Successfully de-activated wireless interface");
+       DBG("Successfully de-activated wireless interface %s", ifname);
        return TRUE;
 }
 
@@ -438,6 +455,58 @@ int netconfig_execute_file(const char *file_path,
        return -EIO;
 }
 
+int netconfig_execute_cmd(const char *cmd)
+{
+       if (cmd == NULL)
+               return -EIO;
+
+       pid_t pid = 0;
+       int status = 0;
+       int rv = 0;
+       errno = 0;
+       char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+       gchar **args = NULL;
+
+       DBG("command: %s", cmd);
+
+       args = g_strsplit_set(cmd, " ", -1);
+
+       if (!(pid = fork())) {
+               DBG("pid(%d), ppid (%d)", getpid(), getppid());
+
+               errno = 0;
+               if (execv(args[0], args) == -1) {
+                       strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+                       DBG("Fail to execute command (%s)", error_buf);
+                       g_strfreev(args);
+                       exit(1);
+               }
+       } else if (pid > 0) {
+               if (waitpid(pid, &status, 0) == -1)
+                       DBG("wait pid (%u) status (%d)", pid, status);
+
+               if (WIFEXITED(status)) {
+                       rv = WEXITSTATUS(status);
+                       DBG("exited, status=%d", rv);
+               } else if (WIFSIGNALED(status)) {
+                       DBG("killed by signal %d", WTERMSIG(status));
+               } else if (WIFSTOPPED(status)) {
+                       DBG("stopped by signal %d", WSTOPSIG(status));
+               } else if (WIFCONTINUED(status)) {
+                       DBG("continued");
+               }
+
+               g_strfreev(args);
+               return rv;
+       }
+
+       strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+       DBG("failed to fork(%s)", error_buf);
+       g_strfreev(args);
+
+       return -EIO;
+}
+
 static void on_clat_handler()
 {
        pid_t clat_pid = 0;
@@ -494,6 +563,62 @@ int netconfig_execute_clatd(const char *file_path, char *const args[])
        return -EIO;
 }
 
+static void no_wait_signal_handler()
+{
+       pid_t child_pid = 0;
+       int state = 0;
+
+       child_pid = waitpid(-1, &state, WNOHANG);
+
+       DBG("child_id(%d) state(%d)", child_pid, WEXITSTATUS(state));
+}
+
+int netconfig_execute_file_no_wait(const char *file_path, char *const args[])
+{
+       pid_t pid = 0;
+       int rv = 0;
+       errno = 0;
+       register unsigned int index = 0;
+
+       struct sigaction act;
+       int state = 0;
+       char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+
+       act.sa_handler = no_wait_signal_handler;
+       sigemptyset(&act.sa_mask);
+       act.sa_flags = 0;
+
+       state = sigaction(SIGCHLD, &act, 0);
+       if (state != 0) {
+               DBG("sigaction() : %d");
+               return -1;
+       }
+
+       while (args[index] != NULL) {
+               DBG("%s", args[index]);
+               index++;
+       }
+
+       if (!(pid = fork())) {
+               DBG("pid(%d), ppid (%d)", getpid(), getppid());
+               DBG("Inside child, exec (%s) command", file_path);
+
+               errno = 0;
+               if (execvp(file_path, args) == -1) {
+                       ERR("Fail to execute command (%s)",
+                               strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER));
+                       return -1;
+               }
+       } else if (pid > 0) {
+               ERR("Successfully launched child process");
+               return rv;
+       }
+
+       DBG("failed to fork(%s)",
+               strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER));
+       return -EIO;
+}
+
 int __netconfig_get_interface_index(const char *interface_name)
 {
        struct ifreq ifr;
@@ -520,6 +645,7 @@ int __netconfig_get_interface_index(const char *interface_name)
        close(sock);
 
        if (result < 0) {
+               strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
                DBG("Failed to get ifr index: %s", error_buf);
                return -1;
        }
@@ -750,7 +876,11 @@ int netconfig_del_route_ipv6(gchar *ip_addr, gchar *interface, gchar *gateway, u
 
 gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context)
 {
-#if defined TIZEN_P2P_ENABLE
+       if (!netconfig_check_feature_supported(NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT)) {
+               wifi_complete_launch_direct(wifi, context);
+               return TRUE;
+       }
+
        int ret = 0;
        DBG("Launch Wi-Fi direct daemon");
 
@@ -762,15 +892,11 @@ gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context)
        if (ret < 0) {
                ERR("Failed to launch Wi-Fi direct daemon");
                netconfig_error_wifi_direct_failed(context);
-               return FALSE;
+               return TRUE;
        }
 
        wifi_complete_launch_direct(wifi, context);
        return TRUE;
-#else
-       wifi_complete_launch_direct(wifi, context);
-       return FALSE;
-#endif
 }
 
 int execute_mdnsd_script(char* op)
@@ -828,6 +954,12 @@ static void register_dnssd_conn_destroy_signal(gchar *name)
        }
 
        data = g_try_malloc0(sizeof(dnssd_conn_destroy_data));
+
+       if (data == NULL) {
+               ERR("Out of Memory!");
+               return;
+       }
+
        data->conn_name = g_strdup(name);
 
        data->conn_id = g_dbus_connection_signal_subscribe(connection,
@@ -846,7 +978,7 @@ gboolean handle_launch_mdns(Network *object, GDBusMethodInvocation *context,
        if (execute_mdnsd_script("start") < 0) {
                ERR("Failed to launch mdnsresponder daemon");
                netconfig_error_invalid_parameter(context);
-               return FALSE;
+               return TRUE;
        }
 
        mdnsd_ref_count++;
@@ -859,105 +991,140 @@ gboolean handle_launch_mdns(Network *object, GDBusMethodInvocation *context,
 
 gboolean netconfig_send_notification_to_net_popup(const char * noti, const char * ssid)
 {
-       int ret = 0;
-       bundle *b;
-       static gboolean is_found_noti_exists = FALSE;
-       static gboolean is_portal_noti_exists = FALSE;
+       if (!netconfig_plugin_headed_enabled)
+               return FALSE;
 
-       if (noti == NULL) {
-               ERR("Invalid notification");
+       if (!headed_plugin)
                return FALSE;
-       }
 
-       if (g_strcmp0(noti, NETCONFIG_DEL_FOUND_AP_NOTI) == 0) {
-               if (is_found_noti_exists == FALSE)
-                       return TRUE;
+       return headed_plugin->send_notification_to_net_popup(noti, ssid);
+}
 
-               is_found_noti_exists = FALSE;
-       } else if (g_strcmp0(noti, NETCONFIG_ADD_FOUND_AP_NOTI) == 0) {
-               if (is_found_noti_exists == TRUE)
-                       return TRUE;
+int netconfig_send_message_to_net_popup(const char *title,
+               const char *content, const char *type, const char *ssid)
+{
+       if (!netconfig_plugin_headed_enabled)
+               return 0;
 
-               is_found_noti_exists = TRUE;
-       } else if (g_strcmp0(noti, NETCONFIG_ADD_PORTAL_NOTI) == 0) {
-               if (is_portal_noti_exists == TRUE)
-                       return TRUE;
+       if (!headed_plugin)
+               return 0;
 
-               is_portal_noti_exists = TRUE;
-       } else if (g_strcmp0(noti, NETCONFIG_DEL_PORTAL_NOTI) == 0) {
-               if (is_portal_noti_exists == FALSE)
-                       return TRUE;
+       return headed_plugin->send_message_to_net_popup(title, content, type, ssid);
+}
 
-               is_portal_noti_exists = FALSE;
-       }
+int netconfig_send_restriction_to_net_popup(const char *title,
+               const char *type, const char *restriction)
+{
+       if (!netconfig_plugin_headed_enabled)
+               return 0;
 
-       b = bundle_create();
-       bundle_add(b, "_SYSPOPUP_TYPE_", noti);
+       if (!headed_plugin)
+               return 0;
 
-       if (ssid != NULL) {
-               DBG("ssid (%s)", ssid);
-               bundle_add(b, "_AP_NAME_", ssid);
-       }
+       return headed_plugin->send_restriction_to_net_popup(title, type, restriction);
+}
+
+void netconfig_set_system_event(int sys_evt, int evt_key, int evt_val)
+{
+       if (!netconfig_plugin_headed_enabled)
+               return;
 
-       ret = syspopup_launch("net-popup", b);
+       if (!headed_plugin)
+               return;
 
-       bundle_free(b);
+       headed_plugin->set_system_event(sys_evt, evt_key, evt_val);
+}
 
-       if (ret < 0) {
-               ERR("Unable to launch noti-popup. Err = %d", ret);
+void __netconfig_pop_wifi_connected_poppup(const char *ssid)
+{
+       if (!netconfig_plugin_headed_enabled)
+               return;
+
+       if (!headed_plugin)
+               return;
+
+       headed_plugin->pop_wifi_connected_poppup(ssid);
+}
+
+void netconfig_get_telephony_network_type(int *svctype, int *pstype)
+{
+       if (!netconfig_plugin_telephony_enabled)
+               return;
+
+       if (!telephony_plugin)
+               return;
+
+       telephony_plugin->get_telephony_network_type(svctype, pstype);
+}
+
+gboolean __netconfig_wifi_get_sim_imsi(Wifi *wifi, GDBusMethodInvocation *context)
+{
+       if (!netconfig_plugin_telephony_enabled)
                return FALSE;
-       }
 
-       DBG("Successfully sent notification (%s)", noti);
-       return TRUE;
+       if (!telephony_plugin)
+               return FALSE;
+
+       return telephony_plugin->wifi_get_sim_imsi(wifi, context);
 }
 
-int netconfig_send_message_to_net_popup(const char *title,
-               const char *content, const char *type, const char *ssid)
+netconfig_error_e __netconfig_wifi_req_aka_auth(GArray *rand_data, GArray *autn_data,
+               GDBusMethodInvocation *context, struct wifi_authentication_data **data)
 {
-       int ret = 0;
-       bundle *b = bundle_create();
+       if (!netconfig_plugin_telephony_enabled)
+               return NETCONFIG_ERROR_INTERNAL;
 
-       bundle_add(b, "_SYSPOPUP_TITLE_", title);
-       bundle_add(b, "_SYSPOPUP_CONTENT_", content);
-       bundle_add(b, "_SYSPOPUP_TYPE_", type);
-       bundle_add(b, "_AP_NAME_", ssid);
+       if (!telephony_plugin)
+               return NETCONFIG_ERROR_INTERNAL;
 
-       ret = syspopup_launch("net-popup", b);
+       return telephony_plugin->wifi_req_aka_auth(rand_data, autn_data, context, data);
+}
 
-       bundle_free(b);
+gboolean __netconfig_wifi_req_sim_auth(GArray *rand_data,
+               GDBusMethodInvocation *context, struct wifi_authentication_data **data)
+{
+       if (!netconfig_plugin_telephony_enabled)
+               return FALSE;
 
-       return ret;
+       if (!telephony_plugin)
+               return FALSE;
+
+       return telephony_plugin->wifi_req_sim_auth(rand_data, context, data);
 }
 
-int netconfig_send_restriction_to_net_popup(const char *title,
-               const char *type, const char *restriction)
+gboolean netconfig_tapi_check_sim_state(void)
 {
-       int ret = 0;
-       bundle *b = bundle_create();
+       if (!netconfig_plugin_telephony_enabled)
+               return FALSE;
 
-       bundle_add(b, "_SYSPOPUP_TITLE_", title);
-       bundle_add(b, "_SYSPOPUP_CONTENT_", "security restriction");
-       bundle_add(b, "_SYSPOPUP_TYPE_", type);
-       bundle_add(b, "_RESTRICTED_TYPE_", restriction);
+       if (!telephony_plugin)
+               return FALSE;
 
-       ret = syspopup_launch("net-popup", b);
+       return telephony_plugin->tapi_check_sim_state();
+}
 
-       bundle_free(b);
+gboolean __netconfig_wifi_get_aka_authdata(Wifi *wifi,
+               GDBusMethodInvocation *context, struct wifi_authentication_data **data)
+{
+       if (!netconfig_plugin_telephony_enabled)
+               return FALSE;
 
-       return ret;
+       if (!telephony_plugin)
+               return FALSE;
+
+       return telephony_plugin->wifi_get_aka_authdata(wifi, context, data);
 }
 
-void netconfig_set_system_event(const char * sys_evt, const char * evt_key, const char * evt_val)
+gboolean __netconfig_wifi_get_sim_authdata(Wifi *wifi,
+               GDBusMethodInvocation *context, struct wifi_authentication_data **data)
 {
-       bundle *b = NULL;
+       if (!netconfig_plugin_telephony_enabled)
+               return FALSE;
 
-       DBG("System event set [%s : %s : %s]", sys_evt, evt_key, evt_val);
+       if (!telephony_plugin)
+               return FALSE;
 
-       b = bundle_create();
-       bundle_add_str(b, evt_key, evt_val);
-       eventsystem_send_system_event(sys_evt, b);
-       bundle_free(b);
+       return telephony_plugin->wifi_get_sim_authdata(wifi, context, data);
 }
 
 void netconfig_set_vconf_int(const char * key, int value)
@@ -1054,7 +1221,11 @@ void netconfig_set_mac_address_from_file(void)
        file = fopen(MAC_INFO_FILEPATH, "r");
        if (file == NULL) {
                ERR("Fail to open %s", MAC_INFO_FILEPATH);
-               return;
+               file = fopen(MAC_ADDRESS_FILEPATH, "r");
+               if (file == NULL) {
+                       ERR("Fail to open %s", MAC_ADDRESS_FILEPATH);
+                       return;
+               }
        }
        if (fgets(mac_str, sizeof(mac_str), file) == NULL) {
                ERR("Fail to read mac address");
@@ -1075,3 +1246,120 @@ void netconfig_set_mac_address_from_file(void)
        g_free(mac_lower_str);
        fclose(file);
 }
+
+tizen_profile_t _get_tizen_profile()
+{
+       static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+       if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+               return profile;
+
+       char *profileName;
+       system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+       switch (*profileName) {
+       case 'm':
+       case 'M':
+               profile = TIZEN_PROFILE_MOBILE;
+               break;
+       case 'w':
+       case 'W':
+               profile = TIZEN_PROFILE_WEARABLE;
+               break;
+       case 't':
+       case 'T':
+               profile = TIZEN_PROFILE_TV;
+               break;
+       case 'i':
+       case 'I':
+               profile = TIZEN_PROFILE_IVI;
+               break;
+       default: // common or unknown ==> ALL ARE COMMON.
+               profile = TIZEN_PROFILE_COMMON;
+       }
+       free(profileName);
+
+       return profile;
+}
+
+void netconfig_plugin_init()
+{
+       handle_headed = dlopen(HEADED_PLUGIN_FILEPATH, RTLD_NOW);
+       if (!handle_headed) {
+               ERR("Can't load %s: %s", HEADED_PLUGIN_FILEPATH, dlerror());
+       } else {
+               headed_plugin = dlsym(handle_headed, "netconfig_headed_plugin");
+               if (!headed_plugin) {
+                       ERR("Can't load symbol: %s", dlerror());
+                       dlclose(handle_headed);
+               } else {
+                       netconfig_plugin_headed_enabled = TRUE;
+               }
+       }
+
+       handle_telephony = dlopen(TELEPHONY_PLUGIN_FILEPATH, RTLD_NOW);
+       if (!handle_telephony) {
+               ERR("Can't load %s: %s", TELEPHONY_PLUGIN_FILEPATH, dlerror());
+       } else {
+               telephony_plugin = dlsym(handle_telephony, "netconfig_telephony_plugin");
+               if (!telephony_plugin) {
+                       ERR("Can't load symbol: %s", dlerror());
+                       dlclose(handle_telephony);
+               } else {
+                       netconfig_plugin_telephony_enabled = TRUE;
+               }
+       }
+}
+
+void netconfig_plugin_deinit()
+{
+       if (netconfig_plugin_headed_enabled) {
+               netconfig_plugin_headed_enabled = FALSE;
+               dlclose(handle_headed);
+       }
+
+       if (netconfig_plugin_telephony_enabled) {
+               netconfig_plugin_telephony_enabled = FALSE;
+               dlclose(handle_telephony);
+       }
+}
+
+gboolean netconfig_get_headed_plugin_flag()
+{
+       return netconfig_plugin_headed_enabled;
+}
+
+gboolean netconfig_get_telephony_plugin_flag()
+{
+       return netconfig_plugin_telephony_enabled;
+}
+
+bool netconfig_check_feature_supported(netconfig_supported_feature_e feature)
+{
+       const char *key = NULL;
+
+       if (!is_feature_checked[feature]) {
+               switch (feature) {
+               case NETCONFIG_SUPPORTED_FEATURE_ETHERNET:
+                       key = ETHERNET_FEATURE;
+                       break;
+               case NETCONFIG_SUPPORTED_FEATURE_TETHERING:
+                       key = TETHERING_FEATURE;
+                       break;
+               case NETCONFIG_SUPPORTED_FEATURE_WIFI_DIRECT:
+                       key = WIFI_DIRECT_FEATURE;
+                       break;
+               case NETCONFIG_SUPPORTED_FEATURE_WIFI_SOFTAP:
+                       key = WIFI_SOFTAP_FEATURE;
+                       break;
+               default:
+                       ERR("Uknown feature");
+                       return false;
+               }
+
+               if (system_info_get_platform_bool(key, &feature_supported[feature]) < 0) {
+                       ERR("Get feature is failed");
+                       return false;
+               }
+               is_feature_checked[feature] = true;
+       }
+       return feature_supported[feature];
+}