Fixed memory leak
[platform/core/connectivity/net-config.git] / src / network-state.c
index f36607f..9987d1f 100755 (executable)
@@ -28,9 +28,6 @@
 #include <sys/ioctl.h>
 #include <ITapiSim.h>
 #include <TapiUtility.h>
-#include <bundle.h>
-#include <bundle_internal.h>
-#include <eventsystem.h>
 
 #include "log.h"
 #include "util.h"
 #include "wifi-state.h"
 #include "wifi-power.h"
 #include "network-state.h"
+#include "network-dpm.h"
 #include "network-monitor.h"
 #include "netsupplicant.h"
 #include "wifi-tel-intf.h"
-#include "clatd-handler.h"
 
 #include "generated-code.h"
 /* Define TCP buffer sizes for various networks */
@@ -107,9 +104,8 @@ static gboolean __netconfig_is_connected(GVariantIter *array)
        const gchar *value = NULL;
 
        while (g_variant_iter_loop(array, "{sv}", &key, &variant)) {
-               if (g_strcmp0(key, "State") != 0) {
+               if (g_strcmp0(key, "State") != 0)
                        continue;
-               }
 
                if (g_variant_is_of_type(variant, G_VARIANT_TYPE_STRING)) {
                        value = g_variant_get_string(variant, NULL);
@@ -143,13 +139,11 @@ static char *__netconfig_get_default_profile(void)
 
        g_variant_get(message, "(a(oa{sv}))", &iter);
        while (g_variant_iter_loop(iter, "(oa{sv})", &object_path, &next)) {
-               if (object_path == NULL) {
+               if (object_path == NULL)
                        continue;
-               }
 
-               if(netconfig_is_cellular_profile(object_path) && !netconfig_is_cellular_internet_profile(object_path)){
+               if (netconfig_is_cellular_profile(object_path) && !netconfig_is_cellular_internet_profile(object_path))
                        continue;
-               }
 
                if (__netconfig_is_connected(next) == TRUE) {
                        default_profile = g_strdup(object_path);
@@ -167,20 +161,41 @@ static char *__netconfig_get_default_profile(void)
 static void __netconfig_get_default_connection_info(const char *profile)
 {
        GVariant *message = NULL, *variant = NULL, *variant2 = NULL;
-       GVariantIter *iter = NULL, *iter1 = NULL;
+       GVariantIter *iter = NULL, *iter1 = NULL,  *service = NULL;
        GVariant *next = NULL;
+       gchar *obj_path;
        gchar *key = NULL;
        gchar *key1 = NULL;
        gchar *key2 = NULL;
+       gboolean found_profile = 0;
 
-       message = netconfig_invoke_dbus_method(CONNMAN_SERVICE, profile,
-                       CONNMAN_SERVICE_INTERFACE, "GetProperties", NULL);
+       message = netconfig_invoke_dbus_method(CONNMAN_SERVICE,
+                       CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
+                       "GetServices", NULL);
        if (message == NULL) {
-               ERR("Failed to get service properties");
+               ERR("Failed to get services informations");
+               goto done;
+       }
+
+       g_variant_get(message, "(a(oa{sv}))", &service);
+       if (service == NULL) {
+               ERR("Failed to get services iter");
+               goto done;
+       }
+
+       while (g_variant_iter_loop(service, "(oa{sv})", &obj_path, &iter)) {
+               if (g_strcmp0(obj_path, profile) == 0) {
+                       g_free(obj_path);
+                       found_profile = 1;
+                       break;
+               }
+       }
+
+       if (iter == NULL || found_profile == 0) {
+               ERR("Profile %s doesn't exist", profile);
                goto done;
        }
 
-       g_variant_get(message, "(a{sv})", &iter);
        while (g_variant_iter_loop(iter, "{sv}", &key, &next)) {
                const gchar *value = NULL;
                guint16 freq = 0;
@@ -193,30 +208,42 @@ static void __netconfig_get_default_connection_info(const char *profile)
                        }
                } else if (g_strcmp0(key, "Ethernet") == 0) {
                        g_variant_get(next, "a{sv}", &iter1);
+                       if (iter1 == NULL)
+                               continue;
                        while (g_variant_iter_loop(iter1, "{sv}", &key1, &variant)) {
                                if (g_strcmp0(key1, "Interface") == 0) {
                                        value = g_variant_get_string(variant, NULL);
                                        netconfig_default_connection_info.ifname = g_strdup(value);
                                }
                        }
+                       g_variant_iter_free(iter1);
                } else if (g_strcmp0(key, "IPv4") == 0) {
                        g_variant_get(next, "a{sv}", &iter1);
+                       if (iter1 == NULL)
+                               continue;
                        while (g_variant_iter_loop(iter1, "{sv}", &key1, &variant)) {
                                if (g_strcmp0(key1, "Address") == 0) {
                                        value = g_variant_get_string(variant, NULL);
                                        netconfig_default_connection_info.ipaddress = g_strdup(value);
                                }
                        }
+                       g_variant_iter_free(iter1);
                } else if (g_strcmp0(key, "IPv6") == 0) {
                        g_variant_get(next, "a{sv}", &iter1);
+                       if (iter1 == NULL)
+                               continue;
                        while (g_variant_iter_loop(iter1, "{sv}", &key1, &variant)) {
                                if (g_strcmp0(key1, "Address") == 0) {
                                        value = g_variant_get_string(variant, NULL);
                                        netconfig_default_connection_info.ipaddress6 = g_strdup(value);
                                }
                        }
+                       g_variant_iter_free(iter1);
+
                } else if (g_strcmp0(key, "Proxy") == 0) {
                        g_variant_get(next, "a{sv}", &iter1);
+                       if (iter1 == NULL)
+                               continue;
                        while (g_variant_iter_loop(iter1, "{sv}", &key2, &variant2)) {
                                GVariantIter *iter_sub = NULL;
 
@@ -250,6 +277,7 @@ static void __netconfig_get_default_connection_info(const char *profile)
                                        }
                                }
                        }
+                       g_variant_iter_free(iter1);
                } else if (g_strcmp0(key, "Frequency") == 0) {
                        if (g_variant_is_of_type(next, G_VARIANT_TYPE_UINT16)) {
                                freq = g_variant_get_uint16(next);
@@ -263,10 +291,10 @@ done:
                g_variant_unref(message);
 
        if (iter)
-               g_variant_iter_free (iter);
+               g_variant_iter_free(iter);
 
-       if (iter1)
-               g_variant_iter_free (iter1);
+       if (service)
+               g_variant_iter_free(service);
 
        return;
 }
@@ -426,7 +454,7 @@ static void __netconfig_update_default_connection_info(void)
        else
                DBG("%s: ip(%s) proxy(%s)", profile, ip_addr, proxy_addr);
 
-       vconf_get_int(VCONFKEY_NETWORK_STATUS, &old_network_status);
+       netconfig_vconf_get_int(VCONFKEY_NETWORK_STATUS, &old_network_status);
 
        if (profile == NULL && old_network_status != VCONFKEY_NETWORK_OFF) {
                netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_OFF);
@@ -439,10 +467,7 @@ static void __netconfig_update_default_connection_info(void)
 
                DBG("Successfully clear IP and PROXY up");
 
-               /* Disable clatd if it is in running state */
-               netconfig_clatd_disable();
-       }
-       else if (profile != NULL) {
+       } else if (profile != NULL) {
                char *old_ip = vconf_get_str(VCONFKEY_NETWORK_IP);
                char *old_proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
 
@@ -450,39 +475,31 @@ static void __netconfig_update_default_connection_info(void)
                        netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_WIFI);
                        netconfig_set_vconf_int("memory/private/wifi/frequency", freq);
 
-                       netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS,
-                               EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_WIFI);
-               }
-               else if (netconfig_is_cellular_profile(profile) ){
+                       netconfig_set_system_event(SYS_EVT_NETWORK_STATUS,
+                               EKEY_NETWORK_STATUS, EVAL_NETWORK_WIFI);
+               } else if (netconfig_is_cellular_profile(profile)) {
 
-                       if( !netconfig_is_cellular_internet_profile(profile)){
+                       if (!netconfig_is_cellular_internet_profile(profile)) {
                                DBG("connection is not a internet profile - stop to update the cellular state");
                                return;
                        }
 
                        netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_CELLULAR);
 
-                       netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS,
-                               EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_CELLULAR);
-
-                       /* Enable clatd if IPv6 is set and no IPv4 address */
-                       if (!ip_addr && ip_addr6 )
-                               netconfig_clatd_enable();
-               }
-               else if (netconfig_is_ethernet_profile(profile) == TRUE){
+                       netconfig_set_system_event(SYS_EVT_NETWORK_STATUS,
+                               EKEY_NETWORK_STATUS, EVAL_NETWORK_CELLULAR);
+               } else if (netconfig_is_ethernet_profile(profile) == TRUE) {
                        netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_ETHERNET);
-                       netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS,
-                               EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_ETHERNET);
-               }
-               else if (netconfig_is_bluetooth_profile(profile) == TRUE){
+                       netconfig_set_system_event(SYS_EVT_NETWORK_STATUS,
+                               EKEY_NETWORK_STATUS, EVAL_NETWORK_ETHERNET);
+               } else if (netconfig_is_bluetooth_profile(profile) == TRUE) {
                        netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_BLUETOOTH);
-                       netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS,
-                               EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_BT);
-               }
-               else{
+                       netconfig_set_system_event(SYS_EVT_NETWORK_STATUS,
+                               EKEY_NETWORK_STATUS, EVAL_NETWORK_BT);
+               } else{
                        netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_OFF);
-                       netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS,
-                               EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_DISCONNECTED);
+                       netconfig_set_system_event(SYS_EVT_NETWORK_STATUS,
+                               EKEY_NETWORK_STATUS, EVAL_NETWORK_DISCONNECTED);
                }
 
                if (g_strcmp0(old_ip, ip_addr) != 0 || old_ip == NULL) {
@@ -506,10 +523,6 @@ static void __netconfig_update_default_connection_info(void)
                netconfig_set_vconf_int(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND, 1);
 
                DBG("Successfully update default network configuration");
-
-               /* Disable clatd if it is in running state */
-               if (netconfig_is_cellular_profile(profile) != TRUE)
-                       netconfig_clatd_disable();
        }
 
        __netconfig_adjust_tcp_buffer_size();
@@ -534,9 +547,8 @@ static gboolean __netconfig_is_tech_state_connected(void)
 
        g_variant_get(message, "(a(oa{sv}))", &iter);
        while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) {
-               if (path == NULL) {
+               if (path == NULL)
                        continue;
-               }
 
                while (g_variant_iter_loop(next, "{sv}", &key, &variant)) {
                        gboolean data;
@@ -580,9 +592,8 @@ static void __netconfig_update_if_service_connected(void)
 
        g_variant_get(message, "(a(oa{sv}))", &iter);
        while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) {
-               if (path == NULL) {
+               if (path == NULL)
                        continue;
-               }
 
                if (g_str_has_prefix(path,
                                                CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == TRUE) {
@@ -629,44 +640,23 @@ done:
 
 static void __netconfig_network_notify_result(const char *sig_name, const char *key)
 {
-       gboolean reply;
+       GVariantBuilder *builder;
        GVariant *params;
-       GVariantBuilder *builder = NULL;
-       GDBusConnection *connection = NULL;
-       GError *error = NULL;
-       const char *prop_key = "key";
 
        INFO("[Signal] %s %s", sig_name, key);
 
-       connection = netdbus_get_connection();
-       if (connection == NULL) {
-               ERR("Failed to get GDBus Connection");
-               return;
-       }
+       builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+       g_variant_builder_add(builder, "{sv}", "key", g_variant_new_string(key));
 
-       builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
-       g_variant_builder_add(builder, "{sv}", prop_key, g_variant_new_string(key));
        params = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
-
        g_variant_builder_unref(builder);
 
-       reply = g_dbus_connection_emit_signal(connection,
-                       NULL,
-                       NETCONFIG_NETWORK_PATH,
-                       NETCONFIG_NETWORK_INTERFACE,
-                       sig_name,
-                       params,
-                       &error);
-
-       if (reply != TRUE) {
-               if (error != NULL) {
-                       ERR("Failed to send signal [%s]", error->message);
-                       g_error_free(error);
-               }
-               return;
-       }
+       netconfig_dbus_emit_signal(NULL,
+                               NETCONFIG_NETWORK_PATH,
+                               NETCONFIG_NETWORK_INTERFACE,
+                               sig_name,
+                               params);
 
-       INFO("Sent signal (%s), key (%s)", sig_name, key);
        return;
 }
 
@@ -799,17 +789,17 @@ void netconfig_update_default_profile(const char *profile)
                }
        }
 
-       //default profile is NULL and new connected profile is NULL
-       if( !profile ){
+       /* default profile is NULL and new connected profile is NULL */
+       if (!profile) {
                profile = __netconfig_get_default_profile();
 
                if (profile && netconfig_is_cellular_profile(profile) &&
-                       !netconfig_is_cellular_internet_profile(profile)){
+                       !netconfig_is_cellular_internet_profile(profile)) {
                        DBG("not a default cellular profile");
                        profile = NULL;
                }
 
-               if(!profile){
+               if (!profile) {
                        __netconfig_update_default_connection_info();
                        return;
                }
@@ -832,28 +822,48 @@ void netconfig_update_default(void)
 char *netconfig_get_ifname(const char *profile)
 {
        GVariant *message = NULL, *variant;
-       GVariantIter *iter, *next;
+       GVariantIter *iter, *next, *service;
+       gchar *obj_path;
        gchar *key;
        gchar *key1;
        const gchar *value = NULL;
        gchar *ifname = NULL;
+       gboolean found_profile = 0;
 
        if (profile == NULL)
                return NULL;
 
-       message = netconfig_invoke_dbus_method(CONNMAN_SERVICE, profile,
-                       CONNMAN_SERVICE_INTERFACE, "GetProperties", NULL);
+       message = netconfig_invoke_dbus_method(CONNMAN_SERVICE,
+                       CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE,
+                       "GetServices", NULL);
        if (message == NULL) {
-               ERR("Failed to get service properties");
+               ERR("Failed to get services informations");
+               return NULL;
+       }
+
+       g_variant_get(message, "(a(oa{sv}))", &service);
+       while (g_variant_iter_loop(service, "(oa{sv})", &obj_path, &iter)) {
+               if (g_strcmp0(obj_path, profile) == 0) {
+                       g_free(obj_path);
+                       found_profile = 1;
+                       break;
+               }
+       }
+
+       if (found_profile == 0) {
+               ERR("Profile %s doesn't exist", profile);
+               g_variant_iter_free(service);
+               g_variant_unref(message);
                return NULL;
        }
 
-       g_variant_get(message, "(a{sv})", &iter);
        while (g_variant_iter_loop(iter, "{sv}", &key, &next)) {
                if (g_strcmp0(key, "Ethernet") == 0) {
                        while (g_variant_iter_loop(next, "{sv}", &key1, &variant)) {
                                if (g_strcmp0(key1, "Interface") == 0) {
                                        value = g_variant_get_string(variant, NULL);
+                                       if (ifname)
+                                               g_free(ifname);
                                        ifname = g_strdup(value);
                                }
                        }
@@ -862,6 +872,7 @@ char *netconfig_get_ifname(const char *profile)
 
        g_variant_unref(message);
 
+       g_variant_iter_free(service);
        g_variant_iter_free(iter);
 
        return ifname;
@@ -870,7 +881,7 @@ char *netconfig_get_ifname(const char *profile)
 /* Check Ethernet Cable Plug-in /Plug-out Status */
 void netconfig_network_notify_ethernet_cable_state(const char *key)
 {
-       __netconfig_network_notify_result("EthernetCableState", key);
+       __netconfig_network_notify_result("EthernetCableState", key);
 }
 
 static gboolean handle_add_route(
@@ -891,48 +902,48 @@ static gboolean handle_add_route(
 
        DBG("ip_addr(%s), netmask(%s), interface(%s), gateway(%s)", ip_addr, netmask, interface, gateway);
 
-       switch(address_family) {
-               case AF_INET:
-                       if (ip_addr == NULL || netmask == NULL || interface == NULL) {
-                               ERR("Invalid parameter");
-                               netconfig_error_invalid_parameter(context);
-                               return FALSE;
-                       }
+       switch (address_family) {
+       case AF_INET:
+               if (ip_addr == NULL || netmask == NULL || interface == NULL) {
+                       ERR("Invalid parameter");
+                       netconfig_error_invalid_parameter(context);
+                       return FALSE;
+               }
 
-                       if (netconfig_execute_file(path, args, envs) < 0) {
-                               DBG("Failed to add a new route");
-                               netconfig_error_permission_denied(context);
-                               return FALSE;
-                       }
+               if (netconfig_execute_file(path, args, envs) < 0) {
+                       DBG("Failed to add a new route");
+                       netconfig_error_permission_denied(context);
+                       return FALSE;
+               }
 
-                       break;
-               case AF_INET6:
-                       if (ip_addr == NULL || interface == NULL || gateway == NULL) {
-                               ERR("Invalid parameter");
-                               netconfig_error_invalid_parameter(context);
-                               return FALSE;
-                       }
+               break;
+       case AF_INET6:
+               if (ip_addr == NULL || interface == NULL || gateway == NULL) {
+                       ERR("Invalid parameter");
+                       netconfig_error_invalid_parameter(context);
+                       return FALSE;
+               }
 
-                       buf = ip_addr;
-                       ch = strchr(buf, '/');
-                       pos = ch - buf + 1;
-                       if (ch) {
-                               prefix_len = atoi(ch + 1);
-                               ip_addr[pos-1] = '\0';
-                       } else {
-                               prefix_len = 128;
-                       }
+               buf = ip_addr;
+               ch = strchr(buf, '/');
+               pos = ch - buf + 1;
+               if (ch) {
+                       prefix_len = atoi(ch + 1);
+                       ip_addr[pos-1] = '\0';
+               } else {
+                       prefix_len = 128;
+               }
 
-                       if (netconfig_add_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) {
-                               DBG("Failed to add a new route");
-                               netconfig_error_permission_denied(context);
-                               return FALSE;
-                       }
-                       break;
-               default:
-                       DBG("Unknown Address Family");
-                       netconfig_error_invalid_parameter(context);
+               if (netconfig_add_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) {
+                       DBG("Failed to add a new route");
+                       netconfig_error_permission_denied(context);
                        return FALSE;
+               }
+               break;
+       default:
+               DBG("Unknown Address Family");
+               netconfig_error_invalid_parameter(context);
+               return FALSE;
        }
 
        DBG("Successfully added a new route");
@@ -958,46 +969,46 @@ static gboolean handle_remove_route(
 
        DBG("ip_addr(%s), netmask(%s), interface(%s), gateway(%s)", ip_addr, netmask, interface, gateway);
 
-       switch(address_family) {
-               case AF_INET:
-                       if (ip_addr == NULL || netmask == NULL || interface == NULL) {
-                               DBG("Invalid parameter!");
-                               netconfig_error_invalid_parameter(context);
-                               return FALSE;
-                       }
-                       if (netconfig_execute_file(path, args, envs) < 0) {
-                               DBG("Failed to remove the route");
-                               netconfig_error_permission_denied(context);
-                               return FALSE;
-                       }
-                       break;
-               case AF_INET6:
-                       if (ip_addr == NULL || interface == NULL || gateway == NULL) {
-                               DBG("Invalid parameter!");
-                               netconfig_error_invalid_parameter(context);
-                               return FALSE;
-                       }
+       switch (address_family) {
+       case AF_INET:
+               if (ip_addr == NULL || netmask == NULL || interface == NULL) {
+                       DBG("Invalid parameter!");
+                       netconfig_error_invalid_parameter(context);
+                       return FALSE;
+               }
+               if (netconfig_execute_file(path, args, envs) < 0) {
+                       DBG("Failed to remove the route");
+                       netconfig_error_permission_denied(context);
+                       return FALSE;
+               }
+               break;
+       case AF_INET6:
+               if (ip_addr == NULL || interface == NULL || gateway == NULL) {
+                       DBG("Invalid parameter!");
+                       netconfig_error_invalid_parameter(context);
+                       return FALSE;
+               }
 
-                       buf = ip_addr;
-                       ch = strchr(buf, '/');
-                       pos = ch - buf + 1;
-                       if (ch) {
-                               prefix_len = atoi(ch + 1);
-                               ip_addr[pos-1] = '\0';
-                       } else {
-                               prefix_len = 128;
-                       }
+               buf = ip_addr;
+               ch = strchr(buf, '/');
+               pos = ch - buf + 1;
+               if (ch) {
+                       prefix_len = atoi(ch + 1);
+                       ip_addr[pos-1] = '\0';
+               } else {
+                       prefix_len = 128;
+               }
 
-                       if (netconfig_del_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) {
-                               DBG("Failed to remove the route");
-                               netconfig_error_permission_denied(context);
-                               return FALSE;
-                       }
-                       break;
-               default:
-                       DBG("Unknown Address Family");
-                       netconfig_error_invalid_parameter(context);
+               if (netconfig_del_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) {
+                       DBG("Failed to remove the route");
+                       netconfig_error_permission_denied(context);
                        return FALSE;
+               }
+               break;
+       default:
+               DBG("Unknown Address Family");
+               netconfig_error_invalid_parameter(context);
+               return FALSE;
        }
 
        DBG("Successfully removed the route");
@@ -1020,6 +1031,13 @@ static gboolean handle_check_profile_privilege(Network *object,
        return TRUE;
 }
 
+static gboolean handle_check_internet_privilege(Network *object,
+               GDBusMethodInvocation *context)
+{
+       network_complete_check_internet_privilege(object, context);
+       return TRUE;
+}
+
 gboolean handle_ethernet_cable_state(Network *object,
        GDBusMethodInvocation *context)
 {
@@ -1027,7 +1045,7 @@ gboolean handle_ethernet_cable_state(Network *object,
        int state = 0;
 
        ret = netconfig_get_ethernet_cable_state(&state);
-       if(ret != 0) {
+       if (ret != 0) {
                DBG("Failed to get ethernet cable state");
                netconfig_error_fail_ethernet_cable_state(context);
                return FALSE;
@@ -1060,10 +1078,22 @@ void state_object_create_and_init(void)
                                G_CALLBACK(handle_check_get_privilege), NULL);
        g_signal_connect(netconfigstate, "handle-check-profile-privilege",
                                G_CALLBACK(handle_check_profile_privilege), NULL);
+       g_signal_connect(netconfigstate, "handle-check-internet-privilege",
+                               G_CALLBACK(handle_check_internet_privilege), NULL);
        g_signal_connect(netconfigstate, "handle-ethernet-cable-state",
                                G_CALLBACK(handle_ethernet_cable_state), NULL);
        g_signal_connect(netconfigstate, "handle-remove-route",
                                G_CALLBACK(handle_remove_route), NULL);
+       g_signal_connect(netconfigstate, "handle-launch-mdns",
+                               G_CALLBACK(handle_launch_mdns), NULL);
+       g_signal_connect(netconfigstate, "handle-device-policy-set-wifi",
+                               G_CALLBACK(handle_device_policy_set_wifi), NULL);
+       g_signal_connect(netconfigstate, "handle-device-policy-get-wifi",
+                               G_CALLBACK(handle_device_policy_get_wifi), NULL);
+       g_signal_connect(netconfigstate, "handle-device-policy-set-wifi-profile",
+                               G_CALLBACK(handle_device_policy_set_wifi_profile), NULL);
+       g_signal_connect(netconfigstate, "handle-device-policy-get-wifi-profile",
+                               G_CALLBACK(handle_device_policy_get_wifi_profile), NULL);
 
        if (!g_dbus_interface_skeleton_export(interface_network, connection,
                        NETCONFIG_NETWORK_STATE_PATH, NULL)) {