Skip to content

Commit 43abb41

Browse files
schwabecron2
authored andcommitted
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 Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20250215152456.5691-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30908.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
1 parent 6248e0a commit 43abb41

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/openvpn/init.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4412,6 +4412,15 @@ management_callback_network_change(void *arg, bool samenetwork)
44124412
return -1;
44134413
}
44144414

4415+
/* On some newer Android handsets, changing to a different network
4416+
* often does not trigger a TCP reset but continue using the old
4417+
* connection (e.g. using mobile connection when WiFi becomes available */
4418+
struct link_socket_info *lsi = get_link_socket_info(c);
4419+
if (lsi && proto_is_tcp(lsi->proto) && !samenetwork)
4420+
{
4421+
return -2;
4422+
}
4423+
44154424
socketfd = c->c2.link_sockets[0]->sd;
44164425
if (!c->options.pull || c->c2.tls_multi->use_peer_id || samenetwork)
44174426
{

0 commit comments

Comments
 (0)