]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
send uname() release as IV_PLAT_VER= on non-windows versions
authorGert Doering <gert@greenie.muc.de>
Mon, 4 Nov 2024 08:58:08 +0000 (09:58 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 5 Nov 2024 21:39:04 +0000 (22:39 +0100)
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 <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <a@unstable.cc>
Message-Id: <20241104085808.17039-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29699.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
doc/man-sections/client-options.rst
src/openvpn/ssl.c
src/openvpn/syshead.h

index a06948eea3bc45ae73e6aaf4b882eefd25142ff1..5ca85e0ff385d44ca6011ad36742d4490d7f831b 100644 (file)
@@ -430,7 +430,10 @@ configuration.
         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_<name>=<value>`
         Client environment variables whose names start with
index 8040e7bc1728d21ccdd5a286e0ea2420cab1ccd9..93e31f145fde41af5cd71241df20a6c6edd2470f 100644 (file)
@@ -2010,6 +2010,10 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
             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
         }
 
index 83a48fc7becf78f7e0700a4497b647cca4672968..33a90c1f820fde16157518ae462d90db1d690ca6 100644 (file)
@@ -331,6 +331,10 @@ typedef int MIB_TCP_STATE;
 #include <sys/mman.h>
 #endif
 
+#ifndef _WIN32
+#include <sys/utsname.h>
+#endif
+
 /*
  * Pedantic mode is meant to accomplish lint-style program checking,
  * not to build a working executable.