summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c57
1 files changed, 55 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index e209cf26..ae4a450d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -54,6 +54,7 @@
*/
#define DEFAULT_ONLINE_CHECK_INITIAL_INTERVAL 1
#define DEFAULT_ONLINE_CHECK_MAX_INTERVAL 12
+#define DEFAULT_LOCALTIME "/etc/localtime"
#define MAINFILE "main.conf"
#define CONFIGMAINFILE CONFIGDIR "/" MAINFILE
@@ -77,6 +78,7 @@ static char *default_blacklist[] = {
"ifb",
"ve-",
"vb-",
+ "ham",
NULL
};
@@ -107,6 +109,9 @@ static struct {
bool auto_connect_roaming_services;
bool acd;
bool use_gateways_as_timeservers;
+ char *localtime;
+ bool regdom_follows_timezone;
+ char *resolv_conf;
} connman_settings = {
.bg_scan = true,
.pref_timeservers = NULL,
@@ -134,6 +139,8 @@ static struct {
.auto_connect_roaming_services = false,
.acd = false,
.use_gateways_as_timeservers = false,
+ .localtime = NULL,
+ .resolv_conf = NULL,
};
#define CONF_BG_SCAN "BackgroundScanning"
@@ -162,6 +169,9 @@ static struct {
#define CONF_AUTO_CONNECT_ROAMING_SERVICES "AutoConnectRoamingServices"
#define CONF_ACD "AddressConflictDetection"
#define CONF_USE_GATEWAYS_AS_TIMESERVERS "UseGatewaysAsTimeservers"
+#define CONF_LOCALTIME "Localtime"
+#define CONF_REGDOM_FOLLOWS_TIMEZONE "RegdomFollowsTimezone"
+#define CONF_RESOLV_CONF "ResolvConf"
static const char *supported_options[] = {
CONF_BG_SCAN,
@@ -190,6 +200,9 @@ static const char *supported_options[] = {
CONF_AUTO_CONNECT_ROAMING_SERVICES,
CONF_ACD,
CONF_USE_GATEWAYS_AS_TIMESERVERS,
+ CONF_LOCALTIME,
+ CONF_REGDOM_FOLLOWS_TIMEZONE,
+ CONF_RESOLV_CONF,
NULL
};
@@ -318,11 +331,17 @@ static void parse_config(GKeyFile *config)
if (!config) {
connman_settings.auto_connect =
- parse_service_types(default_auto_connect, CONF_ARRAY_SIZE(default_auto_connect));
+ parse_service_types(default_auto_connect,
+ CONF_ARRAY_SIZE(default_auto_connect));
connman_settings.favorite_techs =
- parse_service_types(default_favorite_techs, CONF_ARRAY_SIZE(default_favorite_techs));
+ parse_service_types(default_favorite_techs,
+ CONF_ARRAY_SIZE(default_favorite_techs));
connman_settings.blacklisted_interfaces =
g_strdupv(default_blacklist);
+ connman_settings.online_check_ipv4_url =
+ g_strdup(DEFAULT_ONLINE_CHECK_IPV4_URL);
+ connman_settings.online_check_ipv6_url =
+ g_strdup(DEFAULT_ONLINE_CHECK_IPV6_URL);
return;
}
@@ -565,6 +584,29 @@ static void parse_config(GKeyFile *config)
connman_settings.use_gateways_as_timeservers = boolean;
g_clear_error(&error);
+
+ string = __connman_config_get_string(config, "General",
+ CONF_LOCALTIME, &error);
+ if (!error)
+ connman_settings.localtime = string;
+ else
+ g_free(string);
+
+ g_clear_error(&error);
+
+ boolean = __connman_config_get_bool(config, "General",
+ CONF_REGDOM_FOLLOWS_TIMEZONE, &error);
+ if (!error)
+ connman_settings.regdom_follows_timezone = boolean;
+
+ string = __connman_config_get_string(config, "General",
+ CONF_RESOLV_CONF, &error);
+ if (!error)
+ connman_settings.resolv_conf = string;
+ else
+ g_free(string);
+
+ g_clear_error(&error);
}
static int config_init(const char *file)
@@ -755,6 +797,10 @@ char *connman_setting_get_string(const char *key)
return option_wifi;
}
+ if (g_str_equal(key, CONF_LOCALTIME))
+ return connman_settings.localtime ?
+ connman_settings.localtime : DEFAULT_LOCALTIME;
+
return NULL;
}
@@ -793,6 +839,12 @@ bool connman_setting_get_bool(const char *key)
if (g_str_equal(key, CONF_USE_GATEWAYS_AS_TIMESERVERS))
return connman_settings.use_gateways_as_timeservers;
+ if (g_str_equal(key, CONF_REGDOM_FOLLOWS_TIMEZONE))
+ return connman_settings.regdom_follows_timezone;
+
+ if (g_str_equal(key, CONF_RESOLV_CONF))
+ return connman_settings.resolv_conf;
+
return false;
}
@@ -1031,6 +1083,7 @@ int main(int argc, char *argv[])
g_free(connman_settings.vendor_class_id);
g_free(connman_settings.online_check_ipv4_url);
g_free(connman_settings.online_check_ipv6_url);
+ g_free(connman_settings.localtime);
g_free(option_debug);
g_free(option_wifi);