From b7ff33d7bc0b2b6efaf8e2f0c69c75b8efbc2490 Mon Sep 17 00:00:00 2001 From: Niraj Kumar Goit Date: Fri, 27 Sep 2019 16:05:24 +0530 Subject: Added an option in main.conf to set global DNS. Change-Id: I52f95964f82a88389e98592c64bf4820c1da5887 Signed-off-by: Niraj Kumar Goit --- src/main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 0e603b8f..1fecef07 100644 --- a/src/main.c +++ b/src/main.c @@ -97,6 +97,7 @@ static struct { char **cellular_interfaces; bool tizen_tv_extension; bool auto_ip; + char *global_nameserver; #endif } connman_settings = { .bg_scan = true, @@ -124,6 +125,7 @@ static struct { .cellular_interfaces = NULL, .tizen_tv_extension = false, .auto_ip = true, + .global_nameserver = NULL, #endif }; @@ -152,6 +154,7 @@ static struct { #define CONF_CELLULAR_INTERFACE "NetworkCellularInterfaceList" #define CONF_TIZEN_TV_EXT "TizenTVExtension" #define CONF_ENABLE_AUTO_IP "EnableAutoIp" +#define CONF_GLOBAL_NAMESERVER "GlobalNameserver" #endif static const char *supported_options[] = { @@ -178,6 +181,8 @@ static const char *supported_options[] = { #if defined TIZEN_EXT CONF_CELLULAR_INTERFACE, CONF_TIZEN_TV_EXT, + CONF_ENABLE_AUTO_IP, + CONF_GLOBAL_NAMESERVER, #endif NULL }; @@ -298,6 +303,7 @@ static void check_Tizen_configuration(GKeyFile *config) { GError *error = NULL; char **cellular_interfaces; + char *global_nameserver; bool boolean; gsize len; @@ -322,6 +328,13 @@ static void check_Tizen_configuration(GKeyFile *config) connman_settings.auto_ip = boolean; g_clear_error(&error); + + global_nameserver = __connman_config_get_string(config, "General", + CONF_GLOBAL_NAMESERVER, &error); + if (!error) + connman_settings.global_nameserver = global_nameserver; + + g_clear_error(&error); } static void set_nofile_inc(void) @@ -735,6 +748,10 @@ const char *connman_option_get_string(const char *key) return option_wifi; } +#if defined TIZEN_EXT + if (g_str_equal(key, CONF_GLOBAL_NAMESERVER)) + return connman_settings.global_nameserver; +#endif return NULL; } -- cgit v1.2.3