diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in index c113ac3c1..9c999107e 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 651b3e2a4..3e6449a35 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,16 @@ 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; + if (!boolean) + connman_info("Online check disabled by main config."); + } + + g_clear_error(&error); } static int config_init(const char *file) @@ -589,6 +603,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 d61941302..68870b281 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 4e97a1594..0d08b5c40 100644 --- a/src/service.c +++ b/src/service.c @@ -5981,13 +5981,17 @@ 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); + } + else + connman_info("Online check disabled. " + "Default service remains in READY state."); break; case CONNMAN_SERVICE_STATE_ONLINE: break;