git: 03b8ed145c00 - 2025Q3 - security/openvpn: assert()->ASSERT() cleanup
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 16 Sep 2025 15:10:21 UTC
The branch 2025Q3 has been updated by mandree:
URL: https://cgit.FreeBSD.org/ports/commit/?id=03b8ed145c00f7c404b490b62b1a66a1a4acb43a
commit 03b8ed145c00f7c404b490b62b1a66a1a4acb43a
Author: Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2025-09-07 14:59:33 +0000
Commit: Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2025-09-16 14:40:55 +0000
security/openvpn: assert()->ASSERT() cleanup
This reverts my prior assert -> if...return(false) change
to Ralf Lici's backport, and replaces all assert() by ASSERT().
Gert Doering writes:
| OpenVPN's ASSERT() macro will do a bit more than the standard-libc
| assert() call, namely print out which function and what expression
| failed, before calling _exit(1). Also, it can not be accidentially
| compiled-away (-DNDEBUG).
|
| Use of ASSERT() generally only advised in cases of "this must not happen,
| but if it does, it's a programming or state corruption error that we
| must know about". Use of assert() is lacking the extra debug info, and as
| such, not advised at all.
This is a backport of OpenVPN master changes...
Obtained from: Gert Doering <gert@greenie.muc.de>
Obtained from: <https://gerrit.openvpn.net/c/openvpn/+/1171>
PR: 289303
MFH: 2025Q3 (suggestion after 10 days)
(cherry picked from commit d92d41ca1ae2cd5005a5b774e64b38ca2f6915c7)
---
security/openvpn/Makefile | 2 +-
.../openvpn/files/patch-src_openvpn_dco__freebsd.c | 14 ++++----------
security/openvpn/files/patch-src_openvpn_init.c | 22 ++++++++++++++++++++++
3 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/security/openvpn/Makefile b/security/openvpn/Makefile
index 44f30253b5b2..690ac26738d8 100644
--- a/security/openvpn/Makefile
+++ b/security/openvpn/Makefile
@@ -1,6 +1,6 @@
PORTNAME= openvpn
DISTVERSION= 2.6.14
-PORTREVISION?= 2
+PORTREVISION?= 3
CATEGORIES= security net net-vpn
MASTER_SITES= https://swupdate.openvpn.org/community/releases/ \
https://build.openvpn.net/downloads/releases/ \
diff --git a/security/openvpn/files/patch-src_openvpn_dco__freebsd.c b/security/openvpn/files/patch-src_openvpn_dco__freebsd.c
index 22c24baa9ec3..686fc6584be7 100644
--- a/security/openvpn/files/patch-src_openvpn_dco__freebsd.c
+++ b/security/openvpn/files/patch-src_openvpn_dco__freebsd.c
@@ -1,6 +1,6 @@
--- src/openvpn/dco_freebsd.c.orig 2025-04-02 06:53:10 UTC
+++ src/openvpn/dco_freebsd.c
-@@ -72,6 +72,67 @@ sockaddr_to_nvlist(const struct sockaddr *sa)
+@@ -72,6 +72,61 @@ sockaddr_to_nvlist(const struct sockaddr *sa)
return (nvl);
}
@@ -32,10 +32,7 @@
+
+ in->sin_len = sizeof(*in);
+ data = nvlist_get_binary(nvl, "address", &len);
-+ if (len != sizeof(in->sin_addr))
-+ {
-+ return (false);
-+ }
++ ASSERT(len == sizeof(in->sin_addr));
+ memcpy(&in->sin_addr, data, sizeof(in->sin_addr));
+ in->sin_port = nvlist_get_number(nvl, "port");
+ break;
@@ -49,10 +46,7 @@
+
+ in6->sin6_len = sizeof(*in6);
+ data = nvlist_get_binary(nvl, "address", &len);
-+ if (len != sizeof(in6->sin6_addr))
-+ {
-+ return (false);
-+ }
++ ASSERT(len == sizeof(in6->sin6_addr));
+ memcpy(&in6->sin6_addr, data, sizeof(in6->sin6_addr));
+ in6->sin6_port = nvlist_get_number(nvl, "port");
+ break;
@@ -68,7 +62,7 @@
int
dco_new_peer(dco_context_t *dco, unsigned int peerid, int sd,
struct sockaddr *localaddr, struct sockaddr *remoteaddr,
-@@ -570,6 +631,25 @@ dco_do_read(dco_context_t *dco)
+@@ -570,6 +625,25 @@ dco_do_read(dco_context_t *dco)
case OVPN_NOTIF_ROTATE_KEY:
dco->dco_message_type = OVPN_CMD_SWAP_KEYS;
break;
diff --git a/security/openvpn/files/patch-src_openvpn_init.c b/security/openvpn/files/patch-src_openvpn_init.c
new file mode 100644
index 000000000000..0d09e6050236
--- /dev/null
+++ b/security/openvpn/files/patch-src_openvpn_init.c
@@ -0,0 +1,22 @@
+--- src/openvpn/init.c.orig 2025-04-02 06:53:10 UTC
++++ src/openvpn/init.c
+@@ -330,7 +330,7 @@ management_callback_remote_entry_count(void *arg)
+ static unsigned int
+ management_callback_remote_entry_count(void *arg)
+ {
+- assert(arg);
++ ASSERT(arg);
+ struct context *c = (struct context *) arg;
+ struct connection_list *l = c->options.connection_list;
+
+@@ -340,8 +340,8 @@ management_callback_remote_entry_get(void *arg, unsign
+ static bool
+ management_callback_remote_entry_get(void *arg, unsigned int index, char **remote)
+ {
+- assert(arg);
+- assert(remote);
++ ASSERT(arg);
++ ASSERT(remote);
+
+ struct context *c = (struct context *) arg;
+ struct connection_list *l = c->options.connection_list;