Fix for UTC error case
authorJiwan Kim <ji-wan.kim@samsung.com>
Wed, 14 Jun 2017 06:37:47 +0000 (15:37 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 17 Jul 2017 02:35:37 +0000 (11:35 +0900)
- Add privileges (not fully tested)
- Fix mesh_request_set_mesh_gate()
- Fix not to return error code on repeated enable()

packaging/dbus-meshd.conf
packaging/meshd.spec
src/mesh-request.c
src/mesh-service-interface.c

index 3cb7eac..084796b 100644 (file)
@@ -3,10 +3,62 @@
 <busconfig>
        <policy user="root">
                <allow own="net.mesh"/>
+               <allow own="net.mesh.manager"/>
                <allow send_destination="net.mesh"/>
+               <allow send_destination="net.mesh.manager"/>
                <allow receive_sender="net.mesh"/>
        </policy>
        <policy context="default">
-               <check send_destination="net.mesh" send_interface="net.mesh" privilege="http://tizen.org/privilege/mesh" />
+               <allow send_destination="net.mesh" send_interface="net.mesh" />
+               <allow send_destination="net.mesh.manager" send_interface="net.mesh.manager" />
+
+               <!-- Manager -->
+               <check send_destination="net.mesh.manager" send_interface="net.mesh.manager"
+                       send_member="enable" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh.manager" send_interface="net.mesh.manager"
+                       send_member="disable" privilege="http://tizen.org/privilege/mesh"/>
+
+               <!-- Normal methods -->
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="scan" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="specific_scan" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="cancel_scan" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="get_found_mesh_networks" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="get_connected_peers" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="enable_mesh" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="disable_mesh" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="get_joined_mesh_network" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="set_gate" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="unset_gate" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="set_softap" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="enable_softap" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="disable_softap" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="create_mesh_network" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="connect_mesh_network" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="disconnect_mesh_network" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="forget_mesh_network" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="set_interfaces" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="get_station_info" privilege="http://tizen.org/privilege/mesh"/>
+               <check send_destination="net.mesh" send_interface="net.mesh"
+                       send_member="get_mpath_info" privilege="http://tizen.org/privilege/mesh"/>
+
        </policy>
 </busconfig>
index 337b967..801908b 100644 (file)
@@ -67,6 +67,9 @@ cp meshd.service %{buildroot}%{_unitdir}/meshd.service
 %post
 chmod 755 %{_sbindir}/mesh.sh
 
+# For configuration files
+mkdir -p %TZ_SYS_VAR/lib/mesh
+
 %files
 %manifest meshd.manifest
 %license LICENSE
index 1acfc3b..a15a264 100644 (file)
@@ -45,30 +45,27 @@ int mesh_request_set_mesh_gate(const char* bridge_interface,
                MESH_LOGE("Failed to get external interface state !");
                return MESHD_ERROR_OPERATION_FAILED;
        }
+       MESH_LOGD("  Ethernet cable state [%s]",
+               (state) ? "Connected" : "Disconnected");
 
-       if (state) {
-               /* Turn STP on */
-               ret = mesh_bridge_set_stp(bridge_interface, TRUE);
-               if (MESHD_ERROR_NONE != ret) {
-                       MESH_LOGE("Failed to turn STP on !");
-                       return ret;
-               }
-
-               /* Set mesh parameters */
-               ret = mesh_netlink_set_mesh_parameter(mesh_interface,
-                               "mesh_hwmp_rootmode", 4);
-               if (MESHD_ERROR_NONE != ret)
-                       MESH_LOGE("Failed to set [mesh_hwmp_rootmode] : 4");
-
-               ret = mesh_netlink_set_mesh_parameter(mesh_interface,
-                               "mesh_gate_announcements", 1);
-               if (MESHD_ERROR_NONE != ret)
-                       MESH_LOGE("Failed to set [mesh_gate_announcements] : 1");
-       } else {
-               MESH_LOGE("External interface is not available !");
-               return MESHD_ERROR_OPERATION_FAILED;
+       /* Turn STP on */
+       ret = mesh_bridge_set_stp(bridge_interface, TRUE);
+       if (MESHD_ERROR_NONE != ret) {
+               MESH_LOGE("Failed to turn STP on !");
+               return ret;
        }
 
+       /* Set mesh parameters */
+       ret = mesh_netlink_set_mesh_parameter(mesh_interface,
+                       "mesh_hwmp_rootmode", 4);
+       if (MESHD_ERROR_NONE != ret)
+               MESH_LOGE("Failed to set [mesh_hwmp_rootmode] : 4");
+
+       ret = mesh_netlink_set_mesh_parameter(mesh_interface,
+                       "mesh_gate_announcements", 1);
+       if (MESHD_ERROR_NONE != ret)
+               MESH_LOGE("Failed to set [mesh_gate_announcements] : 1");
+
        return MESHD_ERROR_NONE;
 }
 
index 7550e93..a37fca0 100644 (file)
@@ -155,14 +155,14 @@ static gboolean _meshd_dbus_handle_enable(Manager *object,
 
        if (service->mesh_activated) {
                /* Already activated */
-               manager_complete_enable(object, invocation,
-                               MESHD_ERROR_OPERATION_FAILED);
-       } else {
-               /* Do API response first */
-               manager_complete_enable(object, invocation, ret);
-               service->mesh_activated = TRUE;
+               manager_complete_enable(object, invocation, MESHD_ERROR_NONE);
+               goto FINISH;
        }
 
+       /* Do API response first */
+       manager_complete_enable(object, invocation, ret);
+       service->mesh_activated = TRUE;
+
        meshd_check_null_ret_error("info", info, FALSE);
 
        /* Register event handler first */
@@ -175,13 +175,7 @@ static gboolean _meshd_dbus_handle_enable(Manager *object,
                MESH_LOGE("Failed to mesh_interface_initialize [%d]", ret);
                goto FINISH;
        }
-#if 0
-       ret = mesh_request_load_saved_mesh_network(&service->saved_mesh_network);
-       if (MESHD_ERROR_NONE != ret) {
-               MESH_LOGE("Failed to mesh_request_load_saved_mesh_network [%d]", ret);
-               goto FINISH;
-       }
-#endif
+
 FINISH:
        net_mesh_emit_mesh_enabled(meshd_dbus_get_object(), ret);