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 1/3] dhcp: Cleanup of VendorClassID config option (VAUTRIN Emmanuel (Canal Plus Prestataire)) 2. [PATCH 2/3] wispr: Add online check url config options (VAUTRIN Emmanuel (Canal Plus Prestataire)) 3. [PATCH 3/3] wispr: Support of common redirection status codes (VAUTRIN Emmanuel (Canal Plus Prestataire)) ---------------------------------------------------------------------- Date: Wed, 28 Apr 2021 07:38:33 +0000 From: "VAUTRIN Emmanuel (Canal Plus Prestataire)" <emmanuel.vaut...@cpexterne.org> Subject: [PATCH 1/3] dhcp: Cleanup of VendorClassID config option To: "connman@lists.01.org" <connman@lists.01.org> Message-ID: <pr1pr02mb4794d1f3e55b027c28cb87b193...@pr1pr02mb4794.eur prd02.prod.outlook.com> Content-Type: text/plain; charset="iso-8859-1" --- include/setting.h | 1 + src/dhcp.c | 2 +- src/main.c | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/setting.h b/include/setting.h index 8d2c37b7964d..920e6754169b 100644 --- a/include/setting.h +++ b/include/setting.h @@ -30,6 +30,7 @@ extern "C" { bool connman_setting_get_bool(const char *key); unsigned int connman_setting_get_uint(const char *key); +char *connman_setting_get_string(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/dhcp.c b/src/dhcp.c index 42e9f417d960..2d96c439207e 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -616,7 +616,7 @@ static int dhcp_initialize(struct connman_dhcp *dhcp) g_dhcp_client_set_request(dhcp_client, G_DHCP_ROUTER); g_dhcp_client_set_request(dhcp_client, G_DHCP_SUBNET); - vendor_class_id = connman_option_get_string("VendorClassID"); + vendor_class_id = connman_setting_get_string("VendorClassID"); if (vendor_class_id) g_dhcp_client_set_send(dhcp_client, G_DHCP_VENDOR_CLASS_ID, vendor_class_id); diff --git a/src/main.c b/src/main.c index 8bd44ba18027..73ecde418793 100644 --- a/src/main.c +++ b/src/main.c @@ -301,7 +301,7 @@ static void parse_config(GKeyFile *config) char **interfaces; char **str_list; char **tethering; - char *vendor_class_id; + char *string; gsize len; int integer; @@ -461,10 +461,10 @@ static void parse_config(GKeyFile *config) g_clear_error(&error); - vendor_class_id = __connman_config_get_string(config, "General", + string = __connman_config_get_string(config, "General", CONF_VENDOR_CLASS_ID, &error); if (!error) - connman_settings.vendor_class_id = vendor_class_id; + connman_settings.vendor_class_id = string; g_clear_error(&error); @@ -705,9 +705,6 @@ static GOptionEntry options[] = { const char *connman_option_get_string(const char *key) { - if (g_str_equal(key, CONF_VENDOR_CLASS_ID)) - return connman_settings.vendor_class_id; - if (g_strcmp0(key, "wifi") == 0) { if (!option_wifi) return "nl80211,wext"; @@ -767,6 +764,14 @@ unsigned int connman_setting_get_uint(const char *key) return 0; } +char *connman_setting_get_string(const char *key) +{ + if (g_str_equal(key, CONF_VENDOR_CLASS_ID)) + return connman_settings.vendor_class_id; + + return NULL; +} + char **connman_setting_get_string_list(const char *key) { if (g_str_equal(key, CONF_PREF_TIMESERVERS)) @@ -988,6 +993,7 @@ int main(int argc, char *argv[]) g_strfreev(connman_settings.fallback_nameservers); g_strfreev(connman_settings.blacklisted_interfaces); g_strfreev(connman_settings.tethering_technologies); + g_free(connman_settings.vendor_class_id); g_free(option_debug); g_free(option_wifi); -- 2.25.1 ------------------------------ Date: Wed, 28 Apr 2021 07:41:29 +0000 From: "VAUTRIN Emmanuel (Canal Plus Prestataire)" <emmanuel.vaut...@cpexterne.org> Subject: [PATCH 2/3] wispr: Add online check url config options To: "connman@lists.01.org" <connman@lists.01.org> Message-ID: <pr1pr02mb479443c722b4437cd73108de93...@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. WARNING: The server shall respond with 200 status code and X-ConnMan-Status: online header. Default values are http://ipv4.connman.net/online/status.html and http://ipv6.connman.net/online/status.html respectively. --- doc/connman.conf.5.in | 7 +++++++ src/main.c | 33 +++++++++++++++++++++++++++++++++ src/main.conf | 8 ++++++++ src/wispr.c | 14 +++++++++----- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/doc/connman.conf.5.in b/doc/connman.conf.5.in index 2e06b3ef1f3c..499e019f15a6 100644 --- a/doc/connman.conf.5.in +++ b/doc/connman.conf.5.in @@ -167,6 +167,13 @@ 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. +WARNING: The server shall respond with 200 status code and +X-ConnMan-Status: online header. +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 diff --git a/src/main.c b/src/main.c index 73ecde418793..7a210902efda 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) @@ -769,6 +794,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; + return NULL; } @@ -994,6 +1025,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..7e2e556c73f0 100644 --- a/src/main.conf +++ b/src/main.conf @@ -125,6 +125,14 @@ # Default value is true. # EnableOnlineCheck = false +# Urls (IPv4 and IPv6 respectively) used during the online status check. +# WARNING: The server shall respond with 200 status code and +# X-ConnMan-Status: online header. +# 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 diff --git a/src/wispr.c b/src/wispr.c index 27f5dc13f4a2..5530d5548df1 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) @@ -905,10 +904,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++) @@ -1031,6 +1030,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 ------------------------------ Date: Wed, 28 Apr 2021 07:42:09 +0000 From: "VAUTRIN Emmanuel (Canal Plus Prestataire)" <emmanuel.vaut...@cpexterne.org> Subject: [PATCH 3/3] wispr: Support of common redirection status codes To: "connman@lists.01.org" <connman@lists.01.org> Message-ID: <pr1pr02mb4794d134f4fb4951db58e51493...@pr1pr02mb4794.eur prd02.prod.outlook.com> Content-Type: text/plain; charset="iso-8859-1" The portal web result processing shall support common redirection status codes, not only 302. --- src/wispr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wispr.c b/src/wispr.c index 5530d5548df1..ee5ec93137ce 100644 --- a/src/wispr.c +++ b/src/wispr.c @@ -756,7 +756,12 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data) wp_context->redirect_url, wp_context); break; + case 300: + case 301: case 302: + case 303: + case 307: + case 308: if (!g_web_supports_tls() || !g_web_result_get_header(result, "Location", &redirect)) { -- 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 66, Issue 33 ***************************************