From: "cron2 (Code Review)" Date: Wed, 23 Jul 2025 08:18:40 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: <405b2fe22f7edffc080fc5ed35d5b0ba197f5271-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="uVaTS0jivC0="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: dco_linux: use M_FATAL instead of M_ERR in netlink error code paths List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --uVaTS0jivC0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= ordex. ( http://gerrit.openvpn.net/c/openvpn/+/1096?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: dco_linux: use M_FATAL instead of M_ERR in netlink error co= de paths ...................................................................... dco_linux: use M_FATAL instead of M_ERR in netlink error code paths Netlink code doesn't set errno upon error (with the exception of any *alloc() function which probably inherits the errno=3DENOMEM from the underlying malloc call), therefore we should not print error messages with M_ERR, but rather rely on M_FATAL. M_ERR is equivalent to M_FATAL with the addition of appending ": $errno" to the error string. Since errno is not meaningful in this context, we can just opt for the less confusing M_FATAL. Change-Id: Ifc442b4426c02de7282d0f69629e8a10b679c589 Signed-off-by: Antonio Quartulli Acked-by: Gert Doering Message-Id: <20250723063039.25449-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 271.html Signed-off-by: Gert Doering --- M src/openvpn/dco_linux.c 1 file changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1096/3 diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 0a73882..a04a164 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -114,7 +114,7 @@ struct nl_msg *nl_msg =3D nlmsg_alloc(); if (!nl_msg) { - msg(M_ERR, "cannot allocate netlink message"); + msg(M_FATAL, "cannot allocate netlink message"); return NULL; } @@ -140,7 +140,7 @@ break; case -NLE_NOMEM: - msg(M_ERR, "%s: netlink out of memory error", prefix); + msg(M_FATAL, "%s: netlink out of memory error", prefix); break; case -NLE_AGAIN: @@ -148,7 +148,7 @@ break; case -NLE_NODEV: - msg(M_ERR, "%s: netlink reports device not found:", prefix); + msg(M_FATAL, "%s: netlink reports device not found:", prefix); break; case -NLE_OBJ_NOTFOUND: @@ -387,19 +387,19 @@ static void ovpn_dco_init_netlink(dco_context_t *dco) { - dco->ovpn_dco_id =3D resolve_ovpn_netlink_id(M_ERR); + dco->ovpn_dco_id =3D resolve_ovpn_netlink_id(M_FATAL); dco->nl_sock =3D nl_socket_alloc(); if (!dco->nl_sock) { - msg(M_ERR, "Cannot create netlink socket"); + msg(M_FATAL, "Cannot create netlink socket"); } int ret =3D genl_connect(dco->nl_sock); if (ret) { - msg(M_ERR, "Cannot connect to generic netlink: %s", + msg(M_FATAL, "Cannot connect to generic netlink: %s", nl_geterror(ret)); } @@ -415,7 +415,7 @@ dco->nl_cb =3D nl_cb_alloc(NL_CB_DEFAULT); if (!dco->nl_cb) { - msg(M_ERR, "failed to allocate netlink callback"); + msg(M_FATAL, "failed to allocate netlink callback"); } nl_socket_set_cb(dco->nl_sock, dco->nl_cb); @@ -478,7 +478,7 @@ if (dco->ovpn_dco_mcast_id < 0) { - msg(M_ERR, "cannot get mcast group: %s", nl_geterror(dco->ovpn_dc= o_mcast_id)); + msg(M_FATAL, "cannot get mcast group: %s", nl_geterror(dco->ovpn_= dco_mcast_id)); } /* Register for ovpn-dco specific multicast messages that the kernel m= ay @@ -487,7 +487,7 @@ int ret =3D nl_socket_add_membership(dco->nl_sock, dco->ovpn_dco_mcast= _id); if (ret) { - msg(M_ERR, "%s: failed to join groups: %d", __func__, ret); + msg(M_FATAL, "%s: failed to join groups: %d", __func__, ret); } } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1096?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: Ifc442b4426c02de7282d0f69629e8a10b679c589 Gerrit-Change-Number: 1096 Gerrit-PatchSet: 3 Gerrit-Owner: ordex Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --uVaTS0jivC0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #3 to the change originally cr= eated by ordex.

View Change

The following approvals got outdated an= d were removed: Code-Review+2 by cron2

dco_linux: use M_FATAL instead of M_ERR in netlink e=
rror code paths

Netlink code doesn't set errno upon error (with = the exception of
any *alloc() function which probably inherits the errno= =3DENOMEM
from the underlying malloc call), therefore we should not prin= t
error messages with M_ERR, but rather rely on M_FATAL.

M_ERR is= equivalent to M_FATAL with the addition of appending
": $errno&quo= t; to the error string.

Since errno is not meaningful in this contex= t, we can just opt
for the less confusing M_FATAL.

Change-Id: Ifc= 442b4426c02de7282d0f69629e8a10b679c589
Signed-off-by: Antonio Quartulli = <antonio@...2726...>
Acked-by: Gert Doering <gert@...1296...>= ;
Message-Id: <20250723063039.25449-1-gert@...1296...>
URL: htt= ps://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32271.html=
Signed-off-by: Gert Doering <gert@...1296...>
---
M src/ope= nvpn/dco_linux.c
1 file changed, 9 insertions(+), 9 deletions(-)

=
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1096/3
diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c
index 0a73882..a04a164 100644
--- a/src/openvpn/= dco_linux.c
+++ b/src/openvpn/dco_linux.c
@= @ -114,7 +114,7 @@
struct nl_msg *nl_msg =3D nlmsg_all= oc();
if (!nl_msg)
{
- msg(M_ERR, "cannot al= locate netlink message");

+ msg(M_FATAL, "cannot allocate netlink message"= );
return NULL;
}
<= span>
@@ -140,7 +140,7 @@
bre= ak;

case -NLE_NOMEM:
<= span style=3D"color: hsl(0, 100%, 40%);">- msg(M_ERR, "%s: = netlink out of memory error", prefix);
+ msg(M_FATAL, "%s: netlink out of m= emory error", prefix);
break;
<= span>
case -NLE_AGAIN:
@@ -148,7 = +148,7 @@
break;

<= span> case -NLE_NODEV:
- msg(M_ERR, "%s: netlink reports device not found:= ", prefix);
+ = msg(M_FATAL, "%s: netlink reports device not found:", pr= efix);
break;

case -NLE_OBJ_NOTFOUND:
@@ -387,19 +387,19 @@
static void
ovpn_dco_init_netlink(dco_conte= xt_t *dco)
{
- dco->ovpn_dco_id =3D resolve_ovpn_netlink_id(M_ERR);<= br>+ dco->ovpn_dco_id =3D= resolve_ovpn_netlink_id(M_FATAL);

d= co->nl_sock =3D nl_socket_alloc();

= if (!dco->nl_sock)
{
- msg(M_ERR, "Cannot create netlink soc= ket");
+ = msg(M_FATAL, "Cannot create netlink socket");
= }

int ret =3D genl_connect(dco->= ;nl_sock);
if (ret)
{
<= span style=3D"color: hsl(0, 100%, 40%);">- msg(M_ERR, "Cannot c= onnect to generic netlink: %s",

+ msg(M_FATAL, "Cannot connect to generic netli= nk: %s",
nl_geterror(ret));
}

@@ -415,7 +415,7 @@
<= span> dco->nl_cb =3D nl_cb_alloc(NL_CB_DEFAULT);
= if (!dco->nl_cb)
{
- msg(M_ERR, "failed to allocate netlink = callback");
+ = msg(M_FATAL, "failed to allocate netlink callback");<= br> }

nl_socket_set_cb(dco= ->nl_sock, dco->nl_cb);
@@ -478,7 +478,7 @@
if (dco->ovpn_dco_mcast_id < 0)<= br> {
- = msg(M_ERR, "cannot get mcast group: %s", nl_geterror(dco->o= vpn_dco_mcast_id));
+= msg(M_FATAL, "cannot get mcast group: %s", nl_geterror(d= co->ovpn_dco_mcast_id));
}
=
/* Register for ovpn-dco specific multicast messages that th= e kernel may
@@ -487,7 +487,7 @@
int r= et =3D nl_socket_add_membership(dco->nl_sock, dco->ovpn_dco_mcast_id)= ;
if (ret)
{
- msg(M_ERR, "%s: failed to joi= n groups: %d", __func__, ret);
+ msg(M_FATAL, "%s: failed to join groups: %d&qu= ot;, __func__, ret);
}
}


To view, visit change 1096. To unsubs= cribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifc442b4426c02de7282d0f69629= e8a10b679c589
Gerrit-Change-Number: 1096
Gerrit-PatchSet: 3
Gerrit-Owner: ordex <antonio@...2726...>=
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--uVaTS0jivC0=--