Merge "Fix dereference issues" into tizen
[platform/core/api/tethering.git] / src / tethering.c
index 4aa65b9..448cd49 100755 (executable)
@@ -153,7 +153,8 @@ static bool __any_tethering_is_enabled(tethering_h tethering)
 {
        if (tethering_is_enabled(tethering, TETHERING_TYPE_USB) ||
                        tethering_is_enabled(tethering, TETHERING_TYPE_WIFI) ||
-                       tethering_is_enabled(tethering, TETHERING_TYPE_BT))
+                       tethering_is_enabled(tethering, TETHERING_TYPE_BT) ||
+                       tethering_is_enabled(tethering, TETHERING_TYPE_P2P))
                return true;
 
        return false;
@@ -164,12 +165,12 @@ static tethering_error_e __set_security_type(const tethering_wifi_security_type_
        if (security_type != TETHERING_WIFI_SECURITY_TYPE_NONE &&
                        security_type != TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK &&
                        security_type != TETHERING_WIFI_SECURITY_TYPE_WPS) {
-               ERR("Invalid param\n");
+               ERR("Invalid param\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
 
        if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_SECURITY, security_type) < 0) {
-               ERR("vconf_set_int is failed\n");
+               ERR("vconf_set_int is failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -179,13 +180,13 @@ static tethering_error_e __set_security_type(const tethering_wifi_security_type_
 static tethering_error_e __get_security_type(tethering_wifi_security_type_e *security_type)
 {
        if (security_type == NULL) {
-               ERR("Invalid param\n");
+               ERR("Invalid param\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
 
        if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_SECURITY,
                                (int *)security_type) < 0) {
-               ERR("vconf_get_int is failed\n");
+               ERR("vconf_get_int is failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -216,7 +217,7 @@ static bool __get_ssid_from_vconf(const char *path, char *ssid, unsigned int siz
 static tethering_error_e __set_visible(const bool visible)
 {
        if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_HIDE, visible ? 0 : 1) < 0) {
-               ERR("vconf_set_int is failed\n");
+               ERR("vconf_set_int is failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -226,14 +227,14 @@ static tethering_error_e __set_visible(const bool visible)
 static tethering_error_e __get_visible(bool *visible)
 {
        if (visible == NULL) {
-               ERR("Invalid param\n");
+               ERR("Invalid param\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
 
        int hide = 0;
 
        if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_HIDE, &hide) < 0) {
-               ERR("vconf_get_int is failed\n");
+               ERR("vconf_get_int is failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -285,6 +286,7 @@ static tethering_error_e __get_error(int agent_error)
                err = TETHERING_ERROR_INVALID_PARAMETER;
                break;
 
+       //LCOV_EXCL_START
        case MOBILE_AP_ERROR_ALREADY_ENABLED:
                err = TETHERING_ERROR_OPERATION_FAILED;
                break;
@@ -309,7 +311,6 @@ static tethering_error_e __get_error(int agent_error)
                err = TETHERING_ERROR_OPERATION_FAILED;
                break;
 
-       //LCOV_EXCL_START
        case MOBILE_AP_ERROR_NOT_PERMITTED:
                err = TETHERING_ERROR_NOT_PERMITTED;
                break;
@@ -367,6 +368,8 @@ static void __handle_dhcp(GDBusConnection *connection, const gchar *sender_name,
                type = TETHERING_TYPE_WIFI;
        else if (ap_type == MOBILE_AP_TYPE_BT)
                type = TETHERING_TYPE_BT;
+       else if (ap_type == MOBILE_AP_TYPE_P2P)
+               type = TETHERING_TYPE_P2P;
        else {
                ERR("Not supported tethering type [%d]\n", ap_type);
                goto DONE;
@@ -393,9 +396,7 @@ DONE:
        g_free(name);
        DBG("-\n");
 }
-//LCOV_EXCL_STOP
 
-//LCOV_EXCL_START
 static void __handle_net_closed(GDBusConnection *connection, const gchar *sender_name,
                const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                GVariant *parameters, gpointer user_data)
@@ -690,7 +691,7 @@ static void __handle_security_type_changed(GDBusConnection *connection, const gc
        else if (g_strcmp0(buf, TETHERING_WIFI_SECURITY_TYPE_WPS_STR) == 0)
                security_type = TETHERING_WIFI_SECURITY_TYPE_WPS;
        else {
-               SERR("Unknown type : %s\n", buf);
+               SERR("Unknown type : %s\n", buf); //LCOV_EXCL_LINE
                g_free(buf);
                return;
        }
@@ -704,7 +705,7 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const
                const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                GVariant *parameters, gpointer user_data)
 {
-       DBG("+\n");
+       DBG("+\n"); //LCOV_EXCL_LINE
 
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        __tethering_h *th = (__tethering_h *)user_data;
@@ -716,7 +717,7 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const
 
        scb = th->ssid_visibility_changed_cb;
        if (scb == NULL) {
-               DBG("-\n");
+               DBG("-\n"); //LCOV_EXCL_LINE
                return;
        }
        g_variant_get(parameters, "(s)", &buf);
@@ -726,14 +727,14 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const
 
        scb(visible, data);
        g_free(buf);
-       DBG("-\n");
+       DBG("-\n"); //LCOV_EXCL_LINE
 }
 
 static void __handle_passphrase_changed(GDBusConnection *connection, const gchar *sender_name,
                const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                GVariant *parameters, gpointer user_data)
 {
-       DBG("+\n");
+       DBG("+\n"); //LCOV_EXCL_LINE
 
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        __tethering_h *th = (__tethering_h *)user_data;
@@ -748,13 +749,13 @@ static void __handle_passphrase_changed(GDBusConnection *connection, const gchar
        data = th->passphrase_user_data;
 
        pcb(data);
-       DBG("-\n");
+       DBG("-\n"); //LCOV_EXCL_LINE
 }
 
 static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                gpointer user_data)
 {
-       INFO("+\n");
+       INFO("+\n"); //LCOV_EXCL_LINE
 
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        GError *g_error = NULL;
@@ -765,6 +766,9 @@ static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        tethering_enabled_cb ecb = th->enabled_cb[TETHERING_TYPE_WIFI];
        void *data = th->enabled_user_data[TETHERING_TYPE_WIFI];
 
+       if (!_tethering_check_handle((tethering_h)user_data))
+               return;
+
        g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
                //LCOV_EXCL_START
@@ -786,7 +790,7 @@ static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        }
        retry = 0;
 
-       INFO("cfm event : wifi tethering enable info : %d\n", error);
+       INFO("cfm event : wifi tethering enable info : %d\n", error); //LCOV_EXCL_LINE
 
        sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id = g_dbus_connection_signal_subscribe(th->client_bus,
                        NULL, TETHERING_SERVICE_INTERFACE, sigs[E_SIGNAL_WIFI_TETHER_ON].name,
@@ -794,18 +798,18 @@ static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                        sigs[E_SIGNAL_WIFI_TETHER_ON].cb, (gpointer)th, NULL);
 
        if (!ecb) {
-               INFO("-\n");
+               INFO("-\n"); //LCOV_EXCL_LINE
                return;
        }
        ecb(error, TETHERING_TYPE_WIFI, true, data);
        g_variant_unref(g_var);
-       INFO("-\n");
+       INFO("-\n"); //LCOV_EXCL_LINE
 }
 
 static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                gpointer user_data)
 {
-       DBG("+\n");
+       DBG("+\n"); //LCOV_EXCL_LINE
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        GError *g_error = NULL;
        GVariant *g_var;
@@ -816,6 +820,9 @@ static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        tethering_enabled_cb ecb = th->enabled_cb[TETHERING_TYPE_BT];
        void *data = th->enabled_user_data[TETHERING_TYPE_BT];
 
+       if (!_tethering_check_handle((tethering_h)user_data))
+               return;
+
        g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
                //LCOV_EXCL_START
@@ -846,7 +853,7 @@ static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                        sigs[E_SIGNAL_BT_TETHER_ON].cb, (gpointer)th, NULL);
 
        if (!ecb) {
-               DBG("-\n");
+               DBG("-\n"); //LCOV_EXCL_LINE
                return;
        }
 
@@ -869,6 +876,9 @@ static void __usb_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        tethering_enabled_cb ecb = th->enabled_cb[TETHERING_TYPE_USB];
        void *data = th->enabled_user_data[TETHERING_TYPE_USB];
 
+       if (!_tethering_check_handle((tethering_h)user_data))
+               return;
+
        g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
                ERR("DBus error [%s]\n", g_error->message);
@@ -904,12 +914,60 @@ static void __usb_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        ecb(error, TETHERING_TYPE_USB, true, data);
        DBG("-\n");
 }
+
+static void __p2p_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
+                                       gpointer user_data)
+{
+       DBG("+\n");
+
+       _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
+       __tethering_h *th = (__tethering_h *)user_data;
+       GError *g_error = NULL;
+       GVariant *g_var;
+       guint info;
+       tethering_error_e error;
+       tethering_enabled_cb ecb = th->enabled_cb[TETHERING_TYPE_P2P];
+       void *data = th->enabled_user_data[TETHERING_TYPE_P2P];
+
+       if (!_tethering_check_handle((tethering_h)user_data))
+               return;
+
+       g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
+       if (g_error) {
+               ERR("DBus error [%s]\n", g_error->message);
+               if (g_error->code == G_DBUS_ERROR_NO_REPLY &&
+                               ++retry < TETHERING_ERROR_RECOVERY_MAX) {
+                       g_error_free(g_error);
+                       tethering_enable((tethering_h)th, TETHERING_TYPE_P2P);
+                       DBG("-\n");
+                       return;
+               }
+               if (g_error->code == G_DBUS_ERROR_ACCESS_DENIED)
+                       error = TETHERING_ERROR_PERMISSION_DENIED;
+               else
+                       error = TETHERING_ERROR_OPERATION_FAILED;
+               g_error_free(g_error);
+       } else {
+               g_variant_get(g_var, "(u)", &info);
+               g_variant_unref(g_var);
+               error = __get_error(info);
+       }
+       retry = 0;
+
+       if (!ecb) {
+               DBG("-\n");
+               return;
+       }
+
+       ecb(error, TETHERING_TYPE_P2P, true, data);
+       DBG("-\n");
+}
 //LCOV_EXCL_STOP
 
 static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                gpointer user_data)
 {
-       INFO("+\n");
+       INFO("+\n"); //LCOV_EXCL_LINE
 
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        GError *g_error = NULL;
@@ -923,6 +981,9 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        tethering_disabled_cb dcb = NULL;
        void *data = NULL;
 
+       if (!_tethering_check_handle((tethering_h)user_data))
+               return;
+
        g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
                //LCOV_EXCL_START
@@ -976,7 +1037,14 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                if (dcb)
                        dcb(error, type, code, data);
                break;
-       //LCOV_EXCL_STOP
+
+       case MOBILE_AP_DISABLE_P2P_TETHERING_CFM:
+               type = TETHERING_TYPE_P2P;
+               dcb = th->disabled_cb[type];
+               data = th->disabled_user_data[type];
+               if (dcb)
+                       dcb(error, type, code, data);
+               break;
 
        case MOBILE_AP_DISABLE_CFM:
 
@@ -1006,8 +1074,9 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        default:
                ERR("Invalid event\n");
                break;
+       //LCOV_EXCL_STOP
        }
-       INFO("-\n");
+       INFO("-\n"); //LCOV_EXCL_LINE
 }
 
 static void __get_data_usage_cb(GObject *source_object, GAsyncResult *res,
@@ -1038,7 +1107,7 @@ static void __get_data_usage_cb(GObject *source_object, GAsyncResult *res,
                //LCOV_EXCL_STOP
        }
        if (th->data_usage_cb == NULL) {
-               ERR("There is no data_usage_cb\n");
+               ERR("There is no data_usage_cb\n"); //LCOV_EXCL_LINE
                return;
        }
        if (flag) {
@@ -1069,7 +1138,7 @@ static void __settings_reloaded_cb(GObject *source_object, GAsyncResult *res,
 
        g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
-               ERR("DBus fail [%s]\n", g_error->message);
+               ERR("DBus fail [%s]\n", g_error->message); //LCOV_EXCL_LINE
                if (g_error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        tethering_error = TETHERING_ERROR_PERMISSION_DENIED;
                else
@@ -1146,9 +1215,11 @@ static bool __get_intf_name(tethering_type_e type, char *buf, unsigned int len)
                g_strlcpy(buf, TETHERING_BT_IF, len);
                break;
 
+       //LCOV_EXCL_START
        default:
                ERR("Not supported type : %d\n", type);
                return false;
+       //LCOV_EXCL_STOP
        }
        return true;
 }
@@ -1158,10 +1229,11 @@ static bool __get_gateway_addr(tethering_type_e type, char *buf, unsigned int le
        _retvm_if(buf == NULL, false, "parameter(buf) is NULL\n");
 
        switch (type) {
+       //LCOV_EXCL_START
        case TETHERING_TYPE_USB:
                g_strlcpy(buf, TETHERING_USB_GATEWAY, len);
                break;
-
+       //LCOV_EXCL_STOP
        case TETHERING_TYPE_WIFI:
                g_strlcpy(buf, TETHERING_WIFI_GATEWAY, len);
                break;
@@ -1169,10 +1241,11 @@ static bool __get_gateway_addr(tethering_type_e type, char *buf, unsigned int le
        case TETHERING_TYPE_BT:
                g_strlcpy(buf, TETHERING_BT_GATEWAY, len);
                break;
-
+       //LCOV_EXCL_START
        default:
                ERR("Not supported type : %d\n", type);
                return false;
+       //LCOV_EXCL_STOP
        }
        return true;
 }
@@ -1235,7 +1308,7 @@ static int __prepare_wifi_settings(tethering_h tethering, _softap_settings_t *se
        char *ptr = NULL;
 
        if (th == NULL || set == NULL) {
-               ERR("null parameter\n-\n");
+               ERR("null parameter\n-\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
 
@@ -1307,9 +1380,8 @@ static int __prepare_wifi_settings(tethering_h tethering, _softap_settings_t *se
 
 static bool __check_precondition(tethering_type_e type)
 {
-       int dnet_state = 0;
+       int dnet_status = 0;
        int cellular_state = 0;
-       int wifi_state = 0;
 
        /* data network through cellular */
        vconf_get_int(VCONFKEY_NETWORK_CELLULAR_STATE, &cellular_state);
@@ -1318,29 +1390,12 @@ static bool __check_precondition(tethering_type_e type)
                return TRUE;
        }
 
-#ifdef TIZEN_TV_EXT
-       /* data network through ethernet */
-       vconf_get_int(VCONFKEY_NETWORK_STATUS, &dnet_state);
-       if (dnet_state == VCONFKEY_NETWORK_ETHERNET) {
-               INFO("Data Network is connected");
-               return TRUE;
-       }
-#else
-       vconf_get_int(VCONFKEY_DNET_STATE, &dnet_state);
-       if (dnet_state > VCONFKEY_DNET_OFF) {
-               INFO("Data Network is connected");
+       /* data network status */
+       vconf_get_int(VCONFKEY_NETWORK_STATUS, &dnet_status);
+       if ((dnet_status == VCONFKEY_NETWORK_WIFI
+                       && type != TETHERING_TYPE_WIFI)
+               || dnet_status == VCONFKEY_NETWORK_ETHERNET)
                return TRUE;
-       }
-#endif/*TIZEN_TV_EXT*/
-
-       /* data network through wifi */
-       if (type != TETHERING_TYPE_WIFI) {
-               vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
-               if (wifi_state > VCONFKEY_WIFI_UNCONNECTED) {
-                       INFO("Wi-Fi is connected!");
-                       return TRUE;
-               }
-       }
 
        ERR("Network is not available!");
        return FALSE;
@@ -1380,22 +1435,25 @@ API int tethering_create(tethering_h *tethering)
        th->sec_type = TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK;
        th->visibility = true;
        th->mac_filter = false;
-       th->channel = 6;
+       th->channel = TETHERING_WIFI_CHANNEL;
        th->mode_type = TETHERING_WIFI_MODE_TYPE_G;
        th->wifi_max_connected = TETHERING_WIFI_MAX_STA;
-       th->change_mac = false;
 
        if (__generate_initial_passphrase(th->passphrase,
                        sizeof(th->passphrase)) == 0) {
-               ERR("random passphrase generation failed\n"); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START
+               ERR("random passphrase generation failed\n");
                free(th);
                return TETHERING_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
        if (__get_common_ssid(ssid, sizeof(ssid)) != TETHERING_ERROR_NONE) {
-               ERR("common ssid get failed\n"); //LCOV_EXCL_LINE
+               //LCOV_EXCL_START
+               ERR("common ssid get failed\n");
                free(th);
                return TETHERING_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
 
 #if !GLIB_CHECK_VERSION(2, 36, 0)
@@ -1433,7 +1491,8 @@ API int tethering_create(tethering_h *tethering)
        __connect_signals((tethering_h)th);
 
        *tethering = (tethering_h)th;
-       INFO("Tethering Handle : 0x%X\n", th);
+       _tethering_add_handle(th);
+       INFO("Tethering Handle : %p\n", th);
        INFO("-\n");
        return TETHERING_ERROR_NONE;
 }
@@ -1457,18 +1516,12 @@ API int tethering_destroy(tethering_h tethering)
        _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(tethering) is NULL\n");
 
-       GVariant *result = NULL;
        __tethering_h *th = (__tethering_h *)tethering;
 
-       INFO("Tethering Handle : 0x%X\n", th);
-
-       if (th->change_mac) {
-               result = g_dbus_proxy_call_sync(th->client_bus_proxy, "reset_mac", NULL,
-                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
-               g_variant_unref(result);
-       }
+       INFO("Tethering Handle : %p\n", th);
 
        __disconnect_signals(tethering);
+       _tethering_remove_handle(th);
 
        if (th->ssid)
                free(th->ssid);
@@ -1477,6 +1530,7 @@ API int tethering_destroy(tethering_h tethering)
        g_object_unref(th->client_bus_proxy);
        g_object_unref(th->client_bus);
        memset(th, 0x00, sizeof(__tethering_h));
+
        free(th);
 
        INFO("-\n");
@@ -1540,9 +1594,11 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
 
                ret = __prepare_wifi_settings(tethering, &set);
                if (ret != TETHERING_ERROR_NONE) {
+                       //LCOV_EXCL_START
                        ERR("softap settings initialization failed\n");
                        DBG("-\n");
                        return TETHERING_ERROR_OPERATION_FAILED;
+                       //LCOV_EXCL_STOP
                }
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id);
@@ -1558,13 +1614,30 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_BT_TETHER_ON].sig_id);
 
-               g_dbus_proxy_call(proxy, "enable_bt_tethering", NULL,
+               g_dbus_proxy_call(proxy, "enable_bt_tethering",
+                               g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4),
                                G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
                                (GAsyncReadyCallback) __bt_enabled_cfm_cb, (gpointer)tethering);
 
                break;
 
        //LCOV_EXCL_START
+       case TETHERING_TYPE_P2P: {
+               _softap_settings_t p2p_set = {"", "", "", 0, false};
+               ret = __prepare_wifi_settings(tethering, &p2p_set);
+               if (ret != TETHERING_ERROR_NONE) {
+                       ERR("p2p settings initialization failed\n");
+                       DBG("-\n");
+                       return TETHERING_ERROR_OPERATION_FAILED;
+               }
+
+               g_dbus_proxy_call(proxy, "enable_p2p_tethering",
+                               g_variant_new("(ssi)", p2p_set.ssid, p2p_set.key, p2p_set.channel),
+                               G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+                               (GAsyncReadyCallback) __p2p_enabled_cfm_cb, (gpointer)tethering);
+               break;
+       }
+
        case TETHERING_TYPE_ALL: {
                _softap_settings_t set = {"", "", "", 0, false};
 
@@ -1587,7 +1660,9 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
                                sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id);
 
                g_dbus_proxy_call(proxy, "enable_wifi_tethering",
-                               g_variant_new("(ssii)", set.ssid, set.key, set.visibility, set.sec_type),
+                               g_variant_new("(sssiiiiii)", set.ssid, set.key, set.mode,
+                               set.channel, set.visibility, set.mac_filter, set.max_connected,
+                               set.sec_type, TETHERING_ADDRESS_FAMILY_IPV4),
                                G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
                                (GAsyncReadyCallback) __wifi_enabled_cfm_cb, (gpointer)tethering);
 
@@ -1595,11 +1670,11 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_BT_TETHER_ON].sig_id);
 
-               g_dbus_proxy_call(proxy, "enable_usb_tethering", NULL,
+               g_dbus_proxy_call(proxy, "enable_bt_tethering",
+                               g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4),
                                G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
                                (GAsyncReadyCallback) __bt_enabled_cfm_cb, (gpointer)tethering);
                break;
-               //LCOV_EXCL_STOP
        }
        default:
                ERR("Unknown type : %d\n", type);
@@ -1609,6 +1684,7 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
                DBG("-\n");
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
+       //LCOV_EXCL_STOP
 
        g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_USE_DEFAULT);
        INFO("-\n");
@@ -1641,7 +1717,6 @@ API int tethering_ipv6_enable(tethering_h tethering, tethering_type_e type)
        }
 
        switch (type) {
-       //LCOV_EXCL_START
        case TETHERING_TYPE_WIFI: {
                _softap_settings_t set = {"", "", "", 0, false, false, 0, 0};
 
@@ -1761,6 +1836,7 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type)
        GDBusConnection *connection = th->client_bus;
 
        switch (type) {
+       //LCOV_EXCL_START
        case TETHERING_TYPE_USB:
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_USB_TETHER_OFF].sig_id);
@@ -1770,6 +1846,7 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type)
                                (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
 
                break;
+       //LCOV_EXCL_STOP
 
        case TETHERING_TYPE_WIFI:
 
@@ -1793,6 +1870,13 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type)
                                (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
                break;
 
+       //LCOV_EXCL_START
+       case TETHERING_TYPE_P2P:
+               g_dbus_proxy_call(proxy, "disable_p2p_tethering",
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+                               (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
+               break;
+
        case TETHERING_TYPE_ALL:
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_USB_TETHER_OFF].sig_id);
@@ -1822,6 +1906,7 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type)
                ERR("Not supported tethering type [%d]\n", type);
                DBG("-\n");
                return TETHERING_ERROR_INVALID_PARAMETER;
+       //LCOV_EXCL_STOP
        }
        INFO("-\n");
        return TETHERING_ERROR_NONE;
@@ -1861,6 +1946,10 @@ API bool tethering_is_enabled(tethering_h tethering, tethering_type_e type)
                vconf_type = VCONFKEY_MOBILE_HOTSPOT_MODE_BT;
                break;
 
+       case TETHERING_TYPE_P2P:
+               vconf_type = VCONFKEY_MOBILE_HOTSPOT_MODE_P2P;
+               break;
+
        default:
                ERR("Not supported type : %d\n", type);
                break;
@@ -1892,9 +1981,9 @@ API bool tethering_is_enabled(tethering_h tethering, tethering_type_e type)
 API int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address)
 {
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
-       if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE);
+       if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); //LCOV_EXCL_LINE
        else if (type == TETHERING_TYPE_WIFI) CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
-       else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE);
+       else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); //LCOV_EXCL_LINE
 
        _retvm_if(tethering_is_enabled(tethering, type) == false,
                        TETHERING_ERROR_NOT_ENABLED,
@@ -1916,9 +2005,11 @@ API int tethering_get_mac_address(tethering_h tethering, tethering_type_e type,
        _retvm_if(s < 0, TETHERING_ERROR_OPERATION_FAILED,
                        "getting socket is failed\n");
        if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
+               //LCOV_EXCL_START
                ERR("getting mac is failed\n");
                close(s);
                return TETHERING_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
        close(s);
 
@@ -2009,9 +2100,9 @@ API int tethering_get_network_interface_name(tethering_h tethering, tethering_ty
 API int tethering_get_ip_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **ip_address)
 {
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
-       if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE);
+       if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); //LCOV_EXCL_LINE
        else if (type == TETHERING_TYPE_WIFI) CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
-       else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE);
+       else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); //LCOV_EXCL_LINE
 
        _retvm_if(tethering_is_enabled(tethering, type) == false,
                        TETHERING_ERROR_NOT_ENABLED,
@@ -2231,8 +2322,9 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ
                        NULL, G_DBUS_CALL_FLAGS_NONE,
                        -1, th->cancellable, &error);
        if (error)
-               ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
+               ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message); //LCOV_EXCL_LINE
        g_variant_get(result, "(a(a{sv}))", &outer_iter);
+       //LCOV_EXCL_START
        while (g_variant_iter_loop(outer_iter, "(@a{sv})", &station)) {
                g_variant_get(station, "a{sv}", &inner_iter);
                while (g_variant_iter_loop(inner_iter, "{sv}", &key, &value)) {
@@ -2244,6 +2336,8 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ
                                        client.interface = TETHERING_TYPE_WIFI;
                                else if (interface == MOBILE_AP_TYPE_BT)
                                        client.interface = TETHERING_TYPE_BT;
+                               else if (interface == MOBILE_AP_TYPE_P2P)
+                                       client.interface = TETHERING_TYPE_P2P;
                                else {
                                        ERR("Invalid interface\n");
                                        g_free(key);
@@ -2280,10 +2374,16 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ
                g_free(hostname);
                g_free(ip);
                g_free(mac);
+
+               hostname = NULL;
+               ip = NULL;
+               mac = NULL;
+
                g_variant_iter_free(inner_iter);
                if (callback((tethering_client_h)&client, user_data) == false) {
                        DBG("iteration is stopped\n");
                        g_free(client.hostname);
+                       client.hostname = NULL;
                        g_variant_iter_free(outer_iter);
                        g_variant_unref(station);
                        g_variant_unref(result);
@@ -2291,7 +2391,9 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ
                        return TETHERING_ERROR_OPERATION_FAILED;
                }
                g_free(client.hostname);
+               client.hostname = NULL;
        }
+       //LCOV_EXCL_STOP
        g_variant_iter_free(outer_iter);
        g_variant_unref(station);
        g_variant_unref(result);
@@ -2337,7 +2439,7 @@ API int tethering_set_enabled_cb(tethering_h tethering, tethering_type_e type, t
        }
 
        /* TETHERING_TYPE_ALL */
-       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
                th->enabled_cb[ti] = callback;
                th->enabled_user_data[ti] = user_data;
        }
@@ -2379,7 +2481,7 @@ API int tethering_unset_enabled_cb(tethering_h tethering, tethering_type_e type)
        }
 
        /* TETHERING_TYPE_ALL */
-       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
                th->enabled_cb[ti] = NULL;
                th->enabled_user_data[ti] = NULL;
        }
@@ -2425,7 +2527,7 @@ API int tethering_set_disabled_cb(tethering_h tethering, tethering_type_e type,
        }
 
        /* TETHERING_TYPE_ALL */
-       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
                th->disabled_cb[ti] = callback;
                th->disabled_user_data[ti] = user_data;
        }
@@ -2466,7 +2568,7 @@ API int tethering_unset_disabled_cb(tethering_h tethering, tethering_type_e type
        }
 
        /* TETHERING_TYPE_ALL */
-       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
                th->disabled_cb[ti] = NULL;
                th->disabled_user_data[ti] = NULL;
        }
@@ -2512,7 +2614,7 @@ API int tethering_set_connection_state_changed_cb(tethering_h tethering, tetheri
        }
 
        /* TETHERING_TYPE_ALL */
-       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
                th->changed_cb[ti] = callback;
                th->changed_user_data[ti] = user_data;
        }
@@ -2553,7 +2655,7 @@ API int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethe
        }
 
        /* TETHERING_TYPE_ALL */
-       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+       for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
                th->changed_cb[ti] = NULL;
                th->changed_user_data[ti] = NULL;
        }
@@ -2905,7 +3007,7 @@ API int tethering_wifi_get_ssid(tethering_h tethering, char **ssid)
        }
 
        if (*ssid == NULL) {
-               ERR("strdup is failed\n");
+               ERR("strdup is failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OUT_OF_MEMORY;
        }
 
@@ -2941,7 +3043,6 @@ API int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible)
 
        ret = __set_visible(visible);
        if (ret == TETHERING_ERROR_NONE) {
-
                __send_dbus_signal(th->client_bus,
                                SIGNAL_NAME_SSID_VISIBILITY_CHANGED,
                                visible ? SIGNAL_MSG_SSID_VISIBLE :
@@ -3200,13 +3301,13 @@ API int tethering_wifi_reload_settings(tethering_h tethering, tethering_wifi_set
        DBG("+\n");
 
        if (th->settings_reloaded_cb) {
-               ERR("Operation in progress\n");
+               ERR("Operation in progress\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
        ret = __prepare_wifi_settings(tethering, &set);
        if (ret != TETHERING_ERROR_NONE) {
-               ERR("softap settings initialization failed\n");
+               ERR("softap settings initialization failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -3260,19 +3361,19 @@ static int __add_mac_to_file(const char *filepath, const char *mac)
 
        p_mac = strdup(mac);
        if (p_mac == NULL) {
-               ERR("strdup failed\n");
+               ERR("strdup failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OUT_OF_MEMORY;
        }
 
        fp = fopen(filepath, "a+");
        if (!fp) {
-               ERR("fopen is failed\n");
+               ERR("fopen is failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
        while (fgets(line, MAX_BUF_SIZE, fp) != NULL) {
                if (strncmp(mac, line, 17) == 0) {
-                       DBG("MAC %s already exist in the list\n", mac);
+                       DBG("MAC %s already exist in the list\n", mac); //LCOV_EXCL_LINE
                        mac_exist = true;
                        break;
                }
@@ -3447,6 +3548,7 @@ API int tethering_wifi_enable_dhcp(tethering_h tethering, bool enable)
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        result = TETHERING_ERROR_PERMISSION_DENIED;
@@ -3457,6 +3559,7 @@ API int tethering_wifi_enable_dhcp(tethering_h tethering, bool enable)
                th->dhcp_enabled = false;
 
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3494,6 +3597,7 @@ API int tethering_wifi_set_dhcp_range(tethering_h tethering, char *rangestart, c
                        g_variant_new("(ss)", rangestart, rangestop),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3505,6 +3609,7 @@ API int tethering_wifi_set_dhcp_range(tethering_h tethering, char *rangestart, c
                th->dhcp_enabled = false;
 
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3550,9 +3655,11 @@ API int tethering_wifi_set_txpower(tethering_h tethering, unsigned int txpower)
                        G_DBUS_CALL_FLAGS_NONE,
                        -1, th->cancellable, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
                g_clear_error(&error);
                return TETHERING_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
        return TETHERING_ERROR_NONE;
 }
@@ -3582,10 +3689,12 @@ API int tethering_wifi_get_txpower(tethering_h tethering, unsigned int *txpower)
                g_variant_get(result, "(u)", txpower);
                g_variant_unref(result);
        } else {
+               //LCOV_EXCL_START
                if (error)
                        ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
                g_clear_error(&error);
                return TETHERING_ERROR_OPERATION_FAILED;
+               //LCOV_EXCL_STOP
        }
        g_clear_error(&error);
        return TETHERING_ERROR_NONE;
@@ -3611,6 +3720,7 @@ API int tethering_wifi_set_mtu(tethering_h tethering, unsigned int mtu)
                        g_variant_new("(u)", mtu),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3620,6 +3730,7 @@ API int tethering_wifi_set_mtu(tethering_h tethering, unsigned int mtu)
 
                g_error_free(error);
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3651,6 +3762,7 @@ API int tethering_wifi_change_mac(tethering_h tethering, char *mac)
                        g_variant_new("(s)", mac),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3660,13 +3772,14 @@ API int tethering_wifi_change_mac(tethering_h tethering, char *mac)
 
                g_error_free(error);
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
-
        g_variant_unref(parameters);
 
-       th->change_mac = true;
+       if (result == MOBILE_AP_ERROR_NOT_PERMITTED)
+               return TETHERING_ERROR_NOT_SUPPORT_API;
 
        return TETHERING_ERROR_NONE;
 }
@@ -3722,6 +3835,7 @@ API int tethering_wifi_enable_port_forwarding(tethering_h tethering, bool enable
                        g_variant_new("(b)", enable),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3731,6 +3845,7 @@ API int tethering_wifi_enable_port_forwarding(tethering_h tethering, bool enable
 
                g_error_free(error);
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3765,6 +3880,7 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn
                        g_variant_new("(sssisi)", ifname, protocol, org_ip, org_port, final_ip, final_port),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3774,6 +3890,7 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn
 
                g_error_free(error);
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3783,7 +3900,7 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn
 
        list = strdup(cmd);
        if (list == NULL) {
-               ERR("strdup failed\n");
+               ERR("strdup failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OUT_OF_MEMORY;
        }
 
@@ -3811,6 +3928,7 @@ API int tethering_wifi_reset_port_forwarding_rule(tethering_h tethering)
        parameters = g_dbus_proxy_call_sync(proxy, "reset_port_forwarding_rule",
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3820,6 +3938,7 @@ API int tethering_wifi_reset_port_forwarding_rule(tethering_h tethering)
 
                g_error_free(error);
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3880,6 +3999,7 @@ API int tethering_wifi_enable_port_filtering(tethering_h tethering, bool enable)
                        g_variant_new("(b)", enable),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3889,6 +4009,7 @@ API int tethering_wifi_enable_port_filtering(tethering_h tethering, bool enable)
 
                g_error_free(error);
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3923,6 +4044,7 @@ API int tethering_wifi_add_port_filtering_rule(tethering_h tethering, int port,
                        g_variant_new("(isb)", port, protocol, allow),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3932,6 +4054,7 @@ API int tethering_wifi_add_port_filtering_rule(tethering_h tethering, int port,
 
                g_error_free(error);
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3946,7 +4069,7 @@ API int tethering_wifi_add_port_filtering_rule(tethering_h tethering, int port,
 
        list = strdup(cmd);
        if (list == NULL) {
-               ERR("strdup failed\n");
+               ERR("strdup failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OUT_OF_MEMORY;
        }
 
@@ -3979,6 +4102,7 @@ API int tethering_wifi_add_custom_port_filtering_rule(tethering_h tethering, int
                        g_variant_new("(iisb)", port1, port2, protocol, allow),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3988,6 +4112,7 @@ API int tethering_wifi_add_custom_port_filtering_rule(tethering_h tethering, int
 
                g_error_free(error);
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -4002,7 +4127,7 @@ API int tethering_wifi_add_custom_port_filtering_rule(tethering_h tethering, int
 
        list = strdup(cmd);
        if (list == NULL) {
-               ERR("strdup failed\n");
+               ERR("strdup failed\n"); //LCOV_EXCL_LINE
                return TETHERING_ERROR_OUT_OF_MEMORY;
        }
 
@@ -4076,6 +4201,7 @@ API int tethering_wifi_set_vpn_passthrough_rule(tethering_h tethering, tethering
                        g_variant_new("(ib)", type, enable),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -4085,6 +4211,7 @@ API int tethering_wifi_set_vpn_passthrough_rule(tethering_h tethering, tethering
 
                g_error_free(error);
                return result;
+               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -4111,6 +4238,7 @@ API int tethering_wifi_push_wps_button(tethering_h tethering)
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -4120,6 +4248,7 @@ API int tethering_wifi_push_wps_button(tethering_h tethering)
 
                g_error_free(error);
                return ret;
+               //LCOV_EXCL_STOP
        }
 
        if (parameters != NULL) {
@@ -4147,6 +4276,7 @@ API int tethering_wifi_set_wps_pin(tethering_h tethering, const char *wps_pin)
                        g_variant_new("(s)", wps_pin), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
+               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -4156,6 +4286,7 @@ API int tethering_wifi_set_wps_pin(tethering_h tethering, const char *wps_pin)
 
                g_error_free(error);
                return ret;
+               //LCOV_EXCL_STOP
        }
 
        if (parameters != NULL) {