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 0/6] Re: Propose patch for perpetual online check for
connected services ([email protected])
2. [PATCH 1/6] Added a config option for perpetual online check
([email protected])
3. [PATCH 2/6] Added check if the device is in
InterfacesPerpetualOnlineCheck ([email protected])
4. [PATCH 3/6] Exported device getter for the network object
([email protected])
5. [PATCH 4/6] Added flag in service object to determinte
perpetual online check ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Tue, 27 Aug 2019 15:30:40 +0300
From: [email protected]
To: [email protected]
Cc: Aleksandar Mitev <[email protected]>
Subject: [PATCH 0/6] Re: Propose patch for perpetual online check for
connected services
Message-ID: <[email protected]>
From: Aleksandar Mitev <[email protected]>
Hi Daniel,
So nice to hear from you :)
Ok, let me describe our use case that led me to come up with the proposed
change:
We have a setup with Ethernet, Wifi and Cellular and want to have Internet
access
in any case. This would mean that if an interface fails or doesn't have Internet
reachability, a switchover should be made to the next one. Of course, Ethernet
is the most preferred, falling back to Wifi, and if Wifi is not reliable source
of Internet, then go to the last resort of Cellular.
Everything is running fine with the current version of connman, except that, if,
for example, Ethernet is the current default source of Internet, and the router
we are connected to, stops routing packets for some reason, then we lose
Internet
connectivity and our connection the device is no longer active.
But connman would not react and continue using the Ethernet connecion. I have
seen
this on my Android phone as well: when I am connected with Wifi and the ISP
decides to cut my router's Internet access, then the phone would not switch to
cellular
and no application would recieve notifications for indefinite time.
So my proposed change is to monitor the internet reachability at regular
intervals,
using the same technique that connman uses now at the connecting phase. However,
since this checking will eat some data inevitably, we would not want to run it
on the cellular connection, at least (which is last resort anyway and no
fallback
can be made). That is why the config option I added is based on network
interfaces,
allowing you to choose only those devices that would make sence to continuously
check for Internet reachability.
*************
On 8/7/19 2:56 PM, Aleksandar Mitev wrote:
>> I would like to propose adding an additional config option to the main
>> config file of connman that would enable continuous recheck of the
>> internet connectivity for the current default connection. It would solve
>> the problem of losing internet connectivity after choosing the default
>> connection, due to router malfunction etc., which may result in the
>> system running connman in staying offline for indefinite time. The
>> option defines interfaces on which such a recheck is enabled, because
>> some of them may have too expensive data plans to permit for such
>> regular checks.
>
>I am bit lost, e.g. what do you mean with the last sentence. I read
>checking for online connectivity is too expensive, so let's do regular
>check. Can you elaborate a bit on your use case?
I hope the above info is descriptive enough. I am avaialable for more
details if needed.
>> The config option goes like this:
>> # List of network interfaces that will continuously check
>> # for online connectivity, separated by ",".
>> # Services will check whether the interface they use is
>> # into this list and if so will conduct online state check
>> # regularly once Online state is reached. When in Online state
>> # but due to lack of internet connectivity the service is
>> # downgraded to a Ready state giving the chance of other
>> # configured services to take over.
>> # This feature depends on EnableOnlineCheck = true.
>> # Default value is empty.
>> # InterfacesPerpetualOnlineCheck = vmnet,vboxnet,virbr,ifb,ve-,vb-
>
>Okay I might remember wrong. Currently we do only do the online check
>when the link is setup, right? So adding the missing code which
>constantly checks for online connectivity is just missing. With that we
>would also get automatic downgrade (missing feature). IIRC this feature
>is exists in Jolla version of ConnMan [1].
>
>If possible I would like to avoid adding another config variable. Makes
>it even more complex to handle it, let alone to test. It looks like I
>need to understand first what you are trying to solve here.
>
>[1] https://git.merproject.org/mer-core/connman
I was not familiar with this fork of connman. Did not test it but looked
at the code and I did not find the continuous check after the service goes to
ONLINE state. I may be missing smth here, though.
As for the config option - sure, it could be removed (meaning that all
interfaces would be treated as enabled for checks) or reduces to a
simple global switch that would enable continuous online check after
going to the ONLINE state. However, please consider the usefulness of
our use case here.
>> Attached is the proposed patch (based on tag 1.37).
>
>The patches were attached to this mail. Did you use git send-email to
>send out the patches?
No, I just used my email client. Now using the git send mail. Hope this
is the right way to send patch proposals along.
>> Would be happy to read your feedback for this is my first proposal for
>> change to connman :)
>
>Welcome! I am sorry to response to many emails rather late. Not much
>space between work and a lot of other hobbies :)
Thank you!
No problem, since it is holiday season, anyway. My response comes a bit
late as well, so sorry abot that as well.
Thanks again for starting the discusstion on the proposed change.
Best,
Aleksnadar
******
Aleksandar Mitev (6):
Added a config option for perpetual online check
Added check if the device is in InterfacesPerpetualOnlineCheck
Exported device getter for the network object
Added flag in service object to determinte perpetual online check
Added logic to perform perpetual online checks
Added timeout to socket connections
gweb/gweb.c | 32 +++++++++++++++++
include/device.h | 1 +
src/connman.h | 1 +
src/device.c | 27 +++++++++++++++
src/main.c | 26 ++++++++++++++
src/main.conf | 12 +++++++
src/network.c | 5 +++
src/service.c | 90 +++++++++++++++++++++++++++++++++++++++++++++---
8 files changed, 190 insertions(+), 4 deletions(-)
--
2.17.1
------------------------------
Message: 2
Date: Tue, 27 Aug 2019 15:30:41 +0300
From: [email protected]
To: [email protected]
Cc: Aleksandar Mitev <[email protected]>
Subject: [PATCH 1/6] Added a config option for perpetual online check
Message-ID: <[email protected]>
From: Aleksandar Mitev <[email protected]>
The name is InterfacesPerpetualOnlineCheck and it is empty by
default
---
src/main.c | 26 ++++++++++++++++++++++++++
src/main.conf | 12 ++++++++++++
2 files changed, 38 insertions(+)
diff --git a/src/main.c b/src/main.c
index 2371771f..6d9e2654 100644
--- a/src/main.c
+++ b/src/main.c
@@ -69,6 +69,10 @@ static char *default_blacklist[] = {
NULL
};
+static char *default_online_check[] = {
+ NULL
+};
+
static struct {
bool bg_scan;
char **pref_timeservers;
@@ -91,6 +95,7 @@ static struct {
bool auto_connect_roaming_services;
bool acd;
bool use_gateways_as_timeservers;
+ char **interfaces_perpetual_online_check;
} connman_settings = {
.bg_scan = true,
.pref_timeservers = NULL,
@@ -113,6 +118,7 @@ static struct {
.auto_connect_roaming_services = false,
.acd = false,
.use_gateways_as_timeservers = false,
+ .interfaces_perpetual_online_check = NULL,
};
#define CONF_BG_SCAN "BackgroundScanning"
@@ -136,6 +142,7 @@ static struct {
#define CONF_AUTO_CONNECT_ROAMING_SERVICES "AutoConnectRoamingServices"
#define CONF_ACD "AddressConflictDetection"
#define CONF_USE_GATEWAYS_AS_TIMESERVERS "UseGatewaysAsTimeservers"
+#define CONF_INTERFACES_PERPETUAL_ONLINE_CHECK "InterfacesPerpetualOnlineCheck"
static const char *supported_options[] = {
CONF_BG_SCAN,
@@ -158,6 +165,7 @@ static const char *supported_options[] = {
CONF_AUTO_CONNECT_ROAMING_SERVICES,
CONF_ACD,
CONF_USE_GATEWAYS_AS_TIMESERVERS,
+ CONF_INTERFACES_PERPETUAL_ONLINE_CHECK,
NULL
};
@@ -278,6 +286,7 @@ static void parse_config(GKeyFile *config)
bool boolean;
char **timeservers;
char **interfaces;
+ char **interfaces_online_check;
char **str_list;
char **tethering;
char *vendor_class_id;
@@ -291,6 +300,8 @@ static void parse_config(GKeyFile *config)
parse_service_types(default_favorite_techs,
CONF_ARRAY_SIZE(default_favorite_techs));
connman_settings.blacklisted_interfaces =
g_strdupv(default_blacklist);
+ connman_settings.interfaces_perpetual_online_check =
+ g_strdupv(default_online_check);
return;
}
@@ -476,6 +487,17 @@ static void parse_config(GKeyFile *config)
connman_settings.use_gateways_as_timeservers = boolean;
g_clear_error(&error);
+
+ interfaces_online_check = __connman_config_get_string_list(config,
"General",
+ CONF_INTERFACES_PERPETUAL_ONLINE_CHECK, &len, &error);
+
+ if (!error)
+ connman_settings.interfaces_perpetual_online_check =
interfaces_online_check;
+ else
+ connman_settings.interfaces_perpetual_online_check =
+ g_strdupv(default_online_check);
+
+ g_clear_error(&error);
}
static int config_init(const char *file)
@@ -712,6 +734,9 @@ char **connman_setting_get_string_list(const char *key)
if (g_str_equal(key, CONF_TETHERING_TECHNOLOGIES))
return connman_settings.tethering_technologies;
+ if (g_str_equal(key, CONF_INTERFACES_PERPETUAL_ONLINE_CHECK))
+ return connman_settings.interfaces_perpetual_online_check;
+
return NULL;
}
@@ -919,6 +944,7 @@ int main(int argc, char *argv[])
g_strfreev(connman_settings.fallback_nameservers);
g_strfreev(connman_settings.blacklisted_interfaces);
g_strfreev(connman_settings.tethering_technologies);
+ g_strfreev(connman_settings.interfaces_perpetual_online_check);
g_free(option_debug);
g_free(option_wifi);
diff --git a/src/main.conf b/src/main.conf
index 14965e12..047851ec 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -143,3 +143,15 @@
# to an interface (in accordance with RFC 5227).
# Default value is false.
# AddressConflictDetection = false
+
+# List of network interfaces that will continuously check
+# for online connectivity, separated by ",".
+# Services will check whether the interface they use is
+# into this list and if so will conduct online state check
+# regularly once Online state is reached. When in Online state
+# but due to lack of internet connectivity the service is
+# downgraded to a Ready state giving the chance of other
+# configured services to take over.
+# This feature depends on EnableOnlineCheck = true.
+# Default value is empty.
+# InterfacesPerpetualOnlineCheck = vmnet,vboxnet,virbr,ifb,ve-,vb-
--
2.17.1
------------------------------
Message: 3
Date: Tue, 27 Aug 2019 15:30:42 +0300
From: [email protected]
To: [email protected]
Cc: Aleksandar Mitev <[email protected]>
Subject: [PATCH 2/6] Added check if the device is in
InterfacesPerpetualOnlineCheck
Message-ID: <[email protected]>
From: Aleksandar Mitev <[email protected]>
---
include/device.h | 1 +
src/device.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/include/device.h b/include/device.h
index 0fc06bd0..c4d0fe43 100644
--- a/include/device.h
+++ b/include/device.h
@@ -122,6 +122,7 @@ void connman_device_regdom_notify(struct connman_device
*device,
struct connman_device *connman_device_create_from_index(int index);
struct connman_device *connman_device_find_by_index(int index);
int connman_device_reconnect_service(struct connman_device *device);
+bool connman_device_perpetual_online_check_enabled(struct connman_device
*device);
struct connman_device_driver {
const char *name;
diff --git a/src/device.c b/src/device.c
index 264c5e2d..816e5e11 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1502,3 +1502,30 @@ void __connman_device_cleanup(void)
g_strfreev(nodevice_filter);
g_strfreev(device_filter);
}
+
+bool connman_device_perpetual_online_check_enabled(struct connman_device
*device)
+{
+ char **interfaces_online_check;
+ const char *dev_name;
+ char **pattern;
+
+ DBG("checking perpetual online check for device %s", device->name);
+
+ interfaces_online_check =
+
connman_setting_get_string_list("InterfacesPerpetualOnlineCheck");
+ if (!interfaces_online_check)
+ return false;
+
+ dev_name = connman_device_get_string(device, "Interface");
+ if (!dev_name)
+ return false;
+
+ for (pattern = interfaces_online_check; *pattern; pattern++) {
+ if (!g_strcmp0(dev_name, *pattern)) {
+ DBG("applying perpetual online check for device %s",
dev_name);
+ return true;
+ }
+ }
+
+ return false;
+}
--
2.17.1
------------------------------
Message: 4
Date: Tue, 27 Aug 2019 15:30:43 +0300
From: [email protected]
To: [email protected]
Cc: Aleksandar Mitev <[email protected]>
Subject: [PATCH 3/6] Exported device getter for the network object
Message-ID: <[email protected]>
From: Aleksandar Mitev <[email protected]>
---
src/connman.h | 1 +
src/network.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/src/connman.h b/src/connman.h
index 8101c7b2..17f502a9 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -610,6 +610,7 @@ const char *__connman_network_get_type(struct
connman_network *network);
const char *__connman_network_get_group(struct connman_network *network);
const char *__connman_network_get_ident(struct connman_network *network);
bool __connman_network_get_weakness(struct connman_network *network);
+struct connman_device *__connman_network_get_device(struct connman_network
*network);
int __connman_config_init();
void __connman_config_cleanup(void);
diff --git a/src/network.c b/src/network.c
index 56fe24ff..35513d7d 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1465,6 +1465,11 @@ const char *__connman_network_get_ident(struct
connman_network *network)
return connman_device_get_ident(network->device);
}
+struct connman_device *__connman_network_get_device(struct connman_network
*network)
+{
+ return network->device;
+}
+
bool __connman_network_get_weakness(struct connman_network *network)
{
switch (network->type) {
--
2.17.1
------------------------------
Message: 5
Date: Tue, 27 Aug 2019 15:30:44 +0300
From: [email protected]
To: [email protected]
Cc: Aleksandar Mitev <[email protected]>
Subject: [PATCH 4/6] Added flag in service object to determinte
perpetual online check
Message-ID: <[email protected]>
From: Aleksandar Mitev <[email protected]>
---
src/service.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/service.c b/src/service.c
index 3202f26c..7051165b 100644
--- a/src/service.c
+++ b/src/service.c
@@ -135,6 +135,7 @@ struct connman_service {
bool hidden_service;
char *config_file;
char *config_entry;
+ bool perpetual_online_check;
};
static bool allow_property_changed(struct connman_service *service);
@@ -7046,6 +7047,7 @@ static void update_from_network(struct connman_service
*service,
{
uint8_t strength = service->strength;
const char *str;
+ struct connman_device *device;
DBG("service %p network %p", service, network);
@@ -7093,6 +7095,13 @@ static void update_from_network(struct connman_service
*service,
if (!service->network)
service->network = connman_network_ref(network);
+ device = __connman_network_get_device(network);
+ if (device != NULL)
+ service->perpetual_online_check =
+ connman_device_perpetual_online_check_enabled(device);
+ connman_info("Perpetual online check for service %s is %s",
+ service->identifier, service->perpetual_online_check ?
"Enabled" : "Disabled");
+
service_list_sort();
}
--
2.17.1
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 46, Issue 25
***************************************