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>
(cherry picked from commit d5b4713153ce95e88651d93aa1ef25b2676d0cfc)
| ... | ... |
@@ -430,7 +430,10 @@ configuration. |
| 430 | 430 |
The version of the operating system, e.g. 6.1 for Windows 7. |
| 431 | 431 |
This may be set by the client UI/GUI using ``--setenv``. |
| 432 | 432 |
On Windows systems it is automatically determined by openvpn |
| 433 |
- itself. |
|
| 433 |
+ itself. On other platforms OpenVPN will default to sending |
|
| 434 |
+ the information returned by the `uname()` system call in |
|
| 435 |
+ the `release` field, which is usually the currently running |
|
| 436 |
+ kernel version. This is highly system specific, though. |
|
| 434 | 437 |
|
| 435 | 438 |
:code:`UV_<name>=<value>` |
| 436 | 439 |
Client environment variables whose names start with |
| ... | ... |
@@ -2149,6 +2149,10 @@ push_peer_info(struct buffer *buf, struct tls_session *session) |
| 2149 | 2149 |
buf_printf(&out, "IV_SSL=%s\n", get_ssl_library_version() ); |
| 2150 | 2150 |
#if defined(_WIN32) |
| 2151 | 2151 |
buf_printf(&out, "IV_PLAT_VER=%s\n", win32_version_string(&gc, false)); |
| 2152 |
+#else |
|
| 2153 |
+ struct utsname u; |
|
| 2154 |
+ uname(&u); |
|
| 2155 |
+ buf_printf(&out, "IV_PLAT_VER=%s\n", u.release); |
|
| 2152 | 2156 |
#endif |
| 2153 | 2157 |
} |
| 2154 | 2158 |
|
| ... | ... |
@@ -347,6 +347,10 @@ typedef int MIB_TCP_STATE; |
| 347 | 347 |
#include <sys/mman.h> |
| 348 | 348 |
#endif |
| 349 | 349 |
|
| 350 |
+#ifndef _WIN32 |
|
| 351 |
+#include <sys/utsname.h> |
|
| 352 |
+#endif |
|
| 353 |
+ |
|
| 350 | 354 |
/* |
| 351 | 355 |
* Pedantic mode is meant to accomplish lint-style program checking, |
| 352 | 356 |
* not to build a working executable. |