Skip to content

Commit

Permalink
Reconnect when TCP is on use on network-change management command
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
schwabe committed Dec 10, 2024
1 parent ee0100b commit ced0dd9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/openvpn/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -4301,6 +4301,14 @@ management_callback_network_change(void *arg, bool samenetwork)
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_socket->sd;
if (!c->options.pull || c->c2.tls_multi->use_peer_id || samenetwork)
{
Expand Down

0 comments on commit ced0dd9

Please sign in to comment.