From patchwork Sat Oct 7 11:30:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "its_Giaan (Code Review)" X-Patchwork-Id: 3376 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:b412:b0:f2:62eb:61c1 with SMTP id dj18csp964207dyb; Sat, 7 Oct 2023 04:30:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNJe+9xkz37OTVUFnjNvfrt0ihG8ZUKeweFa3OmJSUIAOkK8Jk71mYqAb6W5VnoEPGmCux X-Received: by 2002:a17:902:ea07:b0:1c3:a4f2:7cc1 with SMTP id s7-20020a170902ea0700b001c3a4f27cc1mr11851777plg.5.1696678248958; Sat, 07 Oct 2023 04:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696678248; cv=none; d=google.com; s=arc-20160816; b=D/2BO5CY2d+uC7+0BorkRpMKWw+RQpLWrYVJj62Brg8BC54Wdpg38/sXdHAYqTO3Sf E8bALlP/BapUQ/vcewQo0dYj12DFdm0May0E47r20XYEjbNUJDd0lCvWM0OryucJUAMY gj7pTcbXUfosHmChR4a3a1liRIhWK/p66R8uJN06VwtorEHhUOWpl2733k8yc0IHnfAl DChDQwB4jg9LGq/FxeH4HssszRHyHLiUuDwJubyqMbrfkJDL8ir4cnuWjjI62T0E/esg vIJF0Cowrx8s73nraEb1uN6KO7bO8aeeEyHoX/t9Kx5jzqLbiOcooSnW+VgQCOfbDjZy Edew== 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=82QigrToUzCKdVMj81FsgHacmfpjMKmTmxAmsBxK8oQ=; fh=lm0MLPW7DntlrDqRECIiC9JlE1uPxhepE0URYHIf+eE=; b=ce3IFC1OR1JFsRQRyur5bbb5FGdA345VJZBTQ8GdspeWvIt1QCc3y7kZhGYKSe/S7r lh7BP3TdvGInz5h63Ay09Skt3RIKqchF7gGrZtExAMB2VV+9pGD3X+kr88urFpJirRWA VpwZU/iRxbtfuROHL2quRQvqEGq1MimymPFrekClsKd01INEi9y3oD7RMcRc9dAt2rOK Pcym9YS+fR4CbsV+zToga8rB6ndPqONToSFH+LcBRbMCBD4blWPY3Qb+c2OykqvMN82c VCOTfxQeslh+n+a7I5ZCpADMhDTeEyy27YtMWH4hLbPGs3GX7FTsBQzJ9RJi1IQ8yDov 0Blw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=VAJhi+9n; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=kjBUuRYq; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=QxMGbXzR; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id z7-20020a170903018700b001b8a67f1c10si5888501plg.468.2023.10.07.04.30.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Oct 2023 04:30:48 -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=VAJhi+9n; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=kjBUuRYq; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=QxMGbXzR; 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 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 1qp5Vq-0003Wv-Q6; Sat, 07 Oct 2023 11:30:26 +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 1qp5Vp-0003Wk-S7 for openvpn-devel@lists.sourceforge.net; Sat, 07 Oct 2023 11:30:25 +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=394D4sI8kSsZQI10GN5OPI91ibk9gc2zP78dx0YWUGU=; b=VAJhi+9n2v9LLY7oxrPNTohy7e DIS/KNGjVybqSJqsduDOMc9DheOo3SVmT19Nd4U9C4bwludEN2M6S4G/JbTbwpqfdwLuU8Bvl2izo jSMKLLmFl5w95ktr7+TkkG2ZL7ZfbnO5WyVpkRe/DgFbOhbtSBPgDo+gjKfH/OT2Mqko=; 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=394D4sI8kSsZQI10GN5OPI91ibk9gc2zP78dx0YWUGU=; b=k jBUuRYqvNlYJihKekO6G1bSRItYMzdDbfuHSTSPN6DhB4XNGhJglzXW7NZUAzIpaULsKp1oakEAdd JMnaNNCBrsnq/Ph8Cn8YPxD2zm0bBOSsvbtkEHRChXGwUmDT8wvwGEg/wXLo345w+KB5uJMUQDhTo mvp1jrAA4EE/ETRQ=; Received: from mail-wr1-f46.google.com ([209.85.221.46]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1qp5Vn-0003DD-6V for openvpn-devel@lists.sourceforge.net; Sat, 07 Oct 2023 11:30:25 +0000 Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3231df68584so2759736f8f.1 for ; Sat, 07 Oct 2023 04:30:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1696678216; x=1697283016; 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=394D4sI8kSsZQI10GN5OPI91ibk9gc2zP78dx0YWUGU=; b=QxMGbXzREEkR9Z3iNAfgC0fkCAuv+kRNpzMeYKXpfWS0dcSEwZfyr7kjyooIo3ExOy TlWDeb/1GPWBJPRVxyfftRtqXaqWabEFBnxzxTxLdN9TaEdkPM8DwmakBj1aaCERkUGi aKB+0N5DzVbQ/TpBCZmsZ65gKVdy0okgj4FgwmMAng3UlcD/RcZnrfhR41h2mxiT0dpB rSdOjs25BVBesBZ0eObFfcW+uDXkCN3eiNNmhXSjYM03VU/BbMz5tjfDBaHtB1wDokAT Krr4zDEOGD6j2QpoguR3uGVEu2ilE91wJxjgv/y8vmMrpDbrixNr9v7AxRvkejuwTe2s k7RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696678216; x=1697283016; 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=394D4sI8kSsZQI10GN5OPI91ibk9gc2zP78dx0YWUGU=; b=bumTvXArxqS1Pv05hjGS7479y4rUwFzkrxuczxf65RnbmQszJU6fk87UrjNQ7v9BB0 4Ixk9QvOK1szI/uEz+RPN3Z4sp5+V9hupulKzYDLsR9FbGWnGfeM7pIeIpcOJeLEvned xoCrGvx5iJi1cbeMNCs52GiN4fNx/98uOe4pLuyuUIjAbpQVk77jjNftYdbX3raxv717 oDPqJAxF2CMBVne0tPg3iNQ2eTBJupIhiG2E+ua0N1ethqkjfABJln2Sqc56b4RFZwEa rNEZuPhw0b69UwZ668u0aAAz6s5zSJusyNSoWNujtrPltlUKEoJnpBDcvN0bmtYQuEo3 AWSw== X-Gm-Message-State: AOJu0YzxF2XC8qoyyuAhD4gGay1SpDlu97KBEQEl4BgXt1Hq25o/8WwG JnWj2rsLXeZA4mZBnJkF8iuC59PYYZOpADGmEDM= X-Received: by 2002:adf:e491:0:b0:320:b2a:4ea6 with SMTP id i17-20020adfe491000000b003200b2a4ea6mr8875834wrm.9.1696678216677; Sat, 07 Oct 2023 04:30:16 -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 h12-20020a056000000c00b003176aa612b1sm4036942wrx.38.2023.10.07.04.30.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 04:30:16 -0700 (PDT) From: "stipa (Code Review)" X-Google-Original-From: "stipa (Code Review)" X-Gerrit-PatchSet: 1 Date: Sat, 7 Oct 2023 11:30:15 +0000 To: flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: I1d0d909e7fca3f51b5c848f1a771a989ab040f17 X-Gerrit-Change-Number: 367 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: 9aae81327361fccfa869fb3c83cc37816b8ec224 References: Message-ID: <08742e2cb71d65503bd24b8878488e3ae35e8d79-HTML@gerrit.openvpn.net> MIME-Version: 1.0 User-Agent: Gerrit/3.8.2 X-Spam-Score: -0.6 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.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. Hello flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-0.6 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.4 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.46 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.46 listed in list.dnswl.org] 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_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_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.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1qp5Vn-0003DD-6V Subject: [Openvpn-devel] [S] Change in openvpn[release/2.6]: 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: , Reply-To: lstipakov@gmail.com, 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?1779096091204738417?= X-GMAIL-MSGID: =?utf-8?q?1779096091204738417?= X-getmail-filter-classifier: gerrit message type newchange Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/367?usp=email to review the following change. Change subject: dco-win: get driver version ...................................................................... dco-win: get driver version 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 --- M src/openvpn/dco_win.c M src/openvpn/ovpn_dco_win.h 2 files changed, 33 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/67/367/1 diff --git a/src/openvpn/dco_win.c b/src/openvpn/dco_win.c index 53f1523..75daae2 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, "%d.%d.%d", 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)