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. RE: [PATCH 2/3] wispr: Add online check url config options (VAUTRIN Emmanuel (Canal Plus Prestataire)) 2. RE: [PATCH 2/3] wispr: Add online check url config options (VAUTRIN Emmanuel (Canal Plus Prestataire)) ---------------------------------------------------------------------- Date: Thu, 6 May 2021 15:14:52 +0000 From: "VAUTRIN Emmanuel (Canal Plus Prestataire)" <emmanuel.vaut...@cpexterne.org> Subject: RE: [PATCH 2/3] wispr: Add online check url config options To: Daniel Wagner <w...@monom.org> Cc: "connman@lists.01.org" <connman@lists.01.org> Message-ID: <pr1pr02mb479408b2aec8c5701f42ef4f93...@pr1pr02mb4794.eur prd02.prod.outlook.com> Content-Type: text/plain; charset="iso-8859-1" Global config options, which allow to set the urls (IPv4 and IPv6 respectively) used during the online status check. Default values are http://ipv4.connman.net/online/status.html and http://ipv6.connman.net/online/status.html respectively. --- README | 9 +++++++++ doc/connman.conf.5.in | 13 ++++++++----- src/main.c | 33 +++++++++++++++++++++++++++++++++ src/main.conf | 14 +++++++++----- src/wispr.c | 14 +++++++++----- 5 files changed, 68 insertions(+), 15 deletions(-) diff --git a/README b/README index e911bc2d6bbd..652e62196458 100644 --- a/README +++ b/README @@ -408,8 +408,17 @@ from ipv4.connman.net (for IPv4 connectivity) and ipv6.connman.net (for IPv6 connectivity). The used URL looks like this http://ipv{4|6}.connman.net/online/status.html +When an online check request fails, another one is triggered after a +longer interval. The intervals follow the power of two series of numbers +in a specific range, by default [1, 12], corresponding to the following +intervals, in seconds: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121 and 144. + See connman.conf(5) for the EnableOnlineCheck option, if you need to disable the feature. +It is also possible to specify other URLs via OnlineCheckIPv4URL and +OnlineCheckIPv6URL options. +The range of intervals between two online check requests can be fine-tuned +via OnlineCheckInitialInterval and OnlineCheckMaxInterval options. During the online check procedure, ConnMan will temporarily install a host route to both the ipv4.connman.net and ipv6.connman.net so that diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in index 2e06b3ef1f3c..82cceb7298f1 100644 --- a/doc/connman.conf.5.in +++ b/doc/connman.conf.5.in @@ -167,13 +167,16 @@ transitioned to ONLINE state. If this setting is false, the default service will remain in READY state. Default value is true. .TP +.BI OnlineCheckIPv4URL= url, OnlineCheckIPv6URL= url +Urls (IPv4 and IPv6 respectively) used during the online status check. +Please refer to the README for more detailed information. +Default values are http://ipv4.connman.net/online/status.html and +http://ipv6.connman.net/online/status.html respectively. +.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. +Please refer to the README for more detailed information. +Default values are 1 and 12 respectively. .TP .BI EnableOnlineToReadyTransition=true\ \fR|\fB\ false WARNING: Experimental feature!!! diff --git a/src/main.c b/src/main.c index 6480caa62980..407207fd4947 100644 --- a/src/main.c +++ b/src/main.c @@ -44,6 +44,9 @@ #define DEFAULT_INPUT_REQUEST_TIMEOUT (120 * 1000) #define DEFAULT_BROWSER_LAUNCH_TIMEOUT (300 * 1000) +#define DEFAULT_ONLINE_CHECK_IPV4_URL "http://ipv4.connman.net/online/status.html" +#define DEFAULT_ONLINE_CHECK_IPV6_URL "http://ipv6.connman.net/online/status.html" + /* * We set the integer to 1 sec so that we have a chance to get * necessary IPv6 router advertisement messages that might have @@ -97,6 +100,8 @@ static struct { char *vendor_class_id; bool enable_online_check; bool enable_online_to_ready_transition; + char *online_check_ipv4_url; + char *online_check_ipv6_url; unsigned int online_check_initial_interval; unsigned int online_check_max_interval; bool auto_connect_roaming_services; @@ -122,6 +127,8 @@ static struct { .vendor_class_id = NULL, .enable_online_check = true, .enable_online_to_ready_transition = false, + .online_check_ipv4_url = DEFAULT_ONLINE_CHECK_IPV4_URL, + .online_check_ipv6_url = DEFAULT_ONLINE_CHECK_IPV6_URL, .online_check_initial_interval = DEFAULT_ONLINE_CHECK_INITIAL_INTERVAL, .online_check_max_interval = DEFAULT_ONLINE_CHECK_MAX_INTERVAL, .auto_connect_roaming_services = false, @@ -148,6 +155,8 @@ static struct { #define CONF_VENDOR_CLASS_ID "VendorClassID" #define CONF_ENABLE_ONLINE_CHECK "EnableOnlineCheck" #define CONF_ENABLE_ONLINE_TO_READY_TRANSITION "EnableOnlineToReadyTransition" +#define CONF_ONLINE_CHECK_IPV4_URL "OnlineCheckIPv4URL" +#define CONF_ONLINE_CHECK_IPV6_URL "OnlineCheckIPv6URL" #define CONF_ONLINE_CHECK_INITIAL_INTERVAL "OnlineCheckInitialInterval" #define CONF_ONLINE_CHECK_MAX_INTERVAL "OnlineCheckMaxInterval" #define CONF_AUTO_CONNECT_ROAMING_SERVICES "AutoConnectRoamingServices" @@ -174,6 +183,8 @@ static const char *supported_options[] = { CONF_VENDOR_CLASS_ID, CONF_ENABLE_ONLINE_CHECK, CONF_ENABLE_ONLINE_TO_READY_TRANSITION, + CONF_ONLINE_CHECK_IPV4_URL, + CONF_ONLINE_CHECK_IPV6_URL, CONF_ONLINE_CHECK_INITIAL_INTERVAL, CONF_ONLINE_CHECK_MAX_INTERVAL, CONF_AUTO_CONNECT_ROAMING_SERVICES, @@ -486,6 +497,20 @@ static void parse_config(GKeyFile *config) g_clear_error(&error); + string = __connman_config_get_string(config, "General", + CONF_ONLINE_CHECK_IPV4_URL, &error); + if (!error) + connman_settings.online_check_ipv4_url = string; + + g_clear_error(&error); + + string = __connman_config_get_string(config, "General", + CONF_ONLINE_CHECK_IPV6_URL, &error); + if (!error) + connman_settings.online_check_ipv6_url = string; + + g_clear_error(&error); + integer = g_key_file_get_integer(config, "General", CONF_ONLINE_CHECK_INITIAL_INTERVAL, &error); if (!error && integer >= 0) @@ -708,6 +733,12 @@ char *connman_setting_get_string(const char *key) if (g_str_equal(key, CONF_VENDOR_CLASS_ID)) return connman_settings.vendor_class_id; + if (g_str_equal(key, CONF_ONLINE_CHECK_IPV4_URL)) + return connman_settings.online_check_ipv4_url; + + if (g_str_equal(key, CONF_ONLINE_CHECK_IPV6_URL)) + return connman_settings.online_check_ipv6_url; + if (g_strcmp0(key, "wifi") == 0) { if (!option_wifi) return "nl80211,wext"; @@ -989,6 +1020,8 @@ int main(int argc, char *argv[]) g_strfreev(connman_settings.blacklisted_interfaces); g_strfreev(connman_settings.tethering_technologies); g_free(connman_settings.vendor_class_id); + g_free(connman_settings.online_check_ipv4_url); + g_free(connman_settings.online_check_ipv6_url); g_free(option_debug); g_free(option_wifi); diff --git a/src/main.conf b/src/main.conf index df70e178742a..ddd5799610da 100644 --- a/src/main.conf +++ b/src/main.conf @@ -125,12 +125,16 @@ # Default value is true. # EnableOnlineCheck = false +# Urls (IPv4 and IPv6 respectively) used during the online status check. +# Please refer to the README for more detailed information. +# Default values are http://ipv4.connman.net/online/status.html and +# http://ipv6.connman.net/online/status.html respectively. +# OnlineCheckIPv4URL= http://ipv4.connman.net/online/status.html +# OnlineCheckIPv6URL= http://ipv6.connman.net/online/status.html + # 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. +# Please refer to the README for more detailed information. +# Default values are 1 and 12 respectively. # OnlineCheckInitialInterval = 1 # OnlineCheckMaxInterval = 12 diff --git a/src/wispr.c b/src/wispr.c index c63dc8195fde..56007a379327 100644 --- a/src/wispr.c +++ b/src/wispr.c @@ -30,9 +30,6 @@ #include "connman.h" -#define STATUS_URL_IPV4 "http://ipv4.connman.net/online/status.html" -#define STATUS_URL_IPV6 "http://ipv6.connman.net/online/status.html" - struct connman_wispr_message { bool has_error; const char *current_element; @@ -96,6 +93,8 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data); static GHashTable *wispr_portal_list = NULL; +static char *online_check_ipv4_url = NULL; +static char *online_check_ipv6_url = NULL; static bool enable_online_to_ready_transition = false; static void connman_wispr_message_init(struct connman_wispr_message *msg) @@ -910,10 +909,10 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context) if (wp_context->type == CONNMAN_IPCONFIG_TYPE_IPV4) { g_web_set_address_family(wp_context->web, AF_INET); - wp_context->status_url = STATUS_URL_IPV4; + wp_context->status_url = online_check_ipv4_url; } else { g_web_set_address_family(wp_context->web, AF_INET6); - wp_context->status_url = STATUS_URL_IPV6; + wp_context->status_url = online_check_ipv6_url; } for (i = 0; nameservers[i]; i++) @@ -1036,6 +1035,11 @@ int __connman_wispr_init(void) g_direct_equal, NULL, free_connman_wispr_portal); + online_check_ipv4_url = + connman_setting_get_string("OnlineCheckIPv4URL"); + online_check_ipv6_url = + connman_setting_get_string("OnlineCheckIPv6URL"); + enable_online_to_ready_transition = connman_setting_get_bool("EnableOnlineToReadyTransition"); -- 2.25.1 ------------------------------------------------------------------------------------------------------ > Instead adding notes into the conf file, please extend the documentation > on the expected protocol between ConnMan and the web server. There is a > section in the README file. I suggest to move this part into new > document in the doc directory and extend it if necessary. And then here > you just point to the documentation. Alright Daniel, I have followed your advice, and also updated the part concerning the online check interval. On the contrary, as the transition online to ready state is experimental, I have not updated the README with this feature. > And if you are going down the road are you going to share your server > setup? These days I suspect it would be something with kubernetes :) Unfortunately, I have just used another URL with a reverse proxy, redirecting to the default one. We have no resource to manage the server side. Best Regards, Emmanuel ------------------------------ Date: Thu, 6 May 2021 18:09:35 +0000 From: "VAUTRIN Emmanuel (Canal Plus Prestataire)" <emmanuel.vaut...@cpexterne.org> Subject: RE: [PATCH 2/3] wispr: Add online check url config options To: Ryan Smith <ryan.sm...@density.io> Cc: Daniel Wagner <w...@monom.org>, "connman@lists.01.org" <connman@lists.01.org> Message-ID: <pr1pr02mb4794f95e78bafa3c7d5432a693...@pr1pr02mb4794.eur prd02.prod.outlook.com> Content-Type: text/plain; charset="iso-8859-1" Global config options, which allow to set the urls (IPv4 and IPv6 respectively) used during the online status check. Default values are http://ipv4.connman.net/online/status.html and http://ipv6.connman.net/online/status.html respectively. --- README | 9 +++++++++ doc/connman.conf.5.in | 13 ++++++++----- src/main.c | 33 +++++++++++++++++++++++++++++++++ src/main.conf | 14 +++++++++----- src/wispr.c | 14 +++++++++----- 5 files changed, 68 insertions(+), 15 deletions(-) diff --git a/README b/README index e911bc2d6bbd..652e62196458 100644 --- a/README +++ b/README @@ -408,8 +408,17 @@ from ipv4.connman.net (for IPv4 connectivity) and ipv6.connman.net (for IPv6 connectivity). The used URL looks like this http://ipv{4|6}.connman.net/online/status.html +When an online check request fails, another one is triggered after a +longer interval. The intervals follow the square series of numbers +in a specific range, by default [1, 12], corresponding to the following +intervals, in seconds: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121 and 144. + See connman.conf(5) for the EnableOnlineCheck option, if you need to disable the feature. +It is also possible to specify other URLs via OnlineCheckIPv4URL and +OnlineCheckIPv6URL options. +The range of intervals between two online check requests can be fine-tuned +via OnlineCheckInitialInterval and OnlineCheckMaxInterval options. During the online check procedure, ConnMan will temporarily install a host route to both the ipv4.connman.net and ipv6.connman.net so that diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in index 2e06b3ef1f3c..82cceb7298f1 100644 --- a/doc/connman.conf.5.in +++ b/doc/connman.conf.5.in @@ -167,13 +167,16 @@ transitioned to ONLINE state. If this setting is false, the default service will remain in READY state. Default value is true. .TP +.BI OnlineCheckIPv4URL= url, OnlineCheckIPv6URL= url +Urls (IPv4 and IPv6 respectively) used during the online status check. +Please refer to the README for more detailed information. +Default values are http://ipv4.connman.net/online/status.html and +http://ipv6.connman.net/online/status.html respectively. +.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. +Please refer to the README for more detailed information. +Default values are 1 and 12 respectively. .TP .BI EnableOnlineToReadyTransition=true\ \fR|\fB\ false WARNING: Experimental feature!!! diff --git a/src/main.c b/src/main.c index 6480caa62980..407207fd4947 100644 --- a/src/main.c +++ b/src/main.c @@ -44,6 +44,9 @@ #define DEFAULT_INPUT_REQUEST_TIMEOUT (120 * 1000) #define DEFAULT_BROWSER_LAUNCH_TIMEOUT (300 * 1000) +#define DEFAULT_ONLINE_CHECK_IPV4_URL "http://ipv4.connman.net/online/status.html" +#define DEFAULT_ONLINE_CHECK_IPV6_URL "http://ipv6.connman.net/online/status.html" + /* * We set the integer to 1 sec so that we have a chance to get * necessary IPv6 router advertisement messages that might have @@ -97,6 +100,8 @@ static struct { char *vendor_class_id; bool enable_online_check; bool enable_online_to_ready_transition; + char *online_check_ipv4_url; + char *online_check_ipv6_url; unsigned int online_check_initial_interval; unsigned int online_check_max_interval; bool auto_connect_roaming_services; @@ -122,6 +127,8 @@ static struct { .vendor_class_id = NULL, .enable_online_check = true, .enable_online_to_ready_transition = false, + .online_check_ipv4_url = DEFAULT_ONLINE_CHECK_IPV4_URL, + .online_check_ipv6_url = DEFAULT_ONLINE_CHECK_IPV6_URL, .online_check_initial_interval = DEFAULT_ONLINE_CHECK_INITIAL_INTERVAL, .online_check_max_interval = DEFAULT_ONLINE_CHECK_MAX_INTERVAL, .auto_connect_roaming_services = false, @@ -148,6 +155,8 @@ static struct { #define CONF_VENDOR_CLASS_ID "VendorClassID" #define CONF_ENABLE_ONLINE_CHECK "EnableOnlineCheck" #define CONF_ENABLE_ONLINE_TO_READY_TRANSITION "EnableOnlineToReadyTransition" +#define CONF_ONLINE_CHECK_IPV4_URL "OnlineCheckIPv4URL" +#define CONF_ONLINE_CHECK_IPV6_URL "OnlineCheckIPv6URL" #define CONF_ONLINE_CHECK_INITIAL_INTERVAL "OnlineCheckInitialInterval" #define CONF_ONLINE_CHECK_MAX_INTERVAL "OnlineCheckMaxInterval" #define CONF_AUTO_CONNECT_ROAMING_SERVICES "AutoConnectRoamingServices" @@ -174,6 +183,8 @@ static const char *supported_options[] = { CONF_VENDOR_CLASS_ID, CONF_ENABLE_ONLINE_CHECK, CONF_ENABLE_ONLINE_TO_READY_TRANSITION, + CONF_ONLINE_CHECK_IPV4_URL, + CONF_ONLINE_CHECK_IPV6_URL, CONF_ONLINE_CHECK_INITIAL_INTERVAL, CONF_ONLINE_CHECK_MAX_INTERVAL, CONF_AUTO_CONNECT_ROAMING_SERVICES, @@ -486,6 +497,20 @@ static void parse_config(GKeyFile *config) g_clear_error(&error); + string = __connman_config_get_string(config, "General", + CONF_ONLINE_CHECK_IPV4_URL, &error); + if (!error) + connman_settings.online_check_ipv4_url = string; + + g_clear_error(&error); + + string = __connman_config_get_string(config, "General", + CONF_ONLINE_CHECK_IPV6_URL, &error); + if (!error) + connman_settings.online_check_ipv6_url = string; + + g_clear_error(&error); + integer = g_key_file_get_integer(config, "General", CONF_ONLINE_CHECK_INITIAL_INTERVAL, &error); if (!error && integer >= 0) @@ -708,6 +733,12 @@ char *connman_setting_get_string(const char *key) if (g_str_equal(key, CONF_VENDOR_CLASS_ID)) return connman_settings.vendor_class_id; + if (g_str_equal(key, CONF_ONLINE_CHECK_IPV4_URL)) + return connman_settings.online_check_ipv4_url; + + if (g_str_equal(key, CONF_ONLINE_CHECK_IPV6_URL)) + return connman_settings.online_check_ipv6_url; + if (g_strcmp0(key, "wifi") == 0) { if (!option_wifi) return "nl80211,wext"; @@ -989,6 +1020,8 @@ int main(int argc, char *argv[]) g_strfreev(connman_settings.blacklisted_interfaces); g_strfreev(connman_settings.tethering_technologies); g_free(connman_settings.vendor_class_id); + g_free(connman_settings.online_check_ipv4_url); + g_free(connman_settings.online_check_ipv6_url); g_free(option_debug); g_free(option_wifi); diff --git a/src/main.conf b/src/main.conf index df70e178742a..ddd5799610da 100644 --- a/src/main.conf +++ b/src/main.conf @@ -125,12 +125,16 @@ # Default value is true. # EnableOnlineCheck = false +# Urls (IPv4 and IPv6 respectively) used during the online status check. +# Please refer to the README for more detailed information. +# Default values are http://ipv4.connman.net/online/status.html and +# http://ipv6.connman.net/online/status.html respectively. +# OnlineCheckIPv4URL= http://ipv4.connman.net/online/status.html +# OnlineCheckIPv6URL= http://ipv6.connman.net/online/status.html + # 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. +# Please refer to the README for more detailed information. +# Default values are 1 and 12 respectively. # OnlineCheckInitialInterval = 1 # OnlineCheckMaxInterval = 12 diff --git a/src/wispr.c b/src/wispr.c index c63dc8195fde..56007a379327 100644 --- a/src/wispr.c +++ b/src/wispr.c @@ -30,9 +30,6 @@ #include "connman.h" -#define STATUS_URL_IPV4 "http://ipv4.connman.net/online/status.html" -#define STATUS_URL_IPV6 "http://ipv6.connman.net/online/status.html" - struct connman_wispr_message { bool has_error; const char *current_element; @@ -96,6 +93,8 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data); static GHashTable *wispr_portal_list = NULL; +static char *online_check_ipv4_url = NULL; +static char *online_check_ipv6_url = NULL; static bool enable_online_to_ready_transition = false; static void connman_wispr_message_init(struct connman_wispr_message *msg) @@ -910,10 +909,10 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context) if (wp_context->type == CONNMAN_IPCONFIG_TYPE_IPV4) { g_web_set_address_family(wp_context->web, AF_INET); - wp_context->status_url = STATUS_URL_IPV4; + wp_context->status_url = online_check_ipv4_url; } else { g_web_set_address_family(wp_context->web, AF_INET6); - wp_context->status_url = STATUS_URL_IPV6; + wp_context->status_url = online_check_ipv6_url; } for (i = 0; nameservers[i]; i++) @@ -1036,6 +1035,11 @@ int __connman_wispr_init(void) g_direct_equal, NULL, free_connman_wispr_portal); + online_check_ipv4_url = + connman_setting_get_string("OnlineCheckIPv4URL"); + online_check_ipv6_url = + connman_setting_get_string("OnlineCheckIPv6URL"); + enable_online_to_ready_transition = connman_setting_get_bool("EnableOnlineToReadyTransition"); -- 2.25.1 ------------------------------------------------------------------------------------------------------------------ Hi Ryan, > Nice work on improving ConnMan. Thank you, much appreciated. > I've just noticed that the documentation incorrectly states that the backoff > period follows the power of two series. > It seems that this must have been intended to say that it follows the series > of squares, as it is clearly not the power of two series. > Alternatively, maybe the code does follow the power of two series > but the intervals listed in the documentation incorrectly are listed as a > series of squares. > [...] > I know that this wording preexists your changes, but this seems like a good > opportunity to fix it. Yes, it makes sense. It was my mistake on the previous version. Best Regards, Emmanuel ------------------------------ 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 67, Issue 4 **************************************