From patchwork Mon Nov 4 08:58:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 3922 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:3a0b:b0:5b9:581e:f939 with SMTP id v11csp1883318man; Mon, 4 Nov 2024 00:58:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUGqPQyNJF694j7E3HUoQr+1lIIBPu4x8cOls9wgplNT+fTUWeroxvLy5uWMZ7DZFJwxccvxgOrzcA=@openvpn.net X-Google-Smtp-Source: AGHT+IGhLdVKIRBgdNaLrLWvo1CyOo5ToaPNI4JJp7i2BTO3OPJrY6Kq9ugyKKBzL5H3GJBdDF0R X-Received: by 2002:a05:6602:140b:b0:83b:2c8e:ba with SMTP id ca18e2360f4ac-83b71a17503mr906063639f.14.1730710715340; Mon, 04 Nov 2024 00:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730710715; cv=none; d=google.com; s=arc-20240605; b=E9maYvyIHa0mN94qXy4ZO6fEr2Ql1oo0KKZSn2q/6qFFB+af5Bv3x4GoctRjkJeqHB B9ZzV0SINcK2HC+0CZ/FhL5tqYBsnWyGMHoPc1qDkMjqH8P2bFYg8RKS4HolK7GqfdaL Z74I8js7wVC2qo9wuW/OSZQMCNrXkXFrG1jaBNLfTDnHCzXM4b79sqIWe2GI31zzLJ3p T5Js35i2umN9kmXIGsrhoNqKF/x5YAwAIcLlNJHb/tnPFYfECobLh5TsH/K6RRdT7As0 HyKRJKzvMh5DNu615vGzocqachPyF/wOz3aj0l+6gPtBmiDo4bO4cU2jXPCDG0EP6inT 0UGA== 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=zBA+qiQYcMjAzJNXa3PNUq4wEjRhkrpTFNul4HJCb0Q=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=UNzv6KeoRi2EU7vMDFZdNSLzpOn/4F4g3XD2v6IVXff0v3QBknimllte4mlZCadszN MPqQ1V6szAUdy4NlUCORdEOLX7YF/UdxYRtEIqTdejj3g8cUS9AkJvqK1/7yAVGv4cg6 SK2tb5K2vLsyhrVFEmMNYGan59yVGqKEHp/8OhtaX1/rXTRv5gLkvUimHziqmDqt59Jg 3U6RhnbE9+gxN9I2pwJRrCDgmLj1poFudRo6PwcdPWR+waz93UBaFvEukpi5j5ag9lBl dnv5d0hRlSHM0JGh5N9zIQJurMu7NUS0avFZq3Bt3hmBzOO5ZDGEaIsr5fcVF6IJ2nd0 lU+g==; 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=F2eVL8Qq; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="ULIpYG/C"; 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 8926c6da1cb9f-4de0496ba8dsi4488192173.115.2024.11.04.00.58.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Nov 2024 00:58:35 -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=F2eVL8Qq; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="ULIpYG/C"; 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-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1t7sun-0003TW-8U; Mon, 04 Nov 2024 08:58:25 +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 1t7sul-0003TO-FJ for openvpn-devel@lists.sourceforge.net; Mon, 04 Nov 2024 08:58:23 +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=42PrtNxCDGAj5MZ2qZHtBZfWTZdNWuAYxnG3m6ZLCHQ=; b=F2eVL8QqksFSpBQfAEBDQW0Gi7 F+9+VF1OVHKcdNRkj+q+EjULwUanLTyHS9RpgZe6ilp0Zo64ECetMe49ECozj+8KsaShipaQS+0Nz 7SeAtJnWO1oGleEx339e1pTFmdw/ET/q7qGqr4jCCJZeOQRQ/o+wfJx4kS4e3wb8GI3E=; 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=42PrtNxCDGAj5MZ2qZHtBZfWTZdNWuAYxnG3m6ZLCHQ=; b=ULIpYG/CKZwPxkYjSx4mAJZFGQ wGnkLx4Bp1qahJAhscvw95IJ1e3Ep4TJ+2Y2gnHG/ebOVPvilLlJ5ncOAnPfSUA7t68LKCM8a410d HDWFc0jUOczQIoolu7Gzlk8CRoqcReeHslWomPZnf8NwiLTkxxRbEJ9wWAdFpK0NSESU=; 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 1t7suj-0007gr-3T for openvpn-devel@lists.sourceforge.net; Mon, 04 Nov 2024 08:58:23 +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 4A48w93G017090 for ; Mon, 4 Nov 2024 09:58:09 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 4A48w9I0017089 for openvpn-devel@lists.sourceforge.net; Mon, 4 Nov 2024 09:58:09 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 4 Nov 2024 09:58:08 +0100 Message-ID: <20241104085808.17039-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-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: This is highly system specific, as the content of the uname() structure elements is not specified very well - uname(3) says: release Release level of the operating system which translates to "IV_PLAT_VER=13.3-RELEASE-p6" (FreeBSD) or "IV_PLAT_VER=22.6.0" (macOS) - the latter being the "Mach Kernel version", not what Apple calls the OS. Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1t7suj-0007gr-3T Subject: [Openvpn-devel] [PATCH v4] send uname() release as IV_PLAT_VER= on non-windows versions 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?1814781718934157262?= X-GMAIL-MSGID: =?utf-8?q?1814781718934157262?= This is highly system specific, as the content of the uname() structure elements is not specified very well - uname(3) says: release Release level of the operating system which translates to "IV_PLAT_VER=13.3-RELEASE-p6" (FreeBSD) or "IV_PLAT_VER=22.6.0" (macOS) - the latter being the "Mach Kernel version", not what Apple calls the OS. It's still useful if a server operator needs to keep track of client versions (and the GUI does not set the corresponding environment variable, which neither Tunnelblick nor NM do). v2: manpage amendments v3: whitespace v4: reword manpage Github: OpenVPN/openvpn#637 Change-Id: Id2b0c5a517f02e5c219fea2ae3ef2bdef7690169 Signed-off-by: Gert Doering Acked-by: Antonio Quartulli --- 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/+/793 This mail reflects revision 4 of this Change. Acked-by according to Gerrit (reflected above): Antonio Quartulli diff --git a/doc/man-sections/client-options.rst b/doc/man-sections/client-options.rst index a06948e..5ca85e0 100644 --- a/doc/man-sections/client-options.rst +++ b/doc/man-sections/client-options.rst @@ -430,7 +430,10 @@ The version of the operating system, e.g. 6.1 for Windows 7. This may be set by the client UI/GUI using ``--setenv``. On Windows systems it is automatically determined by openvpn - itself. + itself. On other platforms OpenVPN will default to sending + the information returned by the `uname()` system call in + the `release` field, which is usually the currently running + kernel version. This is highly system specific, though. :code:`UV_=` Client environment variables whose names start with diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 8040e7b..93e31f1 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2010,6 +2010,10 @@ buf_printf(&out, "IV_SSL=%s\n", get_ssl_library_version() ); #if defined(_WIN32) buf_printf(&out, "IV_PLAT_VER=%s\n", win32_version_string(&gc, false)); +#else + struct utsname u; + uname(&u); + buf_printf(&out, "IV_PLAT_VER=%s\n", u.release); #endif } diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index 83a48fc..33a90c1 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -331,6 +331,10 @@ #include #endif +#ifndef _WIN32 +#include +#endif + /* * Pedantic mode is meant to accomplish lint-style program checking, * not to build a working executable.