Skip to contentSkip to conversation

Disable online check for real

PATCH In review Daniel Wagner 2 participants 9 messages Aug 29, 2021 – Aug 30, 2021

lore
Share & tools
lore
#0 lore raw

cover Disable online check for real

Страхиња reported we still do some online checks even though EnableOnlineCheck is set to false. Let's move the __connman_service_wispr_start() code to helper and add a check there.

Cc Страхиња Радић <[email protected]>

Daniel Wagner (2):
service: Move wispr start code into helper
service: Do not trigger wispr start when EnableOnlineCheck is disabled

 src/service.c | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/2 service: Move wispr start code into helper

We want to be able to extend the functionally around the __connman_service_wispr_start() code. Instead having to update the open code part for IPv4 and IPv6 handling, let's move into a small helper.

---
 src/service.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)
src/service.c +15 -16
index a5a5cfde30fd..237c88e15506 100644
@@ -1595,6 +1595,19 @@ bool __connman_service_index_is_default(int index)
 	return __connman_service_get_index(service) == index;
 }
 
+static void start_wispr_when_connected(struct connman_service *service)
+{
+	if (__connman_service_is_connected_state(service,
+			CONNMAN_IPCONFIG_TYPE_IPV4))
+		__connman_service_wispr_start(service,
+					CONNMAN_IPCONFIG_TYPE_IPV4);
+
+	if (__connman_service_is_connected_state(service,
+			CONNMAN_IPCONFIG_TYPE_IPV6))
+		__connman_service_wispr_start(service,
+					CONNMAN_IPCONFIG_TYPE_IPV6);
+}
+
 static void default_changed(void)
 {
 	struct connman_service *service = connman_service_get_default();
@@ -1619,15 +1632,7 @@ static void default_changed(void)
 				connman_setting_get_bool("AllowDomainnameUpdates"))
 			__connman_utsname_set_domainname(service->domainname);
 
-		if (__connman_service_is_connected_state(service,
-						CONNMAN_IPCONFIG_TYPE_IPV4))
-			__connman_service_wispr_start(service,
-						CONNMAN_IPCONFIG_TYPE_IPV4);
-
-		if (__connman_service_is_connected_state(service,
-						CONNMAN_IPCONFIG_TYPE_IPV6))
-			__connman_service_wispr_start(service,
-						CONNMAN_IPCONFIG_TYPE_IPV6);
+		start_wispr_when_connected(service);
 
 		/*
 		 * Connect VPN automatically when new default service
@@ -3726,13 +3731,7 @@ static DBusMessage *set_property(DBusConnection *conn,
 		nameserver_add_all(service, CONNMAN_IPCONFIG_TYPE_ALL);
 		dns_configuration_changed(service);
 
-		if (__connman_service_is_connected_state(service,
-						CONNMAN_IPCONFIG_TYPE_IPV4))
-			__connman_service_wispr_start(service, CONNMAN_IPCONFIG_TYPE_IPV4);
-
-		if (__connman_service_is_connected_state(service,
-						CONNMAN_IPCONFIG_TYPE_IPV6))
-			__connman_service_wispr_start(service, CONNMAN_IPCONFIG_TYPE_IPV6);
+		start_wispr_when_connected(service);
 
 		service_save(service);
 	} else if (g_str_equal(name, "Timeservers.Configuration")) {
Signature · 1 line
2.32.0
#2 lore raw

PATCH 2/2 service: Do not trigger wispr start when EnableOnlineCheck is disabled

In reply to Daniel Wagner

Do not try to use wispr when the user has disabled the online check.

Reported by Страхиња Радић

---
 src/service.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/service.c +6 -0
index 237c88e15506..8097f5373250 100644
@@ -1597,6 +1597,12 @@ bool __connman_service_index_is_default(int index)
 
 static void start_wispr_when_connected(struct connman_service *service)
 {
+	if (!connman_setting_get_bool("EnableOnlineCheck")) {
+		connman_info("Online check disabled. "
+			"Default service remains in READY state.");
+		return;
+	}
+
 	if (__connman_service_is_connected_state(service,
 			CONNMAN_IPCONFIG_TYPE_IPV4))
 		__connman_service_wispr_start(service,
Signature · 1 line
2.32.0
#3 lore raw

Re: [PATCH v1 2/2] service: Do not trigger wispr start when EnableOnlineCheck is disabled

Quoted 1 line · Daniel Wagner

Do not try to use wispr when the user has disabled the online check.

The patch you proposed seems fine to me. The gist is to let the user control if the online check happens or not.

#4 lore raw

Re: [PATCH v1 2/2] service: Do not trigger wispr start when EnableOnlineCheck is disabled

Quoted 5 lines · Страхиња Радић
Quoted 1 line · Daniel Wagner

Do not try to use wispr when the user has disabled the online check.

The patch you proposed seems fine to me. The gist is to let the user control if the online check happens or not.

Could you give them a quick test if they work for you? Thanks!

#5 lore raw

Re: [PATCH v1 2/2] service: Do not trigger wispr start when EnableOnlineCheck is disabled

Quoted 8 lines · Daniel Wagner
Quoted 5 lines · Страхиња Радић
Quoted 1 line · Daniel Wagner

Do not try to use wispr when the user has disabled the online check.

The patch you proposed seems fine to me. The gist is to let the user control if the online check happens or not.

Could you give them a quick test if they work for you? Thanks!

I tested the patch with tcpdump, but unfortunately, it seems the connections are still being made, even with EnableOnlineCheck=false, Enable6to4=false and EnableOnlineToReadyTransition=false in /etc/connman/main.conf.

I first uninstalled and pkilled any existing versions of connman, then ensured I applied both of your patches with git apply, ran make clean && make and make install as root. Then I ran connmand as root and inside connmanctl:

connmanctl> enable wifi
connmanctl> agent on
connmanctl> connect <my_network>
<entered passphrase>

at the same time, I used tcpdump -i wlan0 > log.txt

and in the log I got a number of lines containing ipv4.connman.net.

Then I tried to apply my patch on top of your patches and repeat the process, but got the same result.

#6 lore raw

Re: [PATCH v1 2/2] service: Do not trigger wispr start when EnableOnlineCheck is disabled

Quoted 3 lines · Страхиња Радић

I tested the patch with tcpdump, but unfortunately, it seems the connections are still being made, even with EnableOnlineCheck=false, Enable6to4=false and EnableOnlineToReadyTransition=false in /etc/connman/main.conf.

I found the culprit -- when built from source, default prefix is /usr/local, so connman was looking for main.conf in /usr/local/etc/connman instead of /etc/connman. When I symlinked /etc/connman/main.conf to /usr/local/etc/connman/main.conf and repeated the test, there were no occurrences of ipv4.connman.net in the log. I also repeated the test using only your two patches, without my patch, and got the same result.

Your two patches combined look ok.

#7 lore raw

Re: [PATCH v1 2/2] service: Do not trigger wispr start when EnableOnlineCheck is disabled

Quoted 5 lines · Страхиња Радић
Quoted 3 lines · Страхиња Радић

I tested the patch with tcpdump, but unfortunately, it seems the connections are still being made, even with EnableOnlineCheck=false, Enable6to4=false and EnableOnlineToReadyTransition=false in /etc/connman/main.conf.

Quoted 8 lines

I found the culprit -- when built from source, default prefix is /usr/local, so connman was looking for main.conf in /usr/local/etc/connman instead of /etc/connman. When I symlinked /etc/connman/main.conf to /usr/local/etc/connman/main.conf and repeated the test, there were no occurrences of ipv4.connman.net in the log. I also repeated the test using only your two patches, without my patch, and got the same result.

Your two patches combined look ok.

Perfect! Thanks for the testing. In this case I'll queue them up this evening.

Daniel

#8 lore raw
In reply to Daniel Wagner
Quoted 5 lines · Daniel Wagner

Страхиња reported we still do some online checks even though EnableOnlineCheck is set to false. Let's move the __connman_service_wispr_start() code to helper and add a check there.

Cc Страхиња Радић <[email protected]>

Patches applied.