Skip to content

Commit

Permalink
send uname() release as IV_PLAT_VER= on non-windows versions
Browse files Browse the repository at this point in the history
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: #637

Change-Id: Id2b0c5a517f02e5c219fea2ae3ef2bdef7690169
Signed-off-by: Gert Doering <[email protected]>
Acked-by: Antonio Quartulli <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg29699.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
cron2 committed Nov 5, 2024
1 parent dee0748 commit d5b4713
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion doc/man-sections/client-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/openvpn/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 4 additions & 0 deletions src/openvpn/syshead.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d5b4713

Please sign in to comment.