Send connman mailing list submissions to
        connman@lists.01.org

To subscribe or unsubscribe via email, send a message with subject or
body 'help' to
        connman-requ...@lists.01.org

You can reach the person managing the list at
        connman-ow...@lists.01.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."

Today's Topics:

   1. [PATCH] service: Restart online chek after connection loss
      (VAUTRIN Emmanuel (Canal Plus Prestataire))
   2. [PATCH 0/2] More reactive and customizable online check
      (VAUTRIN Emmanuel (Canal Plus Prestataire))
   3. RE: [PATCH 1/2] service: Add online check interval config options
      (VAUTRIN Emmanuel (Canal Plus Prestataire))


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

Date: Tue, 2 Feb 2021 14:09:20 +0000
From: "VAUTRIN Emmanuel (Canal Plus Prestataire)"
        <emmanuel.vaut...@cpexterne.org>
Subject: [PATCH] service: Restart online chek after connection loss
To: "connman@lists.01.org" <connman@lists.01.org>
Message-ID:  <pr1pr02mb4794b52432f28e3e75c6490693...@pr1pr02mb4794.eur
        prd02.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"

After a connection loss, the online check needs to be restarted
on the new default service, if ready, to get online, in replacement.
---
 src/service.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/service.c b/src/service.c
index c9bcad16..b33310b6 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1586,6 +1587,16 @@ connman_info("%s(%d) -------------------------- services 
%p %s, state: %d -> %p
                                
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: Tue, 2 Feb 2021 17:40:35 +0000
From: "VAUTRIN Emmanuel (Canal Plus Prestataire)"
        <emmanuel.vaut...@cpexterne.org>
Subject: [PATCH 0/2] More reactive and customizable online check
To: "connman@lists.01.org" <connman@lists.01.org>
Message-ID:  <pr1pr02mb47945aab6828313b051fbdf493...@pr1pr02mb4794.eur
        prd02.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"

Provide a more reactive and customizable online check.
Keep checking Internet connection, return to ready state when offline,
and switch to other connected networks to get back online.

Emmanuel VAUTRIN (2):
  service: Add online check interval config options
  wispr: Update service state on connection loss

 doc/connman.conf.5.in | 16 +++++++++++++
 include/setting.h     |  1 +
 src/connman.h         |  5 ++--
 src/main.c            | 55 +++++++++++++++++++++++++++++++++++++------
 src/main.conf         | 16 +++++++++++++
 src/service.c         | 42 ++++++++++++++++++++-------------
 src/wispr.c           | 12 ++++------
 7 files changed, 114 insertions(+), 33 deletions(-)

-- 
2.25.1


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

Date: Tue, 2 Feb 2021 17:44:55 +0000
From: "VAUTRIN Emmanuel (Canal Plus Prestataire)"
        <emmanuel.vaut...@cpexterne.org>
Subject: RE: [PATCH 1/2] service: Add online check interval config
        options
To: "connman@lists.01.org" <connman@lists.01.org>
Message-ID:  <pr1pr02mb47948eff045d6cde130e804d93...@pr1pr02mb4794.eur
        prd02.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"

Global config options, which allow to set initial and maximum intervals
between two online check requests.
The interval will increase by power of two, from
OnlineCheckInitialInterval (1 second by default) to
OnlineCheckMaxInterval (144 seconds by default).
---
 doc/connman.conf.5.in | 16 +++++++++++++
 include/setting.h     |  1 +
 src/main.c            | 55 +++++++++++++++++++++++++++++++++++++------
 src/main.conf         | 16 +++++++++++++
 src/service.c         | 22 ++++++++---------
 5 files changed, 91 insertions(+), 19 deletions(-)

diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in
index a90c2291..30b7748d 100644
--- a/doc/connman.conf.5.in
+++ b/doc/connman.conf.5.in
@@ -167,6 +167,22 @@ 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
+Set initial interval between two online check requests.
+The interval will increase by power of two from OnlineCheckInitialInterval
+to OnlineCheckMaxInterval.
+Default is 1, corresponding to 1 second.
+Use this setting to increase the value in case of different user
+interface designs.
+.TP
+.BI OnlineCheckMaxInterval= secs
+Set maximum interval between two online check requests.
+The interval will increase by power of two from OnlineCheckInitialInterval
+to OnlineCheckMaxInterval.
+Default is 12, corresponding to 144 seconds.
+Use this setting to decrease the value in case of different user
+interface designs.
+.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..65472763 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,20 @@ 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 >= 1)
+               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 >= connman_settings.online_check_initial_interval)
+               connman_settings.online_check_max_interval = integer;
+
+       g_clear_error(&error);
+
        boolean = __connman_config_get_bool(config, "General",
                                CONF_AUTO_CONNECT_ROAMING_SERVICES, &error);
        if (!error)
@@ -699,6 +729,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 NULL;
+}
+
 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..f8a3da52 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -125,6 +125,22 @@
 # Default value is true.
 # EnableOnlineCheck = false
 
+# Set initial interval between two online check requests.
+# The interval will increase by power of two from OnlineCheckInitialInterval
+# to OnlineCheckMaxInterval.
+# Default is 1, corresponding to 1 second.
+# Use this setting to increase the value in case of different user
+# interface designs.
+# OnlineCheckInitialInterval = 1
+ 
+# Set maximum interval between two online check requests.
+# The interval will increase by power of two from OnlineCheckInitialInterval
+# to OnlineCheckMaxInterval.
+# Default is 12, corresponding to 144 seconds.
+# Use this setting to decrease the value in case of different user
+# interface designs.
+# 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 -- connman@lists.01.org
To unsubscribe send an email to connman-le...@lists.01.org


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

End of connman Digest, Vol 63, Issue 12
***************************************

Reply via email to