]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
dco: print FreeBSD version
authorKristof Provost <kp@FreeBSD.org>
Thu, 9 Mar 2023 12:23:32 +0000 (13:23 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 13 Mar 2023 16:41:18 +0000 (17:41 +0100)
Implement dco_version_string() for FreeBSD.

Unlike Linux and Windows the DCO driver is built into the operating
system itself, so we log the OS version as a proxy for the DCO version.

Signed-off-by: Kristof Provost <kp@FreeBSD.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20230309122332.92490-1-kprovost@netgate.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26367.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/dco_freebsd.c

index cbd2ce205805a88c683b10d3deb33caa1f3b1cfd..ecca2a0764844b37bdf63dc941708cdbce9042b7 100644 (file)
@@ -31,6 +31,8 @@
 #include <sys/param.h>
 #include <sys/linker.h>
 #include <sys/nv.h>
+#include <sys/utsname.h>
+
 #include <netinet/in.h>
 
 #include "dco_freebsd.h"
@@ -617,7 +619,15 @@ out:
 const char *
 dco_version_string(struct gc_arena *gc)
 {
-    return "v0";
+    struct utsname *uts;
+    ALLOC_OBJ_GC(uts, struct utsname, gc);
+
+    if (uname(uts) != 0)
+    {
+        return "N/A";
+    }
+
+    return uts->version;
 }
 
 void