From patchwork Fri Aug 9 12:03:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "plaisthos (Code Review)" X-Patchwork-Id: 3782 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:1d89:b0:5a1:d4fc:4ac6 with SMTP id hp9csp1459299mab; Fri, 9 Aug 2024 05:04:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVlxxT1gcuWArLhuRiV0Bab8n4fLEbMEIIZbzAURRfyXyEyYhk0DpqAzoI4y7n6e65TYWuYRz6s95U=@openvpn.net X-Google-Smtp-Source: AGHT+IE3/tU+IxJp+/9myjJS4z5IHJHPqrwBYFq2u4pIqMTyk6DVlPNB6XLeNVgWWPtij9JuCAE9 X-Received: by 2002:a05:6a20:1589:b0:1c4:f30e:97ff with SMTP id adf61e73a8af0-1c89ff9a387mr965421637.9.1723205056476; Fri, 09 Aug 2024 05:04:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723205056; cv=none; d=google.com; s=arc-20160816; b=TPaFyN+0dVAxXZX8gaCtlI4dzC3iDYJnvJ8T25XSKRdJl6xiwP783ghGhCLh49JlSk B2vCbQP227L3aD6CixBbbp3OzzbmIrgaMoHV8vIomL9XwKtFt+GB7/+wDsUYqDBTheCx BUmjy2gM39kk2jeT3vcXe+FBDuw42R5AE6F92VOn/JsUz7o2ls3M0lZ73bcIN8CD7xbZ dNPL8CngNhkRruB5KVvcSvZE4vJGOYuJiJF6MEaqMYSELYMc5CcjkMCTWNy9q5U8wLfw 1zTUsdeiyK4Vco/diPV6RhpFeQQSAJbx3yUJlNoAm5VhKsyxALDplnFzozpXNncIosvQ WWiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:to:date:from :dkim-signature:dkim-signature:dkim-signature; bh=n+RIQEeNauI1/mUTDZP1FfTZEjPtJbDAUMzOSGEP70o=; fh=U7wEyxtwz2o5+UdevFSA47vNeG9knhWH0KV//QhD5a0=; b=CE6LxYRovLtJS2NR3OL6z7nVS6I8jpYe+VLjEU6uv8qMgmgybRgvcXON6UF8E22hkT 5VmclTsd4lI+xXEkwK/YJABIiHj597jDXVLqudOZrtrhC/tRwCRsJZistTP8B4zPlqjH zOIuF3bJ6DQlYrbWnQGA8AqS202mcnu03CVDpINNa2NvWYVqMp3PBlZL00bpY7PRH50E MmG6+N5RHu/6wLoYE4iVs9N3u1rdbGYtvaZs4RI85IOwMHxHe7Ywp3vuJTBVbgSXeJ/H o0rNWWVmhz2p3cEo46eq85mow2MuLJXxSRhsrWJ4JyBe/tm6WZJFzLaqPDvn3FkEr530 ajEg==; 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=QvrSkbxi; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dBoiqRFV; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=Sb+zBbAe; 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=openvpn.net; dara=fail header.i=@openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 41be03b00d2f7-7c10a398ca5si5521012a12.678.2024.08.09.05.04.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Aug 2024 05:04:16 -0700 (PDT) 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=QvrSkbxi; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dBoiqRFV; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=Sb+zBbAe; 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=openvpn.net; dara=fail header.i=@openvpn.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1scOLQ-0002Ie-OJ; Fri, 09 Aug 2024 12:03:44 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1scOLN-0002IW-VX for openvpn-devel@lists.sourceforge.net; Fri, 09 Aug 2024 12:03:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=7HKFljLbvdFGEe3zu5fT797vNsmkhU772EoCHlw1kWo=; b=QvrSkbxiWE+58gASSq1kcLUit0 r317bUrGO0XzdvSPkSQyBeoqtt3jD51r1Z7U1t1eX7UZ/HD++Qx68bFC/8LkmZSWMgnB7LPBkWunR vIP9z2r71vgTkEcFiVGEa3YUwwQtc37b5zpf12yXtkvQ54R4BH7Q0rIU8lw6rXc8os4g=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=7HKFljLbvdFGEe3zu5fT797vNsmkhU772EoCHlw1kWo=; b=d BoiqRFVZ90SCbqhmjGvMd95tYJbpE3lHezEbAlu6z3wsY00YigHyqcCCh1Oy/rbaW7EmREtHKGvnI ItGRmnrFivl4ADIJsFBdzDOr1tSgisy5D5IdXc+9VGum9t0/vaAkW/4k1RkdFUpBymEfVM/uLoKSz SjP8hdQseNzO7gIM=; Received: from mail-wm1-f43.google.com ([209.85.128.43]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1scOLN-000690-2p for openvpn-devel@lists.sourceforge.net; Fri, 09 Aug 2024 12:03:41 +0000 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-42816ca782dso14592395e9.2 for ; Fri, 09 Aug 2024 05:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1723205009; x=1723809809; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=7HKFljLbvdFGEe3zu5fT797vNsmkhU772EoCHlw1kWo=; b=Sb+zBbAezr0jAS4Q5HJejn24xDzpRDHhIdrmNIX6Ty3DJXkzNX+NbGRpaK9VmGgFii DhH8KjuI++ADmLs3oQ/2FCeKX79+25oczzfnfB2VeXRwtvdSuTvlrerEuf1Q/E5NQvZD JHDHhw6zGIfvaXzujMRtZL5jgi1whzQ4LMAuUhJprNqRJ596VYHGdTsD04uhHuOyiUTq PCxP4dM0EYti97rZoebpGaTbAivWFHC+eJy35/pR8VRxO93ynZTxK1Js6h0Gaj2SqWtp OJs/bgLnqUvgHI5RNIk95mxwKbMHo7KCj7xdY+TtCcvNYg2pRr5tjDbr0xzH3f9G7CpM 6MeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723205009; x=1723809809; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7HKFljLbvdFGEe3zu5fT797vNsmkhU772EoCHlw1kWo=; b=BYqdDvJtPBHv2oF/RyZfG4vToESfTj0tl8WP/6DQw6TgQeGCwyacsxnL1AakNIpM87 iByUaepLeLgDfBkiA1DsGyPUBubVuLBkHH3r21M1BE5gMSuzxPsykc9bBi/zolwyhY/+ i22h4VRAT/OmJXDXlo6Zg2V8i6y4DqYSFZIO9OFg5CE6kK91DLgyullznDKlwv9nS28M 8U7j3BE/v/RO7r429tCcoK44eYb64re8xJX6ME2UpexbtgwqG2YSo8IDi7cSJXqDDi9a vHsCeIS9NnwcHCLu4TNJzquko6pGoU6pzIdDjc8DaGw/LFihSs1BOA6P248IEGCs3rS6 bh5g== X-Gm-Message-State: AOJu0YyA8CM4EEAdX5yRnBt5hNzrBinF6VlHUwxqERkayxSxV+DDSlfR i1VKxmjzEW32rMAkibXGl9d3owpokKZHj3O7haLGWG9RsYfbj9+/lNOYz/R92XC9kchB0QaepKe d X-Received: by 2002:adf:f7d0:0:b0:368:420e:b7a4 with SMTP id ffacd0b85a97d-36d5db791f1mr795201f8f.4.1723205009275; Fri, 09 Aug 2024 05:03:29 -0700 (PDT) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36d2715701fsm5105210f8f.6.2024.08.09.05.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 05:03:28 -0700 (PDT) From: "stipa (Code Review)" X-Google-Original-From: "stipa (Code Review)" X-Gerrit-PatchSet: 1 Date: Fri, 9 Aug 2024 12:03:28 +0000 To: plaisthos , flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: Ieb6f3a9d14d76000c1caf8ee1e959c6d0de832bf X-Gerrit-Change-Number: 723 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: bc85d69454733b56390ceab254a6502239b072cd References: Message-ID: MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -5.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: Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-5.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [209.85.128.43 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: openvpn.net] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.43 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1scOLN-000690-2p Subject: [Openvpn-devel] [S] Change in openvpn[master]: Use a more robust way to get dco-win version 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: , Reply-To: lstipakov@gmail.com, arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1806911464937018528?= X-GMAIL-MSGID: =?utf-8?q?1806911464937018528?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/723?usp=email to review the following change. Change subject: Use a more robust way to get dco-win version ...................................................................... Use a more robust way to get dco-win version The current way doesn't work if the device is already in use. Starting from 1.3.0, dco-win creates a non-exclusive control device \\.\ovpn-dco-ver which can be opened by multiple apps and supports a single IOCTL to get a version number. https://github.com/OpenVPN/ovpn-dco-win/pull/76 This will be expecially handy later when checking which features driver supports. Change-Id: Ieb6f3a9d14d76000c1caf8ee1e959c6d0de832bf Signed-off-by: Lev Stipakov --- M src/openvpn/dco_win.c 1 file changed, 10 insertions(+), 3 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/23/723/1 diff --git a/src/openvpn/dco_win.c b/src/openvpn/dco_win.c index e3ada76..3ec946f 100644 --- a/src/openvpn/dco_win.c +++ b/src/openvpn/dco_win.c @@ -389,9 +389,16 @@ OVPN_VERSION version; ZeroMemory(&version, sizeof(OVPN_VERSION)); - /* try to open device by symbolic name */ - HANDLE h = CreateFile("\\\\.\\ovpn-dco", GENERIC_READ | GENERIC_WRITE, - 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, NULL); + /* first, try a non-exclusive control device, available from 1.3.0 */ + HANDLE h = CreateFile("\\\\.\\ovpn-dco-ver", GENERIC_READ, + 0, NULL, OPEN_EXISTING, 0, NULL); + + if (h == INVALID_HANDLE_VALUE) + { + /* fallback to a "normal" device, this will fail if device is already in use */ + h = CreateFile("\\\\.\\ovpn-dco", GENERIC_READ, + 0, NULL, OPEN_EXISTING, 0, NULL); + } if (h == INVALID_HANDLE_VALUE) {