From: "cron2 (Code Review)" Date: Mon, 8 Sep 2025 10:38:04 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., matthias.andree@...68..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <9312d7f2a28aa7aea41383c44af8eafbc2c311d5-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="7OtYRm0IWDQ="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: replace assert() calls with ASSERT() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld , mandree Cc: openvpn-devel --7OtYRm0IWDQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello flichtenheld, mandree, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/1171?usp=3Demail to look at the new patch set (#2). The following approvals got outdated and were removed: Code-Review+2 by mandree Change subject: replace assert() calls with ASSERT() ...................................................................... replace assert() calls with ASSERT() 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() is 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. Change-Id: I6480d6f741c2368a0d951004b91167d5943f8f9d Signed-off-by: Gert Doering Acked-by: mandree Message-Id: <20250907211252.23924-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 824.html Signed-off-by: Gert Doering --- M src/openvpn/dco_freebsd.c M src/openvpn/init.c M src/openvpn/options.c 3 files changed, 8 insertions(+), 8 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/1171/2 diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index 931f9f6..65303cd 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -100,7 +100,7 @@ in->sin_len =3D sizeof(*in); data =3D nvlist_get_binary(nvl, "address", &len); - assert(len =3D=3D sizeof(in->sin_addr)); + ASSERT(len =3D=3D sizeof(in->sin_addr)); memcpy(&in->sin_addr, data, sizeof(in->sin_addr)); in->sin_port =3D nvlist_get_number(nvl, "port"); break; @@ -114,7 +114,7 @@ in6->sin6_len =3D sizeof(*in6); data =3D nvlist_get_binary(nvl, "address", &len); - assert(len =3D=3D sizeof(in6->sin6_addr)); + ASSERT(len =3D=3D sizeof(in6->sin6_addr)); memcpy(&in6->sin6_addr, data, sizeof(in6->sin6_addr)); in6->sin6_port =3D nvlist_get_number(nvl, "port"); diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 39ea8e4..2821cd4 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -319,7 +319,7 @@ static unsigned int management_callback_remote_entry_count(void *arg) { - assert(arg); + ASSERT(arg); struct context *c =3D (struct context *)arg; struct connection_list *l =3D c->options.connection_list; @@ -329,8 +329,8 @@ 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 =3D (struct context *)arg; struct connection_list *l =3D c->options.connection_list; diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 0616a17..6858a69 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3486,9 +3486,9 @@ { /* Copy --dhcp-options to tuntap_options */ struct dhcp_options *dhcp =3D &dns->from_dhcp; - assert(sizeof(dhcp->dns) =3D=3D sizeof(tt->dns)); - assert(sizeof(dhcp->dns6) =3D=3D sizeof(tt->dns6)); - assert(sizeof(dhcp->domain_search_list) =3D=3D sizeof(tt->domain_s= earch_list)); + ASSERT(sizeof(dhcp->dns) =3D=3D sizeof(tt->dns)); + ASSERT(sizeof(dhcp->dns6) =3D=3D sizeof(tt->dns6)); + ASSERT(sizeof(dhcp->domain_search_list) =3D=3D sizeof(tt->domain_s= earch_list)); tt->domain =3D dhcp->domain; tt->dns_len =3D dhcp->dns_len; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1171?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6480d6f741c2368a0d951004b91167d5943f8f9d Gerrit-Change-Number: 1171 Gerrit-PatchSet: 2 Gerrit-Owner: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: mandree Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --7OtYRm0IWDQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #2 to this change.

View Change

The following approvals got outdated and were removed: Code-Review+2 by mandree

replace assert() calls with ASSERT()

OpenVP= N's ASSERT() macro will do a bit more than the standard-libc
assert(= ) call, namely print out which function and what expression
failed, befo= re calling _exit(1). Also, it can not be accidentially
compiled-away (-= DNDEBUG).

Use of ASSERT() is generally only advised in cases of &quo= t;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 lack= ing the extra debug
info, and as such, not advised at all.

Change= -Id: I6480d6f741c2368a0d951004b91167d5943f8f9d
Signed-off-by: Gert Doeri= ng <gert@...1296...>
Acked-by: mandree <matthias.andree@...2908...= .>
Message-Id: <20250907211252.23924-1-gert@...1296...>
URL:= https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32824.= html
Signed-off-by: Gert Doering <gert@...1296...>
---
M src= /openvpn/dco_freebsd.c
M src/openvpn/init.c
M src/openvpn/options.c3 files changed, 8 insertions(+), 8 deletions(-)

git pull ssh:=
//gerrit.openvpn.net:29418/openvpn refs/changes/71/1171/2
diff --=
git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c
index 931f9f6..65303cd 100644
--- a/src/openvpn/dco_freebs= d.c
+++ b/src/openvpn/dco_freebsd.c
@@ -100= ,7 +100,7 @@

in->sin_len = =3D sizeof(*in);
data =3D nvlist_get_binary(nv= l, "address", &len);
- assert(len =3D=3D sizeof(in->sin_addr));=
+ ASSERT(len =3D= =3D sizeof(in->sin_addr));
memcpy(&in-&= gt;sin_addr, data, sizeof(in->sin_addr));
i= n->sin_port =3D nvlist_get_number(nvl, "port");
break;
@@ -114,7 +114,7 @@
=
in6->sin6_len =3D sizeof(*in6);
= data =3D nvlist_get_binary(nvl, "address", &am= p;len);
- as= sert(len =3D=3D sizeof(in6->sin6_addr));
+ ASSERT(len =3D=3D sizeof(in6->sin6_a= ddr));
memcpy(&in6->sin6_addr, data, si= zeof(in6->sin6_addr));
in6->sin6_port = =3D nvlist_get_number(nvl, "port");

<= span>diff --git a/src/openvpn/init.c b/src/openvpn/init.c
i= ndex 39ea8e4..2821cd4 100644
--- a/src/openvpn/init.c

+++ b/src/openvpn/init.c
@@ -319,7 +319,7 @@
static unsigned int
management_callback_remo= te_entry_count(void *arg)
{
- assert(arg);
+ ASSERT(arg);
struct context *c= =3D (struct context *)arg;
struct connection_list *l = =3D c->options.connection_list;

@@ -32= 9,8 +329,8 @@
static bool
management_call= back_remote_entry_get(void *arg, unsigned int index, char **remote)<= br> {
- assert= (arg);
- assert(remo= te);
+ ASSERT(arg)= ;
+ ASSERT(remote)= ;

struct context *c =3D (struct cont= ext *)arg;
struct connection_list *l =3D c->options= .connection_list;
diff --git a/src/openvpn/options.c b/src/= openvpn/options.c
index 0616a17..6858a69 100644
<= span>--- a/src/openvpn/options.c

+++ b/src/openvpn/options.= c
@@ -3486,9 +3486,9 @@
{
/* Copy --dhcp-options to tuntap_options */
= struct dhcp_options *dhcp =3D &dns->from_dhcp;
- assert(sizeof(dhcp->dns) = =3D=3D sizeof(tt->dns));
- assert(sizeof(dhcp->dns6) =3D=3D sizeof(tt->dns6));
- assert(sizeof(dhc= p->domain_search_list) =3D=3D sizeof(tt->domain_search_list));=
+ ASSERT(sizeof(dhcp= ->dns) =3D=3D sizeof(tt->dns));
+ ASSERT(sizeof(dhcp->dns6) =3D=3D sizeof(tt->= ;dns6));
+ ASS= ERT(sizeof(dhcp->domain_search_list) =3D=3D sizeof(tt->domain_search_= list));

tt->domain =3D dhcp-&= gt;domain;
tt->dns_len =3D dhcp->dns_len;


To view, visit change 1171. To unsubscribe, o= r for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6480d6f741c2368a0d951004b91= 167d5943f8f9d
Gerrit-Change-Number: 1171
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <gert@...1296...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: mandree <matthias.andree@...220...= ..68...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--7OtYRm0IWDQ=--