From patchwork Tue Jan 24 14:23:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 3012 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp2500204dyk; Tue, 24 Jan 2023 06:24:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXvzuV5AJSzUMGgUuU7WwDIKXtP8KAe/UXcs1mg42qCScGDrZmDTB73eXRpz/z8z6ix1oJvc X-Received: by 2002:a62:3896:0:b0:58b:9b4e:5292 with SMTP id f144-20020a623896000000b0058b9b4e5292mr28305289pfa.1.1674570277094; Tue, 24 Jan 2023 06:24:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674570277; cv=none; d=google.com; s=arc-20160816; b=LuUEbNXq3dNQsw4mmSZT7NshoSVmtLcOdEbHLFnV2VMHsQCVtC837UVPKJ8p6ouOMe z8r6ahCKfmylXK82/0ItdK/znU/ib0/O6lDvsmC1wvPg9FEAHd//Ph57OO3tXmUAsgyu pRIrmm3YJYYIPzxDnLgZs9JjCPdaYifD7mTyPHQrvX2cu9DwXNg0e3CNnBlPzN57UYOF BNX3h+XHoo4uQqfzmpIAueX38mm6nM+wjjeh1JVWw311x4O29zq0lJr/vbZbrirbv8ph pOuhPcIBfGnlhu81HIvdYGYMOJ8kJS3by9LCMqMMmw2i++IOSCucc/eR+FqW8QuzY+Vo RicQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:cc:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature :dkim-signature; bh=288g3oRSJr/C4Jxx+C2YasFAJIwGvarIicKgDjBsBzo=; b=FlRXs2G1+KtlJuoL535SFYDU3v1EczYV2s1/Q0ivSC9tb5m9e8dGwJQ6tfbyPTct65 6C4gzm00qMrUpLv3mWY/KFrJSlpUXHgvEbfudO+ZHjeb1nm9ijM5U1BxPoEYQDIYMrbr i3fLukC9OoSvwuB7xH/BhtJY/fao9+Xg5EcGYlZ3KiDawmwF00Xtp1yYUNzlpgTxuZpJ HqsN7lgD2i/0iNtj0pG4N17pBXwo1yABs9/th8v4g0+X5SpN+Zqg/FweK5CJHhIcD/iI njso7QXO7oSq3oJ4Xualvs95aicCo0PXtvAlR+tRG65vaCOnKjXoXWV81hSSrLIE9LkS CM1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BLqFLqUq; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=meZwRXXX; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=C0NQ0e6X; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 11-20020aa7910b000000b0058d9e2be188si2349771pfh.271.2023.01.24.06.24.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2023 06:24:37 -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=BLqFLqUq; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=meZwRXXX; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=C0NQ0e6X; 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=QUARANTINE dis=NONE) header.from=gmail.com 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 1pKKD9-0006jS-DN; Tue, 24 Jan 2023 14:23:42 +0000 Received: from [172.30.20.202] (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 1pKKD8-0006jG-C6 for openvpn-devel@lists.sourceforge.net; Tue, 24 Jan 2023 14:23:41 +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:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GKicGVbZrF1wSVQGpNzvEMYcf7/5GMr4qpsp5fX8OV0=; b=BLqFLqUq3Ktl7egvzoe10JuEYs qir5pCwJ260iP+MFYXo5E4LmceME6pcFSodPIBnlPycWqO3ReeqRfAj7DrEZwAJU73TBu2ICSlQx/ CjHLhHr2UJlO1aOuGE0AbQ8TmHtWqlXMP2QHtottxFKJ9huC3aNlUBXbM4xap9x4O1CI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=GKicGVbZrF1wSVQGpNzvEMYcf7/5GMr4qpsp5fX8OV0=; b=m eZwRXXXsGmyyKawBbDQSPOOFi1trHNCQs4kgg5Tz4SJHGH0w2J73IU2131mA7Aseo20tAZ1KBM3T8 DncbytzdLNePtIRq2NkEIvbrDaFjA9rGsfUeLMM02HDyv7h2BmDgtapot1ki5G98MerLsavEu9TlF 0fm66ZjZsglQ+Bb8=; Received: from mail-il1-f181.google.com ([209.85.166.181]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1pKKD5-0002MR-DN for openvpn-devel@lists.sourceforge.net; Tue, 24 Jan 2023 14:23:41 +0000 Received: by mail-il1-f181.google.com with SMTP id r19so7094460ilt.7 for ; Tue, 24 Jan 2023 06:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=GKicGVbZrF1wSVQGpNzvEMYcf7/5GMr4qpsp5fX8OV0=; b=C0NQ0e6XowwWwU53hmrTNV1q9cCo+Z0ClOHFyFb/lDZhRSFtKTNIWvWhp5WA3rZqWl D7WKbhq4Vgy8dlZQvMOK7+GRYEcwZKdVkFGAP0UzMXlI5p+TzqU/dLNvzG2hw6yXNh2C ZsTUHztB0OIB2xpykea66Rm+37ZRpod6MKGrZYu6rwYNfVWV13jLZEOF03oStSH7YfiB MkAWy1qVWBr9HQcvIiKid++LnK2PfslV0J9EYtaQMr3Y5qtcbZ3BWKQ6xwXWqchrgeyf BsFMd5lRWiEzMwj6m4/YRq+NHGpfd7UXAK+0EHYjHZKxqMBY82jHr+UUYZMrextyDlkA m9vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GKicGVbZrF1wSVQGpNzvEMYcf7/5GMr4qpsp5fX8OV0=; b=RQNf9AhnlUIlakpYxBCAhGNZdmqjd8v5vJIMJDnKewJTxnCoN33LDHwBsR2nK/tup4 fPcR9OE7IkrPNFpQQFCWikj4r3u9QyIn5j6YsTveySV+WiGHlfSgyE4zGg25qIgc5sfr yB2EedLPOBn/nHVGJmvfHH4zf8P4qJ09cTDxAVCsvOVGE1xKlUTHrBjsWWgkOWRMnYgF 2xam3Ci5TCEXAdhBSyIxl1IvoyRdox38y7XU7yjiaJTwCFRfg4y0bJfY8u3JJ22zS+DI MZ++oLDrWeUYp2h0plYtO6Hxv+R+DV2UFiDESjdNOurBXhVacGBwvEkHlbuO8P+7lskb tp/A== X-Gm-Message-State: AFqh2kocFCFNAmRAQu4g/Q41WoSf/XLy+Q0Jgsw6AX78v3OiW5n6M2l5 pGWgZYM8lL+TOnxh+2GcG38jVhugJ0g= X-Received: by 2002:a05:6e02:12e8:b0:30e:f006:365 with SMTP id l8-20020a056e0212e800b0030ef0060365mr24101931iln.24.1674570213497; Tue, 24 Jan 2023 06:23:33 -0800 (PST) Received: from localhost.localdomain ([2a00:1d50:3:0:f0be:f312:4738:ca9a]) by smtp.gmail.com with ESMTPSA id r6-20020a92c5a6000000b0030c68d38255sm710153ilt.38.2023.01.24.06.23.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 06:23:32 -0800 (PST) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Tue, 24 Jan 2023 16:23:16 +0200 Message-Id: <20230124142316.441-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.38.1.windows.1 MIME-Version: 1.0 X-Spam-Score: -0.2 (/) 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: Lev Stipakov Custom action "FindSystemInfo" finds adapters with certain hwid and assigns found adapters' guids to a certain property. Later another custom action "EvaluateTUNTAPAdapters" schedules adapter creation [...] Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [lstipakov[at]gmail.com] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.181 listed in wl.mailspike.net] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.166.181 listed in list.dnswl.org] X-Headers-End: 1pKKD5-0002MR-DN Subject: [Openvpn-devel] [PATCH] openvpnmsica: fix adapters discovery logic for DCO 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: , Cc: Lev Stipakov Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1755914202852285684?= X-GMAIL-MSGID: =?utf-8?q?1755914202852285684?= From: Lev Stipakov Custom action "FindSystemInfo" finds adapters with certain hwid and assigns found adapters' guids to a certain property. Later another custom action "EvaluateTUNTAPAdapters" schedules adapter creation if the abovementioned property is not set - which means no adapters exist with given hwid. I think this logic is needed to prevent duplicate adapter creation if adapter was renamed and then new version is installed. As one can see, there is a typo in property name ("OVPNDCOAPTERS"). As a result of this typo, installer will always try to create DCO adapter no matter if there are existing adapters. It however won't do anything if adapter with the name "OpenVPN Data Channel Offload" already exists, this is handled in schedule_adapter_create() function. Because of that typo, following scenario works fine: 1) Upcoming release of OpenVPN Connect is installed, which creates adapter named "OpenVPN Connect DCO Adapter" 2) OpenVPN-GUI is installed. Because of typo, it ignores adapter created by Connect and creates own "OpenVPN Data Channel Offload" adapter 3) OpenVPN Connect is uninstalled and it removes "OpenVPN Connect DCO Adapter". 4) OpenVPN-GUI still has its "OpenVPN Data Channel Offload" adapter If we just fix a typo, OpenVPN-GUI won't create a adapter on step 2 and after Connect removal on step 3 there won't be DCO adapters anymore for OpenVPN-GUI to use. The ultimate solution to this would be moving adapter creation to MSM, a shared component which adds/removes the DCO driver. However this change is not trivial and requires a lot of work. For the time being we apply this band-aid by excluding Connect-created adapters from enumerations in "FindSystemInfo" custom action. This makes sure that OpenVPN-GUI won't rely on adapter created by Connnect (which is deleted on Connect uninstall) and ensures that additional DCO adapters won't be created on upgrade if user decides to rename adapter. Signed-off-by: Lev Stipakov --- src/openvpnmsica/openvpnmsica.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/openvpnmsica/openvpnmsica.c b/src/openvpnmsica/openvpnmsica.c index af12b2c4..06c9789d 100644 --- a/src/openvpnmsica/openvpnmsica.c +++ b/src/openvpnmsica/openvpnmsica.c @@ -65,6 +65,8 @@ #define FILE_NEED_REBOOT L".ovpn_need_reboot" +#define OPENVPN_CONNECT_ADAPTER_SUBSTR L"OpenVPN Connect" + /** * Joins an argument sequence and sets it to the MSI property. * @@ -224,6 +226,13 @@ find_adapters( for (struct tap_adapter_node *pAdapter = pAdapterList; pAdapter; pAdapter = pAdapter->pNext) { + /* exclude adapters created by OpenVPN Connect, since they're removed on Connect uninstallation */ + if (_tcsstr(pAdapter->szName, OPENVPN_CONNECT_ADAPTER_SUBSTR)) + { + msg(M_WARN, "%s: skip OpenVPN Connect adapter '%ls'", __FUNCTION__, pAdapter->szName); + continue; + } + /* Convert adapter GUID to UTF-16 string. (LPOLESTR defaults to LPWSTR) */ LPOLESTR szAdapterId = NULL; StringFromIID((REFIID)&pAdapter->guid, &szAdapterId); @@ -316,7 +325,7 @@ FindSystemInfo(_In_ MSIHANDLE hInstall) find_adapters( hInstall, TEXT("ovpn-dco") TEXT("\0"), - TEXT("OVPNDCOAPTERS"), + TEXT("OVPNDCOADAPTERS"), TEXT("ACTIVEOVPNDCOADAPTERS")); if (bIsCoInitialized)