Add an option for gateway timeserver handling 57/211257/1 submit/tizen/20190802.071744
authorJaehyun Kim <jeik01.kim@samsung.com>
Wed, 31 Jul 2019 13:45:54 +0000 (22:45 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Wed, 31 Jul 2019 13:45:54 +0000 (22:45 +0900)
Change-Id: I19f09647b7471f146adb95bc7e81fd9ab11f18ac
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/main.c
src/main.conf
src/main_disable_eth.conf
src/main_ivi.conf
src/main_tv.conf
src/timeserver.c

index 7a6d802..3775287 100644 (file)
@@ -84,6 +84,7 @@ static struct {
 #if defined TIZEN_EXT
        char **cellular_interfaces;
        bool tizen_tv_extension;
+       bool use_gateway_timeserver;
 #endif
 } connman_settings  = {
        .bg_scan = true,
@@ -105,6 +106,7 @@ static struct {
 #if defined TIZEN_EXT
        .cellular_interfaces = NULL,
        .tizen_tv_extension = false,
+       .use_gateway_timeserver = false,
 #endif
 };
 
@@ -127,6 +129,7 @@ static struct {
 #if defined TIZEN_EXT
 #define CONF_CELLULAR_INTERFACE         "NetworkCellularInterfaceList"
 #define CONF_TIZEN_TV_EXT              "TizenTVExtension"
+#define CONF_USE_GATEWAY_TIMESERVER     "UseGatewayTimeserver"
 #endif
 
 static const char *supported_options[] = {
@@ -148,6 +151,7 @@ static const char *supported_options[] = {
 #if defined TIZEN_EXT
        CONF_CELLULAR_INTERFACE,
        CONF_TIZEN_TV_EXT,
+       CONF_USE_GATEWAY_TIMESERVER,
 #endif
        NULL
 };
@@ -285,6 +289,13 @@ static void check_Tizen_configuration(GKeyFile *config)
                connman_settings.tizen_tv_extension = boolean;
 
        g_clear_error(&error);
+
+       boolean = __connman_config_get_bool(config, "General",
+                       CONF_USE_GATEWAY_TIMESERVER, &error);
+       if (!error)
+               connman_settings.use_gateway_timeserver = boolean;
+
+       g_clear_error(&error);
 }
 
 static void set_nofile_inc(void)
@@ -679,6 +690,11 @@ bool connman_setting_get_bool(const char *key)
        if (g_str_equal(key, CONF_ENABLE_ONLINE_CHECK))
                return connman_settings.enable_online_check;
 
+#if defined TIZEN_EXT
+       if (g_str_equal(key, CONF_USE_GATEWAY_TIMESERVER))
+               return connman_settings.use_gateway_timeserver;
+#endif
+
        return false;
 }
 
index a2cc1e2..80724d5 100755 (executable)
@@ -124,3 +124,7 @@ SingleConnectedTechnology = true
 # AlwaysConnectedTechnologies =
 
 NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w
+
+# Allow connman to add service gateway to the time server list.
+# Default value is false.
+# UseGatewayTimeserver = false
index c4ec3e3..ea4a9dd 100755 (executable)
@@ -108,3 +108,7 @@ SingleConnectedTechnology = true
 # Enable6to4 = false
 
 NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w
+
+# Allow connman to add service gateway to the time server list.
+# Default value is false.
+# UseGatewayTimeserver = false
index 627bd06..c7e65c4 100755 (executable)
@@ -108,3 +108,7 @@ SingleConnectedTechnology = true
 # Enable6to4 = false
 
 NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w
+
+# Allow connman to add service gateway to the time server list.
+# Default value is false.
+# UseGatewayTimeserver = false
index fd3afc9..44d1b02 100755 (executable)
@@ -109,7 +109,9 @@ SingleConnectedTechnology = true
 
 NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w
 
-
+# Allow connman to add service gateway to the time server list.
+# Default value is false.
+# UseGatewayTimeserver = false
 
 # Enable Tizen TV Profile Features
 TizenTVExtension = true
index 6325ece..e4cfc06 100755 (executable)
@@ -218,6 +218,9 @@ GSList *__connman_timeserver_get_all(struct connman_service *service)
        for (i = 0; service_ts && service_ts[i]; i++)
                list = __connman_timeserver_add_list(list, service_ts[i]);
 
+#if defined TIZEN_EXT
+       if (connman_setting_get_bool("UseGatewayTimeserver")) {
+#endif
        network = __connman_service_get_network(service);
        if (network) {
                index = connman_network_get_index(network);
@@ -228,7 +231,9 @@ GSList *__connman_timeserver_get_all(struct connman_service *service)
                if (service_gw)
                        list = __connman_timeserver_add_list(list, service_gw);
        }
-
+#if defined TIZEN_EXT
+       }
+#endif
        /* Then add Global Timeservers to the list */
        timeservers = load_timeservers();