Remove codes to launch mdnsd 96/255296/1 accepted/tizen/unified/20210318.060248 submit/tizen/20210317.065443
authorCheoleun Moon <chleun.moon@samsung.com>
Tue, 16 Mar 2021 10:24:40 +0000 (19:24 +0900)
committerCheoleun Moon <chleun.moon@samsung.com>
Tue, 16 Mar 2021 10:39:36 +0000 (19:39 +0900)
Change-Id: I9848812f74a59b98647cc9354badae2402a81025

gtest/gdbus.h
gtest/network_state.cpp
gtest/network_state.h
gtest/unittest.cpp
include/util.h
interfaces/netconfig-iface-network-state.xml
packaging/net-config.spec
resources/etc/dbus-1/system.d/net-config.conf
src/network-state.c
src/utils/util.c

index 6008b7013cdb277a64b9b1c416ff7a6a3eb9a3de..39c61e74039fd327e16580a57a6fb5f92e59651a 100755 (executable)
 #define CHECK_GET_PRIVILEGE "CheckGetPrivilege"
 #define CHECK_PROFILE_PRIVILEGE "CheckProfilePrivilege"
 #define CHECK_INTERNET_Privilege "CheckInternetPrivilege"
-#define LAUNCH_MDNS "LaunchMdns"
 #define DEVICE_POLICY_SET_WIFI "DevicePolicySetWifi"
 #define DEVICE_POLICY_GET_WIFI "DevicePolicyGetWifi"
 #define DEVICE_POLICY_SET_WIFI_PROFILE "DevicePolicySetWifiProfile"
index 4fad5c88bb78461ba5fd1b12c173dacbdadef7cd..c31ece5d5063270ba5ee65cf8d6f63b62d0e0e4e 100755 (executable)
@@ -105,27 +105,6 @@ error_e NetworkState::EthernetCableState(int *state)
        return ERROR_NONE;
 }
 
-error_e NetworkState::LaunchMdns(const char *name)
-{
-       GVariant *message = NULL;
-       error_e error = ERROR_NONE;
-
-       message = InvokeMethod(NETCONFIG_SERVICE,
-               NETCONFIG_NETWORK_PATH,
-               NETCONFIG_NETWORK_INTERFACE,
-               LAUNCH_MDNS,
-               g_variant_new("(s)", name),
-               &error);
-
-       if (message == NULL) {
-               GLOGD("Failed to invoke dbus method");
-               return error;
-       }
-
-       g_variant_unref(message);
-
-       return ERROR_NONE;
-}
 error_e NetworkState::DevicePolicySetWifi(int state)
 {
        GVariant *message = NULL;
index 7e33fb297d6838871e940775f0df003f557f8598..887fb7f89037de4d9267e4c20d26bb6dcda7a07d 100755 (executable)
@@ -28,7 +28,6 @@ public:
        error_e RemoveRoute(const char *ip, const char *mask, const char *interface,
                        const char *gateway, int family, gboolean *result);
        error_e EthernetCableState(int *state);
-       error_e LaunchMdns(const char *name);
        error_e DevicePolicySetWifi(int state);
        error_e DevicePolicyGetWifi(int *state);
        error_e DevicePolicySetWifiProfile(int state);
index 679b8a864f5bc21e855acb2018c3844c2d3deaa1..356c9da93657271538aee0c38e6f2f613e77bb50 100755 (executable)
@@ -191,26 +191,6 @@ TEST(NetworkState, RemoveRoute_n)
        EXPECT_NE(ERROR_NONE, ret);
 }
 
-TEST(NetworkState, LaunchMdns_p)
-{
-       error_e ret = ERROR_NONE;
-       NetworkState mgr;
-       const char *name = "gtest";
-
-       ret = mgr.LaunchMdns(name);
-       EXPECT_EQ(ERROR_NONE, ret);
-}
-
-TEST(NetworkState, LaunchMdns_n)
-{
-       error_e ret = ERROR_NONE;
-       NetworkState mgr;
-       const char *name = "gtest";
-
-       ret = mgr.LaunchMdns(name);
-       EXPECT_EQ(ERROR_NONE, ret);
-}
-
 TEST(NetworkState, DevicePolicySetWifi_p1)
 {
        error_e ret = ERROR_NONE;
index 436f49c88f1581b1b88d559ed42f4b99466f807c..73f41c57b6f7ae4588c83c51b4cc32322a326348 100755 (executable)
@@ -86,8 +86,6 @@ int netconfig_add_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gi
 int netconfig_del_route_ipv4(gchar *ip_addr, gchar *subnet, gchar *interface, gint address_family);
 
 gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context);
-gboolean handle_launch_mdns(Network *object, GDBusMethodInvocation *context,
-                                                       gchar *name);
 
 gboolean netconfig_send_notification_to_net_popup(const char * noti, const char * data);
 int netconfig_send_message_to_net_popup(const char *title,
index 57f7938b24bd35b195834c2adfc47d509782a4ec..5b8b46abd1481a4a9aa3083e0ac1d81679c9404d 100755 (executable)
@@ -23,9 +23,6 @@
                <method name="CheckGetPrivilege"></method>
                <method name="CheckProfilePrivilege"></method>
                <method name="CheckInternetPrivilege"></method>
-               <method name="LaunchMdns">
-                       <arg type="s" name="name" direction="in"/>
-               </method>
                <method name="DevicePolicySetWifi">
                        <arg type="i" name="state" direction="in"/>
                </method>
index 4f8059e8df1c3f08e30f92649bbf9674fad4103f..a16ef7d715914501dba6f2a05f1ed563eb7d7aca 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          net-config
 Summary:       TIZEN Network Configuration service
-Version:       1.2.8
+Version:       1.2.9
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 2c8fd420426af04beb29373ba6fed63b9d84b984..c6518864877751cac9dbc364db47add3540bd157 100755 (executable)
@@ -18,8 +18,6 @@
        <policy context="default">
                <deny own="net.netconfig"/>
                <deny send_destination="net.netconfig"/>
-               <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="LaunchMdns" />
-               <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="UnrefMdns" />
 
                <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="DevicePolicyGetWifi" />
                <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="DevicePolicyGetWifiProfile" />
index 75dea27a4b29aaf121d7a1a7036c25a4dd8aa7b7..eed90e3cc9f718624afeaa0df199715f1a28fed3 100755 (executable)
@@ -1433,8 +1433,6 @@ void state_object_create_and_init(void)
                                G_CALLBACK(handle_preferred_ipv6_address), 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",
index bf7c4bc800b599808cec587289d6ba20e4d580a8..a6d44a5450f01163988bbea646485a64f6215369 100755 (executable)
@@ -58,7 +58,6 @@
 #define CONNMAN_WIFI_DEF_IFNAME                "DefaultWifiInterface"
 
 static gboolean netconfig_device_picker_test = FALSE;
-static int mdnsd_ref_count = 0;
 typedef struct {
        char *conn_name;
        int conn_id;
@@ -955,96 +954,6 @@ gboolean handle_launch_direct(Wifi *wifi, GDBusMethodInvocation *context)
        return TRUE;
 }
 
-int execute_mdnsd_script(char* op)
-{
-       const char *path = "/usr/bin/mdnsresponder-server.sh";
-       char *const args[] = { "mdnsresponder-server.sh", op, NULL };
-       char *const envs[] = { NULL };
-
-       return netconfig_execute_file(path, args, envs);
-}
-
-static void __dnssd_conn_destroyed_cb(GDBusConnection *conn,
-               const gchar *Name, const gchar *path, const gchar *interface,
-               const gchar *sig, GVariant *param, gpointer user_data)
-{
-       gchar *name = NULL;
-       gchar *old = NULL;
-       gchar *new = NULL;
-       dnssd_conn_destroy_data *data = user_data;
-       GDBusConnection *connection = NULL;
-       connection = netdbus_get_connection();
-
-       if (param == NULL)
-               return;
-
-       g_variant_get(param, "(sss)", &name, &old, &new);
-
-       if (g_strcmp0(name, data->conn_name) == 0 && *new == '\0') {
-               DBG("Connection %s Destroyed: name %s id %d", data->conn_name, name,
-                       data->conn_id);
-               mdnsd_ref_count--;
-               g_dbus_connection_signal_unsubscribe(connection, data->conn_id);
-               if (mdnsd_ref_count == 0) {
-                       if (execute_mdnsd_script("stop") < 0)
-                               ERR("Failed to stop mdnsresponder daemon");
-               }
-       }
-       g_free(name);
-       g_free(old);
-       g_free(new);
-       g_free(data->conn_name);
-       g_free(data);
-       return;
-}
-
-static void register_dnssd_conn_destroy_signal(gchar *name)
-{
-       dnssd_conn_destroy_data *data;
-       GDBusConnection *connection = NULL;
-       connection = netdbus_get_connection();
-
-       if (connection == NULL) {
-               ERR("Failed to get GDbus Connection");
-               return;
-       }
-
-       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,
-                                                       DBUS_SERVICE_DBUS, DBUS_INTERFACE_DBUS,
-                                                       "NameOwnerChanged", NULL, name,
-                                                       G_DBUS_SIGNAL_FLAGS_NONE, __dnssd_conn_destroyed_cb,
-                                                       data, NULL);
-       return;
-}
-
-gboolean handle_launch_mdns(Network *object, GDBusMethodInvocation *context,
-                                                       gchar *name)
-{
-       DBG("Launch mdnsresponder daemon");
-
-       if (execute_mdnsd_script("start") < 0) {
-               ERR("Failed to launch mdnsresponder daemon");
-               netconfig_error_invalid_parameter(context);
-               return TRUE;
-       }
-
-       mdnsd_ref_count++;
-       register_dnssd_conn_destroy_signal(name);
-       DBG("Ref mdnsresponder daemon. ref count: %d", mdnsd_ref_count);
-
-       network_complete_launch_mdns(object, context);
-       return TRUE;
-}
-
 gboolean netconfig_send_notification_to_net_popup(const char * noti, const char * ssid)
 {
        if (!netconfig_plugin_headed_enabled)