From patchwork Sun Oct 8 11:27:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 3385 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:b412:b0:f2:62eb:61c1 with SMTP id dj18csp1457151dyb; Sun, 8 Oct 2023 04:28:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmGgc9kN3/tQ0et5g5koY5SqISpD1/mJwLWRfstt3Nrvtnj/0ljdGNA5lKhtFomGyns1U3 X-Received: by 2002:a17:902:ec88:b0:1c0:bf60:ba4f with SMTP id x8-20020a170902ec8800b001c0bf60ba4fmr14266527plg.4.1696764516669; Sun, 08 Oct 2023 04:28:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696764516; cv=none; d=google.com; s=arc-20160816; b=qL3yAawGtTwOz23enjeZcAR8XHfHjjMr7KE0CHyWztqt3utECKIsVaP4K8s4Du3KB9 WytRpF/mR7WnoHnIohr19Aqf2oHNIvHRMy5uwxoaQSj3m6EugUrSbWpQoi5sBnnKncwY LZ3bHTcGiXr0XD3bI6DafSt2pt51eilzvBHEv8Vh9AUEDjuncaj9jwn6O2RZGMtidsq2 60jVjk3lg5p4vuK4F4TXoDQg+NNW6++x770306L44RIUbepXmW7mg/cKGjD/B+KWxHTb i4PWjCtVBlfak4c19LrgMmgdTUh57EjeuHME+Qt0lTugehONtq/BleLO4NoNGxEYFknS eP7g== 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:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=X1q0voniLMni1au/UO6pY9JGS/uuA9fLWwZPwvIUAYI=; fh=bPbV1ffll3/1Je7WaTIWZCP3p+G85pAR4TX4hG88AeA=; b=wc56bfToaOcNgxJi74SDBfZfd2Bqba+z3R6QuBEJZXa2Zcs3thHAhSPg4r3khXk9p9 4FnT04j2wj46iBDVwDuVIQR6GSH1rJebwlRjZYn0nNOtuymj3JowJll0cD8W54VckSIA nu+MjtP3/aS5leXcF/yW8bUk3CvZCGMfznw1iLhcm/nWQgDAOwKKAYwuqaYOACsfMBqa 0K4h6RRfnpGWg6t1FtXiiavPOs5sa72L4m+ahKYPPAx+DHUy5b91iLmMWLRqtVHWJ62k OUabl/tD5paZGrQ7DmgE+NpXMa9Veio8q/dBOW6uniRtdJluLkKhmkjv/bbjpd6v1JQ2 GfAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ODFaPDRI; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=BLc+9QFU; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=jYxWlToO; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id kf8-20020a17090305c800b001c62acfa473si7194373plb.62.2023.10.08.04.28.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Oct 2023 04:28:36 -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=ODFaPDRI; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=BLc+9QFU; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=jYxWlToO; 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 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qpRxI-0003HI-8B; Sun, 08 Oct 2023 11:28:16 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qpRxE-0003H0-Bi for openvpn-devel@lists.sourceforge.net; Sun, 08 Oct 2023 11:28:12 +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: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Rgdmb6q6mHIFri8G9mnl2O+GvINVihF8+hWC3JpptdA=; b=ODFaPDRI+LuXAKebNfmV41hDPk 5gbpWXhblxAudcgEOjzvF4WOmNtbRwHEnXc/JyBWJVSfM6ldwGecJEJF/6LeAsZRBmCcfB0Q2hBJL WKfrRsUICXWpCIPIeFgaZ1rqiTm/0Vp2rC/HhSMYOAeJ0VDEXq/vCWyO6jv6w1d2w0Kw=; 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: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Rgdmb6q6mHIFri8G9mnl2O+GvINVihF8+hWC3JpptdA=; b=BLc+9QFUfdpccFq4cSe1QpdExG 2tSR3e1Cp0Sm8BTOmz1hxx5K2il6FRzAEty9Rqr9QKkBvPpDWRj580m7nTTJmgxutMQak6lJeC2dZ +bAv1DTBbGNqlr5YcRbUEooT6C3JSsGwE0Gg1QOcQC/v9G7hRGKdPk/bSqW3o5O44A04=; Received: from mout-p-201.mailbox.org ([80.241.56.171]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qpRx8-00063V-Ig for openvpn-devel@lists.sourceforge.net; Sun, 08 Oct 2023 11:28:12 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4S3Kf54JPxz9slL; Sun, 8 Oct 2023 13:27:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1696764477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rgdmb6q6mHIFri8G9mnl2O+GvINVihF8+hWC3JpptdA=; b=jYxWlToO8HwID5H9434pJ95OM61bxOvwwBvS6r6MZ0XEaWjaxDkKFCQ+5KYjRIIfr5i7dZ sz7fOuGuGPgl/gXM9jrgK9BIAtmrM7JVwJiJOdTpL0oRqfQiCUnPhMxcZGkP1zVJgrTBAL 12YGjvJTPH9KhXICjKorWlVScc2qsBZZVgbpkgKUZrQdAl6v4QLmYF1a8hbP3vG2n19usP ZO3RUyxlSK+KG7cVlqQ3iCczaf9DB3e23/XQPLcdBqKyZM/c95ag3ZWVlJgsGui9YenxBJ 4RNWlJPO9VNltf5N9u/Zd5mU+wCDuyl03FsXjtKkwYvDZvibtZ+VB+rRvwIAIA== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Sun, 8 Oct 2023 13:27:55 +0200 Message-Id: <20231008112755.23568-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4S3Kf54JPxz9slL X-Spam-Score: -1.9 (-) 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 Print dco-win driver version using the new ioctl. Requires dco-win driver 1.0.0 or newer to work. Change-Id: I1d0d909e7fca3f51b5c848f1a771a989ab040f17 Signed-off-by: Lev Stipakov Acked-by: Arne Schwabe --- Content analysis details: (-1.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.171 listed in list.dnswl.org] -1.0 RCVD_IN_MSPIKE_H5 RBL: Excellent reputation (+5) [80.241.56.171 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.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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_MSPIKE_WL Mailspike good senders X-Headers-End: 1qpRx8-00063V-Ig Subject: [Openvpn-devel] [PATCH] dco-win: get driver 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: , Cc: Lev Stipakov , Arne Schwabe Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1779186549832779028?= X-GMAIL-MSGID: =?utf-8?q?1779186549832779028?= From: Lev Stipakov Print dco-win driver version using the new ioctl. Requires dco-win driver 1.0.0 or newer to work. Change-Id: I1d0d909e7fca3f51b5c848f1a771a989ab040f17 Signed-off-by: Lev Stipakov Acked-by: Arne Schwabe --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to release/2.6. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/367 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe diff --git a/src/openvpn/dco_win.c b/src/openvpn/dco_win.c index 53f1523..a775c82 100644 --- a/src/openvpn/dco_win.c +++ b/src/openvpn/dco_win.c @@ -386,7 +386,32 @@ const char * dco_version_string(struct gc_arena *gc) { - return "v0"; + 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); + + if (h == INVALID_HANDLE_VALUE) + { + return "N/A"; + } + + DWORD bytes_returned = 0; + if (!DeviceIoControl(h, OVPN_IOCTL_GET_VERSION, NULL, 0, + &version, sizeof(version), &bytes_returned, NULL)) + { + CloseHandle(h); + return "N/A"; + } + + CloseHandle(h); + + struct buffer out = alloc_buf_gc(256, gc); + buf_printf(&out, "%ld.%ld.%ld", version.Major, version.Minor, version.Patch); + + return BSTR(&out); } int diff --git a/src/openvpn/ovpn_dco_win.h b/src/openvpn/ovpn_dco_win.h index cbbdf92..ea2a733 100644 --- a/src/openvpn/ovpn_dco_win.h +++ b/src/openvpn/ovpn_dco_win.h @@ -100,6 +100,12 @@ LONG MSS; } OVPN_SET_PEER, * POVPN_SET_PEER; +typedef struct _OVPN_VERSION { + LONG Major; + LONG Minor; + LONG Patch; +} OVPN_VERSION, * POVPN_VERSION; + #define OVPN_IOCTL_NEW_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) #define OVPN_IOCTL_GET_STATS CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) #define OVPN_IOCTL_NEW_KEY CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_ANY_ACCESS) @@ -107,3 +113,4 @@ #define OVPN_IOCTL_SET_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 5, METHOD_BUFFERED, FILE_ANY_ACCESS) #define OVPN_IOCTL_START_VPN CTL_CODE(FILE_DEVICE_UNKNOWN, 6, METHOD_BUFFERED, FILE_ANY_ACCESS) #define OVPN_IOCTL_DEL_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define OVPN_IOCTL_GET_VERSION CTL_CODE(FILE_DEVICE_UNKNOWN, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)