summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Laakkonen <jussi.laakkonen@jolla.com>2022-04-05 17:31:14 +0300
committerDaniel Wagner <wagi@monom.org>2022-04-08 09:17:35 +0200
commitaaab2161b247588bbee32fefe775ef55acc69c4d (patch)
tree69dc106bf429f51006a7509f1824eaa89f423798
parentf035539d46ac23ccb8916ed7ae8d38ab553d32b1 (diff)
downloadconnman-aaab2161b247588bbee32fefe775ef55acc69c4d.tar.gz
main: Add RegdomFollowsTimezone option for regdom changes
This boolean option toggles whether the regdom is being changed along timezone changes or not. By default the feature is off.
-rw-r--r--doc/connman.conf.5.in6
-rw-r--r--src/main.c13
2 files changed, 19 insertions, 0 deletions
diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in
index a64b8c6d..cb36e9fb 100644
--- a/doc/connman.conf.5.in
+++ b/doc/connman.conf.5.in
@@ -208,6 +208,12 @@ Default value is false.
.TP
.BI Localtime= string
Path to localtime file. Defaults to /etc/localtime.
+.TP
+.BI RegdomFollowsTimezone= true\ \fR|\fB\ false
+Enable regdomain to be changed along timezone changes. With this option set to
+true each time the timezone changes the first present ISO3166 country code is
+being read from /usr/share/zoneinfo/zone1970.tab and set as regdom value.
+Default value is false.
.SH "EXAMPLE"
The following example configuration disables hostname updates and enables
ethernet tethering.
diff --git a/src/main.c b/src/main.c
index dd1c3c9e..5c632fd1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -109,6 +109,7 @@ static struct {
bool acd;
bool use_gateways_as_timeservers;
char *localtime;
+ bool regdom_follows_timezone;
} connman_settings = {
.bg_scan = true,
.pref_timeservers = NULL,
@@ -166,6 +167,7 @@ static struct {
#define CONF_ACD "AddressConflictDetection"
#define CONF_USE_GATEWAYS_AS_TIMESERVERS "UseGatewaysAsTimeservers"
#define CONF_LOCALTIME "Localtime"
+#define CONF_REGDOM_FOLLOWS_TIMEZONE "RegdomFollowsTimezone"
static const char *supported_options[] = {
CONF_BG_SCAN,
@@ -195,6 +197,7 @@ static const char *supported_options[] = {
CONF_ACD,
CONF_USE_GATEWAYS_AS_TIMESERVERS,
CONF_LOCALTIME,
+ CONF_REGDOM_FOLLOWS_TIMEZONE,
NULL
};
@@ -585,6 +588,13 @@ static void parse_config(GKeyFile *config)
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;
+
+ g_clear_error(&error);
}
static int config_init(const char *file)
@@ -817,6 +827,9 @@ 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;
+
return false;
}