Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe 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. Re: [PATCH] service: Restart online chek after connection loss
      (Daniel Wagner)
   2. [PATCH] service: Restart online check after disconnection
      (VAUTRIN Emmanuel (Canal Plus Prestataire))
   3. Re: [PATCH] service: Restart online check after disconnection
      (Daniel Wagner)
   4. RE: [PATCH 1/2] service: Add online check interval config options
      (VAUTRIN Emmanuel (Canal Plus Prestataire))


----------------------------------------------------------------------

Date: Fri, 5 Feb 2021 15:57:49 +0100
From: Daniel Wagner <[email protected]>
Subject: Re: [PATCH] service: Restart online chek after connection
        loss
To: "VAUTRIN Emmanuel (Canal Plus Prestataire)"
        <[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Fri, Feb 05, 2021 at 02:48:56PM +0000, VAUTRIN Emmanuel (Canal Plus 
Prestataire) wrote:
> Indeed, it is the same activity, but, this one is still useful with current
> state machine, that is why I have separated both patches.
> For example:
> 1. Start with Eth plugged and connect at least one Wifi service
> -> Eth online / Wifi ready
> 2. Unplug Eth
> -> Eth disconnected, then idle / Wifi ready
> This patch enables the current Wifi service to switch to online.

Good point. I haven't thought about this scenario. Could you update the
commit message with this information and resend? Thanks!

------------------------------

Date: Fri, 5 Feb 2021 17:07:26 +0000
From: "VAUTRIN Emmanuel (Canal Plus Prestataire)"
        <[email protected]>
Subject: [PATCH] service: Restart online check after disconnection
To: Daniel Wagner <[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID:  <[email protected]
        prd02.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"

In a multi-connected networks environment, it is necessary to
start the online check on the new default service, when the former one
has been disconnected, to enable it to get online, in replacement.

This case happens, for example, when you start with Ethernet plugged,
and connect to a Wifi network. The corresponding states are:
online (ethernet) / ready (wifi).
After unplugging Ethernet, the Wifi service stays in ready state, even
if online:
disconnect -> idle (ethernet) / ready (wifi).
---
 src/service.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/service.c b/src/service.c
index 94debc22..69f0a511 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1607,6 +1607,16 @@ static void default_changed(void)
                                
connman_setting_get_bool("AllowDomainnameUpdates"))
                        __connman_utsname_set_domainname(service->domainname);
 
+               if (__connman_service_is_connected_state(service,
+                                               CONNMAN_IPCONFIG_TYPE_IPV4))
+                       __connman_service_wispr_start(service,
+                                               CONNMAN_IPCONFIG_TYPE_IPV4);
+
+               if (__connman_service_is_connected_state(service,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6))
+                       __connman_service_wispr_start(service,
+                                               CONNMAN_IPCONFIG_TYPE_IPV6);
+
                /*
                 * Connect VPN automatically when new default service
                 * is set and connected, unless new default is VPN
-- 
2.25.1


------------------------------

Date: Fri, 5 Feb 2021 20:28:50 +0100
From: Daniel Wagner <[email protected]>
Subject: Re: [PATCH] service: Restart online check after disconnection
To: "VAUTRIN Emmanuel (Canal Plus Prestataire)"
        <[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Fri, Feb 05, 2021 at 05:07:26PM +0000, VAUTRIN Emmanuel (Canal Plus 
Prestataire) wrote:
> In a multi-connected networks environment, it is necessary to
> start the online check on the new default service, when the former one
> has been disconnected, to enable it to get online, in replacement.
> 
> This case happens, for example, when you start with Ethernet plugged,
> and connect to a Wifi network. The corresponding states are:
> online (ethernet) / ready (wifi).
> After unplugging Ethernet, the Wifi service stays in ready state, even
> if online:
> disconnect -> idle (ethernet) / ready (wifi).

I've changed the commit message a bit.

Patch applied.
Thanks,
Daniel

------------------------------

Date: Fri, 5 Feb 2021 20:52:54 +0000
From: "VAUTRIN Emmanuel (Canal Plus Prestataire)"
        <[email protected]>
Subject: RE: [PATCH 1/2] service: Add online check interval config
        options
To: Daniel Wagner <[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID:  <[email protected]
        prd02.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"

Global config options, which allow to set the range of intervals
between two online check requests.
When an online check request fails, another one is triggered after a
longer interval. The intervals follow the power of two series of numbers
between OnlineCheckInitialInterval and OnlineCheckMaxInterval.
Default range is [1, 12], corresponding to the following intervals, in
seconds: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121 and 144.
---
 doc/connman.conf.5.in |  8 ++++++
 include/setting.h     |  1 +
 src/main.c            | 67 ++++++++++++++++++++++++++++++++++++++-----
 src/main.conf         |  9 ++++++
 src/service.c         | 22 +++++++-------
 5 files changed, 88 insertions(+), 19 deletions(-)

diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in
index a90c2291..19e6e0c0 100644
--- a/doc/connman.conf.5.in
+++ b/doc/connman.conf.5.in
@@ -167,6 +167,14 @@ transitioned to ONLINE state.
 If this setting is false, the default service will remain in READY state.
 Default value is true.
 .TP
+.BI OnlineCheckInitialInterval= secs, OnlineCheckMaxInterval= secs
+Range of intervals between two online check requests.
+When an online check request fails, another one is triggered after a
+longer interval. The intervals follow the power of two series of numbers
+between OnlineCheckInitialInterval and OnlineCheckMaxInterval.
+Default range is [1, 12], corresponding to the following intervals, in
+seconds: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121 and 144.
+.TP
 .BI AutoConnectRoamingServices=true\ \fR|\fB\ false
 Automatically connect roaming services. This is not recommended unless you know
 you won't have any billing problem.
diff --git a/include/setting.h b/include/setting.h
index a8820217..8d2c37b7 100644
--- a/include/setting.h
+++ b/include/setting.h
@@ -29,6 +29,7 @@ extern "C" {
 #endif
 
 bool connman_setting_get_bool(const char *key);
+unsigned int connman_setting_get_uint(const char *key);
 char **connman_setting_get_string_list(const char *key);
 unsigned int *connman_setting_get_uint_list(const char *key);
 
diff --git a/src/main.c b/src/main.c
index 94afc1d9..68352415 100644
--- a/src/main.c
+++ b/src/main.c
@@ -44,6 +44,14 @@
 #define DEFAULT_INPUT_REQUEST_TIMEOUT (120 * 1000)
 #define DEFAULT_BROWSER_LAUNCH_TIMEOUT (300 * 1000)
 
+/*
+ * We set the integer to 1 sec so that we have a chance to get
+ * necessary IPv6 router advertisement messages that might have
+ * DNS data etc.
+ */
+#define DEFAULT_ONLINE_CHECK_INITIAL_INTERVAL 1
+#define DEFAULT_ONLINE_CHECK_MAX_INTERVAL 12
+
 #define MAINFILE "main.conf"
 #define CONFIGMAINFILE CONFIGDIR "/" MAINFILE
 
@@ -88,6 +96,8 @@ static struct {
        bool enable_6to4;
        char *vendor_class_id;
        bool enable_online_check;
+       unsigned int online_check_initial_interval;
+       unsigned int online_check_max_interval;
        bool auto_connect_roaming_services;
        bool acd;
        bool use_gateways_as_timeservers;
@@ -110,6 +120,8 @@ static struct {
        .enable_6to4 = false,
        .vendor_class_id = NULL,
        .enable_online_check = true,
+       .online_check_initial_interval = DEFAULT_ONLINE_CHECK_INITIAL_INTERVAL,
+       .online_check_max_interval = DEFAULT_ONLINE_CHECK_MAX_INTERVAL,
        .auto_connect_roaming_services = false,
        .acd = false,
        .use_gateways_as_timeservers = false,
@@ -133,6 +145,8 @@ static struct {
 #define CONF_ENABLE_6TO4                "Enable6to4"
 #define CONF_VENDOR_CLASS_ID            "VendorClassID"
 #define CONF_ENABLE_ONLINE_CHECK        "EnableOnlineCheck"
+#define CONF_ONLINE_CHECK_INITIAL_INTERVAL "OnlineCheckInitialInterval"
+#define CONF_ONLINE_CHECK_MAX_INTERVAL     "OnlineCheckMaxInterval"
 #define CONF_AUTO_CONNECT_ROAMING_SERVICES "AutoConnectRoamingServices"
 #define CONF_ACD                        "AddressConflictDetection"
 #define CONF_USE_GATEWAYS_AS_TIMESERVERS "UseGatewaysAsTimeservers"
@@ -156,6 +170,8 @@ static const char *supported_options[] = {
        CONF_ENABLE_6TO4,
        CONF_VENDOR_CLASS_ID,
        CONF_ENABLE_ONLINE_CHECK,
+       CONF_ONLINE_CHECK_INITIAL_INTERVAL,
+       CONF_ONLINE_CHECK_MAX_INTERVAL,
        CONF_AUTO_CONNECT_ROAMING_SERVICES,
        CONF_ACD,
        CONF_USE_GATEWAYS_AS_TIMESERVERS,
@@ -283,7 +299,7 @@ static void parse_config(GKeyFile *config)
        char **tethering;
         char *vendor_class_id;
        gsize len;
-       int timeout;
+       int integer;
 
        if (!config) {
                connman_settings.auto_connect =
@@ -370,17 +386,17 @@ static void parse_config(GKeyFile *config)
 
        g_clear_error(&error);
 
-       timeout = g_key_file_get_integer(config, "General",
+       integer = g_key_file_get_integer(config, "General",
                        CONF_TIMEOUT_INPUTREQ, &error);
-       if (!error && timeout >= 0)
-               connman_settings.timeout_inputreq = timeout * 1000;
+       if (!error && integer >= 0)
+               connman_settings.timeout_inputreq = integer * 1000;
 
        g_clear_error(&error);
 
-       timeout = g_key_file_get_integer(config, "General",
+       integer = g_key_file_get_integer(config, "General",
                        CONF_TIMEOUT_BROWSERLAUNCH, &error);
-       if (!error && timeout >= 0)
-               connman_settings.timeout_browserlaunch = timeout * 1000;
+       if (!error && integer >= 0)
+               connman_settings.timeout_browserlaunch = integer * 1000;
 
        g_clear_error(&error);
 
@@ -458,6 +474,32 @@ static void parse_config(GKeyFile *config)
 
        g_clear_error(&error);
 
+       integer = g_key_file_get_integer(config, "General",
+                       CONF_ONLINE_CHECK_INITIAL_INTERVAL, &error);
+       if (!error && integer >= 0)
+               connman_settings.online_check_initial_interval = integer;
+
+       g_clear_error(&error);
+
+       integer = g_key_file_get_integer(config, "General",
+                       CONF_ONLINE_CHECK_MAX_INTERVAL, &error);
+       if (!error && integer >= 0)
+               connman_settings.online_check_max_interval = integer;
+
+       g_clear_error(&error);
+
+       if (connman_settings.online_check_initial_interval < 1 ||
+               connman_settings.online_check_initial_interval >
+               connman_settings.online_check_max_interval) {
+               connman_warn("Incorrect online check intervals [%u, %u]",
+                               connman_settings.online_check_initial_interval,
+                               connman_settings.online_check_max_interval);
+               connman_settings.online_check_initial_interval =
+                       DEFAULT_ONLINE_CHECK_INITIAL_INTERVAL;
+               connman_settings.online_check_max_interval =
+                       DEFAULT_ONLINE_CHECK_MAX_INTERVAL;
+       }
+
        boolean = __connman_config_get_bool(config, "General",
                                CONF_AUTO_CONNECT_ROAMING_SERVICES, &error);
        if (!error)
@@ -699,6 +741,17 @@ bool connman_setting_get_bool(const char *key)
        return false;
 }
 
+unsigned int connman_setting_get_uint(const char *key)
+{
+       if (g_str_equal(key, CONF_ONLINE_CHECK_INITIAL_INTERVAL))
+               return connman_settings.online_check_initial_interval;
+
+       if (g_str_equal(key, CONF_ONLINE_CHECK_MAX_INTERVAL))
+               return connman_settings.online_check_max_interval;
+
+       return 0;
+}
+
 char **connman_setting_get_string_list(const char *key)
 {
        if (g_str_equal(key, CONF_PREF_TIMESERVERS))
diff --git a/src/main.conf b/src/main.conf
index 14965e12..83cd20f6 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -125,6 +125,15 @@
 # Default value is true.
 # EnableOnlineCheck = false
 
+# Range of intervals between two online check requests.
+# When an online check request fails, another one is triggered after a
+# longer interval. The intervals follow the power of two series of numbers
+# between OnlineCheckInitialInterval and OnlineCheckMaxInterval.
+# Default range is [1, 12], corresponding to the following intervals, in
+# seconds: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121 and 144.
+# OnlineCheckInitialInterval = 1
+# OnlineCheckMaxInterval = 12
+
 # 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
diff --git a/src/service.c b/src/service.c
index 94debc22..b3294478 100644
--- a/src/service.c
+++ b/src/service.c
@@ -54,6 +54,8 @@ static unsigned int autoconnect_id = 0;
 static unsigned int vpn_autoconnect_id = 0;
 static struct connman_service *current_default = NULL;
 static bool services_dirty = false;
+static unsigned int online_check_initial_interval = 0;
+static unsigned int online_check_max_interval = 0;
 
 struct connman_stats {
        bool valid;
@@ -1448,6 +1450,10 @@ static void start_online_check(struct connman_service 
*service,
                        "Default service remains in READY state.");
                return;
        }
+       online_check_initial_interval =
+               connman_setting_get_uint("OnlineCheckInitialInterval");
+       online_check_max_interval =
+               connman_setting_get_uint("OnlineCheckMaxInterval");
 
        if (type != CONNMAN_IPCONFIG_TYPE_IPV4 || check_proxy_setup(service)) {
                cancel_online_check(service);
@@ -3549,14 +3555,6 @@ int __connman_service_reset_ipconfig(struct 
connman_service *service,
        return err;
 }
 
-/*
- * We set the timeout to 1 sec so that we have a chance to get
- * necessary IPv6 router advertisement messages that might have
- * DNS data etc.
- */
-#define ONLINE_CHECK_INITIAL_INTERVAL 1
-#define ONLINE_CHECK_MAX_INTERVAL 12
-
 void __connman_service_wispr_start(struct connman_service *service,
                                        enum connman_ipconfig_type type)
 {
@@ -3564,10 +3562,10 @@ void __connman_service_wispr_start(struct 
connman_service *service,
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
                service->online_check_interval_ipv4 =
-                                       ONLINE_CHECK_INITIAL_INTERVAL;
+                                       online_check_initial_interval;
        else
                service->online_check_interval_ipv6 =
-                                       ONLINE_CHECK_INITIAL_INTERVAL;
+                                       online_check_initial_interval;
 
        __connman_wispr_start(service, type);
 }
@@ -6269,9 +6267,9 @@ int __connman_service_online_check_failed(struct 
connman_service *service,
                                redo_func, connman_service_ref(service));
 
        /* Increment the interval for the next time, set a maximum timeout of
-        * ONLINE_CHECK_MAX_INTERVAL * ONLINE_CHECK_MAX_INTERVAL seconds.
+        * online_check_max_interval seconds * online_check_max_interval 
seconds.
         */
-       if (*interval < ONLINE_CHECK_MAX_INTERVAL)
+       if (*interval < online_check_max_interval)
                (*interval)++;
 
        return EAGAIN;
-- 
2.25.1


------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list -- [email protected]
To unsubscribe send an email to [email protected]


------------------------------

End of connman Digest, Vol 64, Issue 7
**************************************

Reply via email to