Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [PATCH v5 0/4] Add AlwaysConnectedTechnologies feature
(Ioan-Adrian Ratiu)
2. [PATCH v5 1/4] main: add new AlwaysConnectedTechnologies list
option (Ioan-Adrian Ratiu)
3. [PATCH v5 2/4] service: implement AlwaysConnectedTechnologies
option (Ioan-Adrian Ratiu)
4. [PATCH v5 3/4] service: abstract the more complex autoconnect
conditionals (Ioan-Adrian Ratiu)
5. [PATCH v5 4/4] main.conf: document
AlwaysConnectedTechnologies option (Ioan-Adrian Ratiu)
----------------------------------------------------------------------
Message: 1
Date: Wed, 23 Nov 2016 16:10:53 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Subject: [PATCH v5 0/4] Add AlwaysConnectedTechnologies feature
Message-ID: <[email protected]>
Content-Type: text/plain
Changes since v4 (Based on Daniel's feedback):
* Converted the always_connect function to an array to
maintain consistency with the way the similar active_session
array works.
Ioan-Adrian Ratiu (4):
main: add new AlwaysConnectedTechnologies list option
service: implement AlwaysConnectedTechnologies option
service: abstract the more complex autoconnect conditionals
main.conf: document AlwaysConnectedTechnologies option
doc/connman.conf.5.in | 6 ++++++
src/main.c | 18 ++++++++++++++++++
src/main.conf | 7 +++++++
src/service.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
4 files changed, 75 insertions(+), 4 deletions(-)
--
2.10.2
------------------------------
Message: 2
Date: Wed, 23 Nov 2016 16:10:54 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Subject: [PATCH v5 1/4] main: add new AlwaysConnectedTechnologies list
option
Message-ID: <[email protected]>
Content-Type: text/plain
This option is a list of technologies which should always connect,
by default it's empty and each element in the list depends on having
AutoConnect=true.
---
src/main.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/main.c b/src/main.c
index fdb4f72..462ac15 100644
--- a/src/main.c
+++ b/src/main.c
@@ -67,6 +67,7 @@ static struct {
char **pref_timeservers;
unsigned int *auto_connect;
unsigned int *preferred_techs;
+ unsigned int *always_connected_techs;
char **fallback_nameservers;
unsigned int timeout_inputreq;
unsigned int timeout_browserlaunch;
@@ -81,6 +82,7 @@ static struct {
.pref_timeservers = NULL,
.auto_connect = NULL,
.preferred_techs = NULL,
+ .always_connected_techs = NULL,
.fallback_nameservers = NULL,
.timeout_inputreq = DEFAULT_INPUT_REQUEST_TIMEOUT,
.timeout_browserlaunch = DEFAULT_BROWSER_LAUNCH_TIMEOUT,
@@ -95,6 +97,7 @@ static struct {
#define CONF_BG_SCAN "BackgroundScanning"
#define CONF_PREF_TIMESERVERS "FallbackTimeservers"
#define CONF_AUTO_CONNECT "DefaultAutoConnectTechnologies"
+#define CONF_ALWAYS_CONNECTED_TECHS "AlwaysConnectedTechnologies"
#define CONF_PREFERRED_TECHS "PreferredTechnologies"
#define CONF_FALLBACK_NAMESERVERS "FallbackNameservers"
#define CONF_TIMEOUT_INPUTREQ "InputRequestTimeout"
@@ -110,6 +113,7 @@ static const char *supported_options[] = {
CONF_BG_SCAN,
CONF_PREF_TIMESERVERS,
CONF_AUTO_CONNECT,
+ CONF_ALWAYS_CONNECTED_TECHS,
CONF_PREFERRED_TECHS,
CONF_FALLBACK_NAMESERVERS,
CONF_TIMEOUT_INPUTREQ,
@@ -295,6 +299,17 @@ static void parse_config(GKeyFile *config)
g_clear_error(&error);
str_list = __connman_config_get_string_list(config, "General",
+ CONF_ALWAYS_CONNECTED_TECHS, &len, &error);
+
+ if (!error)
+ connman_settings.always_connected_techs =
+ parse_service_types(str_list, len);
+
+ g_strfreev(str_list);
+
+ g_clear_error(&error);
+
+ str_list = __connman_config_get_string_list(config, "General",
CONF_FALLBACK_NAMESERVERS, &len, &error);
if (!error)
@@ -572,6 +587,9 @@ unsigned int *connman_setting_get_uint_list(const char *key)
if (g_str_equal(key, CONF_PREFERRED_TECHS))
return connman_settings.preferred_techs;
+ if (g_str_equal(key, CONF_ALWAYS_CONNECTED_TECHS))
+ return connman_settings.always_connected_techs;
+
return NULL;
}
--
2.10.2
------------------------------
Message: 3
Date: Wed, 23 Nov 2016 16:10:55 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Subject: [PATCH v5 2/4] service: implement AlwaysConnectedTechnologies
option
Message-ID: <[email protected]>
Content-Type: text/plain
Add a new array always_connect which stores the service technology type
info wether it should always connect or not. Verify at various points in
the auto_connect_service function the value for the autoconnecting service
type to ensure it always connects regardless of any preffered technologies.
---
src/service.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/service.c b/src/service.c
index 41dbc50..4ebee36 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3694,6 +3694,7 @@ static void disconnect_on_last_session(enum
connman_service_type type)
}
static int active_sessions[MAX_CONNMAN_SERVICE_TYPES] = {};
+static int always_connect[MAX_CONNMAN_SERVICE_TYPES] = {};
static int active_count = 0;
void __connman_service_set_active_session(bool enable, GSList *list)
@@ -3799,6 +3800,15 @@ static GList *preferred_tech_list_get(void)
return tech_data.preferred_list;
}
+static void set_always_connecting_technologies()
+{
+ unsigned int *always_connected_techs =
+ connman_setting_get_uint_list("AlwaysConnectedTechnologies");
+ int i;
+ for (i = 0; always_connected_techs && always_connected_techs[i]; i++)
+ always_connect[always_connected_techs[i]] = 1;
+}
+
static bool auto_connect_service(GList *services,
enum connman_service_connect_reason reason,
bool preferred)
@@ -3825,8 +3835,8 @@ static bool auto_connect_service(GList *services,
if (service->pending ||
is_connecting(service) ||
is_connected(service)) {
- if (!active_count)
- return true;
+ if (!active_count && !always_connect[service->type])
+ return true;
ignore[service->type] = true;
autoconnecting = true;
@@ -3848,7 +3858,9 @@ static bool auto_connect_service(GList *services,
CONNMAN_SERVICE_STATE_IDLE)
continue;
- if (autoconnecting && !active_sessions[service->type]) {
+ if (autoconnecting &&
+ !active_sessions[service->type] &&
+ !always_connect[service->type]) {
DBG("service %p type %s has no users", service,
__connman_service_type2string(service->type));
continue;
@@ -3859,7 +3871,7 @@ static bool auto_connect_service(GList *services,
__connman_service_connect(service, reason);
- if (!active_count)
+ if (!active_count && !always_connect[service->type])
return true;
ignore[service->type] = true;
@@ -7166,6 +7178,8 @@ int __connman_service_init(void)
return err;
}
+ set_always_connecting_technologies();
+
connection = connman_dbus_get_connection();
service_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
--
2.10.2
------------------------------
Message: 4
Date: Wed, 23 Nov 2016 16:10:56 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Subject: [PATCH v5 3/4] service: abstract the more complex autoconnect
conditionals
Message-ID: <[email protected]>
Content-Type: text/plain
The previous commit complicated some of the conditionals in the
auto_connect_service, so split them in their own function and add
comments to make them easier to understand.
---
src/service.c | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/src/service.c b/src/service.c
index 4ebee36..e5a106e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3809,6 +3809,34 @@ static void set_always_connecting_technologies()
always_connect[always_connected_techs[i]] = 1;
}
+static bool autoconnect_no_session_active(struct connman_service *service)
+{
+ /*
+ * Test active_count to see if there are no sessions set up and
+ * stop autoconnecting, but continue connecting if the service
+ * belongs to a technology which should always autoconnect.
+ */
+ if (!active_count && !always_connect[service->type])
+ return true;
+
+ return false;
+}
+
+static bool autoconnect_already_connecting(struct connman_service *service,
+ bool autoconnecting)
+{
+ /*
+ * If another service is already connecting and this service type has
+ * not been marked as always connecting, stop the connecting procedure.
+ */
+ if (autoconnecting &&
+ !active_sessions[service->type] &&
+ !always_connect[service->type])
+ return true;
+
+ return false;
+}
+
static bool auto_connect_service(GList *services,
enum connman_service_connect_reason reason,
bool preferred)
@@ -3835,7 +3863,7 @@ static bool auto_connect_service(GList *services,
if (service->pending ||
is_connecting(service) ||
is_connected(service)) {
- if (!active_count && !always_connect[service->type])
+ if (autoconnect_no_session_active(service))
return true;
ignore[service->type] = true;
@@ -3858,9 +3886,7 @@ static bool auto_connect_service(GList *services,
CONNMAN_SERVICE_STATE_IDLE)
continue;
- if (autoconnecting &&
- !active_sessions[service->type] &&
- !always_connect[service->type]) {
+ if (autoconnect_already_connecting(service, autoconnecting)) {
DBG("service %p type %s has no users", service,
__connman_service_type2string(service->type));
continue;
@@ -3871,7 +3897,7 @@ static bool auto_connect_service(GList *services,
__connman_service_connect(service, reason);
- if (!active_count && !always_connect[service->type])
+ if (autoconnect_no_session_active(service))
return true;
ignore[service->type] = true;
--
2.10.2
------------------------------
Message: 5
Date: Wed, 23 Nov 2016 16:10:57 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Subject: [PATCH v5 4/4] main.conf: document
AlwaysConnectedTechnologies option
Message-ID: <[email protected]>
Content-Type: text/plain
By default it's disabled and the list is empty.
Also document the man page for this main.conf option.
---
doc/connman.conf.5.in | 6 ++++++
src/main.conf | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in
index ff97b7c..db9e558 100644
--- a/doc/connman.conf.5.in
+++ b/doc/connman.conf.5.in
@@ -67,6 +67,12 @@ for this entry when empty is ethernet,wifi,cellular.
Services that are automatically connected must have been
set up and saved to storage beforehand.
.TP
+.BI AlwaysConnectedTechnologies= technology\fR[,...]
+List of technoolgies which are always connected regardless
+of PreferredTechnologies setting (AutoConnect = true). The
+default value is empty and this feature is disabled unless
+explicitely enabled in the config file.
+.TP
.BI PreferredTechnologies= technology\fR[,...]
List of preferred technologies from the most preferred
one to the least preferred one separated by commas ",".
diff --git a/src/main.conf b/src/main.conf
index acceda3..d619413 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -101,3 +101,10 @@
# quality. See RFC6343. Default value is false (as recommended by RFC6343
# section 4.1).
# Enable6to4 = false
+
+# List of technologies with AutoConnect = true which are always connected
+# regardless of PreferredTechnologies setting. Default value is empty and
+# will connect a technology only if it is at a higher preference than any
+# other which is already connected.
+# This setting has no effect if SingleConnectedTechnologies is enabled.
+# AlwaysConnectedTechnologies =
--
2.10.2
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 13, Issue 28
***************************************