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] service: Add EnableOnlineCheck config option
      (Lukasz Nowak)


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

Message: 1
Date: Wed,  8 Mar 2017 17:37:16 +0000
From: Lukasz Nowak <[email protected]>
To: [email protected]
Subject: [PATCH] service: Add EnableOnlineCheck config option
Message-ID: <[email protected]>

From: Lukasz Nowak <[email protected]>

Global config option, which allows to enable/disable (enabled by default)
use of http get in wispr to transition a default service from READY to
ONLINE state.
---
 doc/connman.conf.5.in |  9 +++++++++
 src/main.c            | 14 ++++++++++++++
 src/main.conf         |  9 +++++++++
 src/service.c         | 15 ++++++++-------
 4 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in
index c113ac3..9c99910 100644
--- a/doc/connman.conf.5.in
+++ b/doc/connman.conf.5.in
@@ -136,6 +136,15 @@ See RFC6343.  Default value is false (as recommended by 
RFC6343 section 4.1).
 Set DHCP option 60 (Vendor Class ID) to the given string. This option can
 be used by DHCP servers to identify specific clients without having to
 rely on MAC address ranges, etc
+.TP
+.BI EnableOnlineCheck=true\ \fR|\fB\ false
+Enable or disable use of http get as on online status check.
+When a service is in a READY state, and is selected as default,
+ConnMan will issue an HTTP GET request to verify that end-to-end
+connectivity is successful. Only then the service will be
+transitioned to ONLINE state.
+If this setting is false, the default service will remain in READY state.
+Default value is true.
 .SH "EXAMPLE"
 The following example configuration disables hostname updates and enables
 ethernet tethering.
diff --git a/src/main.c b/src/main.c
index 915c17e..b3e6bc9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -78,6 +78,7 @@ static struct {
        bool persistent_tethering_mode;
        bool enable_6to4;
        char *vendor_class_id;
+       bool enable_online_check;
 } connman_settings  = {
        .bg_scan = true,
        .pref_timeservers = NULL,
@@ -94,6 +95,7 @@ static struct {
        .persistent_tethering_mode = false,
        .enable_6to4 = false,
        .vendor_class_id = NULL,
+       .enable_online_check = true,
 };
 
 #define CONF_BG_SCAN                    "BackgroundScanning"
@@ -111,6 +113,7 @@ static struct {
 #define CONF_PERSISTENT_TETHERING_MODE  "PersistentTetheringMode"
 #define CONF_ENABLE_6TO4                "Enable6to4"
 #define CONF_VENDOR_CLASS_ID            "VendorClassID"
+#define CONF_ENABLE_ONLINE_CHECK        "EnableOnlineCheck"
 
 static const char *supported_options[] = {
        CONF_BG_SCAN,
@@ -128,6 +131,7 @@ static const char *supported_options[] = {
        CONF_PERSISTENT_TETHERING_MODE,
        CONF_ENABLE_6TO4,
        CONF_VENDOR_CLASS_ID,
+       CONF_ENABLE_ONLINE_CHECK,
        NULL
 };
 
@@ -394,6 +398,13 @@ static void parse_config(GKeyFile *config)
                connman_settings.vendor_class_id = vendor_class_id;
 
        g_clear_error(&error);
+
+       boolean = __connman_config_get_bool(config, "General",
+                                       CONF_ENABLE_ONLINE_CHECK, &error);
+       if (!error)
+               connman_settings.enable_online_check = boolean;
+
+       g_clear_error(&error);
 }
 
 static int config_init(const char *file)
@@ -574,6 +585,9 @@ bool connman_setting_get_bool(const char *key)
        if (g_str_equal(key, CONF_ENABLE_6TO4))
                return connman_settings.enable_6to4;
 
+       if (g_str_equal(key, CONF_ENABLE_ONLINE_CHECK))
+               return connman_settings.enable_online_check;
+
        return false;
 }
 
diff --git a/src/main.conf b/src/main.conf
index d619413..68870b2 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -102,6 +102,15 @@
 # section 4.1).
 # Enable6to4 = false
 
+# Enable use of http get as on online status check.
+# When a service is in a READY state, and is selected as default,
+# ConnMan will issue an HTTP GET request to verify that end-to-end
+# connectivity is successful. Only then the service will be
+# transitioned to ONLINE state.
+# If this setting is false, the default service will remain in READY state.
+# Default value is true.
+# EnableOnlineCheck = 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
diff --git a/src/service.c b/src/service.c
index 4e97a15..b889879 100644
--- a/src/service.c
+++ b/src/service.c
@@ -5981,13 +5981,14 @@ int __connman_service_ipconfig_indicate_state(struct 
connman_service *service,
        case CONNMAN_SERVICE_STATE_CONFIGURATION:
                break;
        case CONNMAN_SERVICE_STATE_READY:
-               if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
-                       check_proxy_setup(service);
-                       service_rp_filter(service, true);
-               } else {
-                       service->online_check_count = 1;
-                       __connman_wispr_start(service, type);
-               }
+               if (connman_setting_get_bool("EnableOnlineCheck"))
+                       if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
+                               check_proxy_setup(service);
+                               service_rp_filter(service, true);
+                       } else {
+                               service->online_check_count = 1;
+                               __connman_wispr_start(service, type);
+                       }
                break;
        case CONNMAN_SERVICE_STATE_ONLINE:
                break;
-- 
2.7.4



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

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


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

End of connman Digest, Vol 17, Issue 4
**************************************

Reply via email to