Skip to contentSkip to conversation

Change in openvpn[master]: Reconnect when TCP is on use on network-change management command

Openvpn-devel In review plaisthos (Code Review) 2 participants 6 messages Feb 12, 2025 – Feb 15, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1739361204000.Id4febcceecab33ee5189cd67b249a15d12b84799@...2715...

#1 lore raw

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/891?usp=email

to review the following change.

Change subject: Reconnect when TCP is on use on network-change management command
......................................................................

Reconnect when TCP is on use on network-change management command

On some newer Android handsets, changing to a different network often does not trigger a TCP reset but continues using the old connection (e.g. using mobile connection when WiFi becomes available)

Force a reconnect in these situation to have a more expected beheaviour.

Change-Id Id4febcceecab33ee5189cd67b249a15d12b84799

---
M src/openvpn/init.c

1 file changed, 9 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/91/891/1

src/openvpn/init.c +9 -0
index a7f7db4..b5eeeb8 100644
@@ -4390,6 +4390,15 @@
         return -1;
     }
 
+    /* On some newer Android handsets, changing to a different network
+     * often does not trigger a TCP reset but continue using the old
+     * connection (e.g. using mobile connection when WiFi becomes available */
+    struct link_socket_info *lsi = get_link_socket_info(c);
+    if (lsi && proto_is_tcp(lsi->proto) && !samenetwork)
+    {
+      	return -2;
+    }
+
     socketfd = c->c2.link_sockets[0]->sd;
     if (!c->options.pull || c->c2.tls_multi->use_peer_id || samenetwork)
     {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/891?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id4febcceecab33ee5189cd67b249a15d12b84799
Gerrit-Change-Number: 891
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/891?usp=email )

Change subject: Reconnect when TCP is on use on network-change management command
......................................................................

Patch Set 1: Code-Review+2

(1 comment)

Patchset:

PS1:
the code has a <tab> where it should have spaces, but I can fix that on apply.

I can't really test the functionality, but it compiles with the new android GHA build :-) and is in a TARGET_ANDROID block so won't affect anything else.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/891?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id4febcceecab33ee5189cd67b249a15d12b84799
Gerrit-Change-Number: 891
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sat, 15 Feb 2025 15:23:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH 1/1 Reconnect when TCP is on use on network-change management command

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

On some newer Android handsets, changing to a different network often does not trigger a TCP reset but continues using the old connection (e.g. using mobile connection when WiFi becomes available)

Force a reconnect in these situation to have a more expected beheaviour.

Change-Id Id4febcceecab33ee5189cd67b249a15d12b84799

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/891
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/init.c +9 -0
index a7f7db4..b5eeeb8 100644
@@ -4390,6 +4390,15 @@
         return -1;
     }
 
+    /* On some newer Android handsets, changing to a different network
+     * often does not trigger a TCP reset but continue using the old
+     * connection (e.g. using mobile connection when WiFi becomes available */
+    struct link_socket_info *lsi = get_link_socket_info(c);
+    if (lsi && proto_is_tcp(lsi->proto) && !samenetwork)
+    {
+        return -2;
+    }
+
     socketfd = c->c2.link_sockets[0]->sd;
     if (!c->options.pull || c->c2.tls_multi->use_peer_id || samenetwork)
     {
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: Reconnect when TCP is on use on network-change management command

Tab-vs-Space fixed on the fly.

Your patch has been applied to the master branch.

commit 43abb412dd211836086e27b55f1bcd77626ad6f2

Author: Arne Schwabe
Date:   Sat Feb 15 16:24:56 2025 +0100
     Reconnect when TCP is on use on network-change management command

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg30908.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/891?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: Reconnect when TCP is on use on network-change management command
......................................................................

Reconnect when TCP is on use on network-change management command

On some newer Android handsets, changing to a different network often does not trigger a TCP reset but continues using the old connection (e.g. using mobile connection when WiFi becomes available)

Force a reconnect in these situation to have a more expected beheaviour.

Change-Id Id4febcceecab33ee5189cd67b249a15d12b84799

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30908.html

---
M src/openvpn/init.c

1 file changed, 9 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/91/891/2

src/openvpn/init.c +9 -0
index da20241..920f8d7 100644
@@ -4412,6 +4412,15 @@
         return -1;
     }
 
+    /* On some newer Android handsets, changing to a different network
+     * often does not trigger a TCP reset but continue using the old
+     * connection (e.g. using mobile connection when WiFi becomes available */
+    struct link_socket_info *lsi = get_link_socket_info(c);
+    if (lsi && proto_is_tcp(lsi->proto) && !samenetwork)
+    {
+        return -2;
+    }
+
     socketfd = c->c2.link_sockets[0]->sd;
     if (!c->options.pull || c->c2.tls_multi->use_peer_id || samenetwork)
     {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/891?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id4febcceecab33ee5189cd67b249a15d12b84799
Gerrit-Change-Number: 891
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/891?usp=email )

Change subject: Reconnect when TCP is on use on network-change management command
......................................................................

Reconnect when TCP is on use on network-change management command

On some newer Android handsets, changing to a different network often does not trigger a TCP reset but continues using the old connection (e.g. using mobile connection when WiFi becomes available)

Force a reconnect in these situation to have a more expected beheaviour.

Change-Id Id4febcceecab33ee5189cd67b249a15d12b84799

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30908.html

---
M src/openvpn/init.c

1 file changed, 9 insertions(+), 0 deletions(-)
src/openvpn/init.c +9 -0
index da20241..920f8d7 100644
@@ -4412,6 +4412,15 @@
         return -1;
     }
 
+    /* On some newer Android handsets, changing to a different network
+     * often does not trigger a TCP reset but continue using the old
+     * connection (e.g. using mobile connection when WiFi becomes available */
+    struct link_socket_info *lsi = get_link_socket_info(c);
+    if (lsi && proto_is_tcp(lsi->proto) && !samenetwork)
+    {
+        return -2;
+    }
+
     socketfd = c->c2.link_sockets[0]->sd;
     if (!c->options.pull || c->c2.tls_multi->use_peer_id || samenetwork)
     {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/891?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id4febcceecab33ee5189cd67b249a15d12b84799
Gerrit-Change-Number: 891
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged