connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <wagi@monom.org>
To: "Страхиња Радић" <contact@strahinja.org>
Cc: connman <connman@lists.linux.dev>
Subject: Re: [PATCH] Respect EnableOnlineCheck globally
Date: Sun, 29 Aug 2021 19:54:11 +0200	[thread overview]
Message-ID: <20210829175411.u7gfenrvleehvp7v@beryllium.lan> (raw)
In-Reply-To: <20210828173427.7ctqrpj2w2ldrkla@prancingpony>

Hi Страхиња,

On Sat, Aug 28, 2021 at 07:34:27PM +0200, Страхиња Радић wrote:
> On 21/08/28 07:16, Страхиња Радић wrote:
> > +	if (connman_setting_get_bool("EnableOnlineCheck")) {
> 
> This should read
> 
> +       if (!connman_setting_get_bool("EnableOnlineCheck")) {
> 
> sorry. I'm sending the modified patch with this email.
> 
> ---
>  src/wispr.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/wispr.c b/src/wispr.c
> index c63dc819..7b52914e 100644
> --- a/src/wispr.c
> +++ b/src/wispr.c
> @@ -916,6 +916,11 @@ static int wispr_portal_detect(struct
> connman_wispr_portal_context *wp_context)
>                 wp_context->status_url = STATUS_URL_IPV6;
>         }
> 
> +       /* Respect EnableOnlineCheck globally */
> +       if (!connman_setting_get_bool("EnableOnlineCheck")) {
> +               wp_context->status_url = "localhost";
> +       }
> +

This looks like the wrong place to break the online check. We should not
start the online check state machine at all. What about something like:

diff --git a/src/service.c b/src/service.c
index eb74a85d6e32..d04933070c61 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1618,15 +1618,18 @@ static void default_changed(void)
 				connman_setting_get_bool("AllowDomainnameUpdates"))
 			__connman_utsname_set_domainname(service->domainname);
 
-		if (__connman_service_is_connected_state(service,
+		if (connman_setting_get_bool("EnableOnlineCheck")) {
+
+			if (__connman_service_is_connected_state(service,
 						CONNMAN_IPCONFIG_TYPE_IPV4))
-			__connman_service_wispr_start(service,
-						CONNMAN_IPCONFIG_TYPE_IPV4);
+				__connman_service_wispr_start(service,
+							CONNMAN_IPCONFIG_TYPE_IPV4);
 
-		if (__connman_service_is_connected_state(service,
+			if (__connman_service_is_connected_state(service,
 						CONNMAN_IPCONFIG_TYPE_IPV6))
-			__connman_service_wispr_start(service,
-						CONNMAN_IPCONFIG_TYPE_IPV6);
+				__connman_service_wispr_start(service,
+							CONNMAN_IPCONFIG_TYPE_IPV6);
+		}
 
 		/*
 		 * Connect VPN automatically when new default service


This was the only place I found where we call
__connman_service_wispr_start() without the EnableOnlineCheck test.

Could you give this patch a spin?

Daniel

  reply	other threads:[~2021-08-29 17:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-28 17:16 [PATCH] Respect EnableOnlineCheck globally Страхиња Радић
2021-08-28 17:34 ` Страхиња Радић
2021-08-29 17:54   ` Daniel Wagner [this message]
2021-08-29 19:32     ` Страхиња Радић
2021-08-29 19:37       ` Daniel Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210829175411.u7gfenrvleehvp7v@beryllium.lan \
    --to=wagi@monom.org \
    --cc=connman@lists.linux.dev \
    --cc=contact@strahinja.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).