From patchwork Sat Feb 15 15:24:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4146 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:9b51:b0:5e7:b9eb:58e8 with SMTP id b17csp843993max; Sat, 15 Feb 2025 07:25:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXs2IE88bvqCI8dQ8Cn9HUoReRN2saD65EUfJ8ODX4YWpgJlGen2WeRZzWTK9qyNNIndfbjEhsOdco=@openvpn.net X-Google-Smtp-Source: AGHT+IHHITC8ZVAcL9bjQjP+NWsbDsgGlN+LFayOyo3eMxQliAICpf7nUSE5XgYc20w2wDlSc/yu X-Received: by 2002:a05:6808:2016:b0:3f3:dabe:e3f4 with SMTP id 5614622812f47-3f3eb15aae7mr2154877b6e.33.1739633118437; Sat, 15 Feb 2025 07:25:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1739633118; cv=none; d=google.com; s=arc-20240605; b=iHC4dYLQI+wf4LxckpCGtieoS3VqoUs+mJBusUZ8Ji0sRtNk7K1nd64z1f7PHFuWnf mArpw5eZPqAws3kDm22VYr2AnRyN8Oo2wJEzTw8Kl/QTY3an37gkl8pj4C6UcuKDoStH 5VqEWA6RnR3eK/u2OizqN8TtG9kerBDMVP5GPyLHp2arOrb2OkX9BwAgYcRd3+ZR9apO lKujCMpA4/3Kd68sGrAPYfiOtKCne0DRKldVJIS8yCJT5pes2xGXJY9DgBqcudLnyfUu 7ZrP5vHLSeSKkNe+5PcnUxG91Fan+axcs/i0F3quImG+u+r7zA0O8ivJOr32Yr1iXZc9 84pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=OvAFfS6ADV0MV8cDQCmlkhh0VgWUYaCOcferIan81tU=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=gawWH6hxm0KXvqwIQXVR+P3Mou+lO+76L+twV8MKv+TCZPzaDc/AR81CpENeem5/UQ EbFKC26rKNwr8cinjNeWXmy/tXKl94xpP9+sxQLs7TDjUu6lijRhi3tRYiXw9sF826+e U7sQj3gdpFR0kCH4EDjwaKb6Dg6lzQReopsVeRt6OxKSn7OCQ+eyBwXCqdxvnnAtqODT JIK5aXMS/3RCc3495oJG5foF8hu/J9SPLm0+n8Qe1oQ0zsxGt7mbzY49JNA+ilvVkRln tyr3b5QElMGGripf4JGPBREPxMPmfFuQhL/Gc92iQ2c7lUsEv+Sfmhn57t6u1MiKfalT yzng==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=di+4k56j; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=c7x2UaZ5; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5614622812f47-3f3da9f4bc7si4767980b6e.140.2025.02.15.07.25.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Feb 2025 07:25:17 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=di+4k56j; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=c7x2UaZ5; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tjK2a-0004zo-Ux; Sat, 15 Feb 2025 15:25:13 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tjK2Y-0004zh-O4 for openvpn-devel@lists.sourceforge.net; Sat, 15 Feb 2025 15:25:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=k09Q0uRkofaWOSVcxn3zEz7iCeqEN3LFGLKafj15g/Q=; b=di+4k56joPMqDRMUEdRdE0weyh WbeNgWQddHlycuHBS8smEDPVdNpHZ82huaO/iBriZ9bPzOMnJ/Nrt3gcMpjWyP4LmJRDOfnnt2MhB yRVg9YXefxl6RrFEUm3IBgAiqDxOKpZqldUmwQzKc/o0KZYEP57YOhUAhQXBxv019iRY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=k09Q0uRkofaWOSVcxn3zEz7iCeqEN3LFGLKafj15g/Q=; b=c7x2UaZ5jHbC0iIkwrF8IiNLjJ +b+IZnwnDjN4xelRYCSNT/dzgAIqBhMGS28ycjzqN+EpWaMLP7mCo0mc7onqXhPXFFJxDZA/2MZEv mrjE6cRiMtWqkgzqqE3qujEmQjjrEd1+74xsmzg8Vr4ESbZ8llZbyzeS395PaD4bq3pY=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tjK2X-0004C0-Ij for openvpn-devel@lists.sourceforge.net; Sat, 15 Feb 2025 15:25:11 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 51FFOvss005744 for ; Sat, 15 Feb 2025 16:24:57 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 51FFOvhU005743 for openvpn-devel@lists.sourceforge.net; Sat, 15 Feb 2025 16:24:57 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Sat, 15 Feb 2025 16:24:56 +0100 Message-ID: <20250215152456.5691-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Arne Schwabe 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) Content analysis details: (0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in sa-trusted.bondedsender.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Headers-End: 1tjK2X-0004C0-Ij Subject: [Openvpn-devel] [PATCH v1] Reconnect when TCP is on use on network-change management command X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1824137536835721345?= X-GMAIL-MSGID: =?utf-8?q?1824137536835721345?= From: Arne Schwabe 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 Acked-by: Gert Doering --- 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 diff --git a/src/openvpn/init.c b/src/openvpn/init.c index a7f7db4..b5eeeb8 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -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) {