Message ID | 20230309122332.92490-1-kprovost@netgate.com |
---|---|
State | Accepted |
Headers | show |
Series | [Openvpn-devel] dco: print FreeBSD version | expand |
Acked-by: Gert Doering <gert@greenie.muc.de> Tested on FreeBSD 14 DCO version: FreeBSD 14.0-CURRENT #10 main-n259930-e898a3af97f9: Wed Jan 4 13:33:06 CET 2023 root@fbsd14.ov.greenie.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC and on 12 (nothing, as expected). Learned about $UNAME_v today :-) I have added your s-o-b: line, and fixed one whitespace detail uncrustify was complaining about. Your patch has been applied to the master and release/2.6 branch. commit fe0853d2e72dd3a639a95e420ad7eeed6b49e81b (master) commit 5617f0f01837ffa01b81dfb2c5c7da8ee4c42072 (release/2.6) Author: Kristof Provost Date: Thu Mar 9 13:23:32 2023 +0100 dco: print FreeBSD 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> -- kind regards, Gert Doering
diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index 2b94b2a2..5238ebdd 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -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" @@ -627,7 +629,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
From: Kristof Provost <kp@FreeBSD.org> 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. --- src/openvpn/dco_freebsd.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)