From: "cron2 (Code Review)" Date: Mon, 9 Jun 2025 17:46:21 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: <7a7701c0e451d9de488f73bc17f45d6f5f3feb4d-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="JqMILpvuN1g="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: dco_linux: enable extended netlink error reporting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --JqMILpvuN1g= 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/+/1040?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: dco_linux: enable extended netlink error reporting ...................................................................... dco_linux: enable extended netlink error reporting The ovpn netlink code reports more verbose error strings to help userspace understand what went wrong, rather than just returning, for example, -EINVAL. However, userspace must instruct the kernel netlink subsystem that it wants to receive such strings. code for parsing such strings has always been present but it was never used. Set the socket option which enables such reporting. Change-Id: I4457b1d7262e0a39c275d33aaef6c4bcbeae6ab3 Signed-off-by: Antonio Quartulli Acked-by: Gert Doering Message-Id: <20250609100216.3997-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 885.html Signed-off-by: Gert Doering --- M src/openvpn/dco_linux.c 1 file changed, 8 insertions(+), 3 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/40/1040/3 diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 49dbdad..0345413 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -367,19 +367,19 @@ { len =3D strnlen((char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG]), nla_len(tb_msg[NLMSGERR_ATTR_MSG])); - msg(M_WARN, "kernel error: %*s\n", len, + msg(M_WARN, "kernel error: %*s", len, (char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG])); } if (tb_msg[OVPN_NLMSGERR_ATTR_MISS_NEST]) { - msg(M_WARN, "kernel error: missing required nesting type %u\n", + msg(M_WARN, "kernel error: missing required nesting type %u", nla_get_u32(tb_msg[OVPN_NLMSGERR_ATTR_MISS_NEST])); } if (tb_msg[OVPN_NLMSGERR_ATTR_MISS_TYPE]) { - msg(M_WARN, "kernel error: missing required attribute type %u\n", + msg(M_WARN, "kernel error: missing required attribute type %u", nla_get_u32(tb_msg[OVPN_NLMSGERR_ATTR_MISS_TYPE])); } @@ -405,6 +405,11 @@ nl_geterror(ret)); } + /* enable Extended ACK for detailed error reporting */ + ret =3D 1; + setsockopt(nl_socket_get_fd(dco->nl_sock), SOL_NETLINK, NETLINK_EXT_AC= K, + &ret, sizeof(ret)); + /* set close on exec and non-block on the netlink socket */ set_cloexec(nl_socket_get_fd(dco->nl_sock)); set_nonblock(nl_socket_get_fd(dco->nl_sock)); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1040?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: I4457b1d7262e0a39c275d33aaef6c4bcbeae6ab3 Gerrit-Change-Number: 1040 Gerrit-PatchSet: 3 Gerrit-Owner: ordex Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --JqMILpvuN1g= 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: enable extended netlink error reporting
The ovpn netlink code reports more verbose error
strings to help u= serspace understand what went wrong,
rather than just returning, for exa= mple, -EINVAL.

However, userspace must instruct the kernel netlinksubsystem that it wants to receive such strings.

code for parsing = such strings has always been present
but it was never used.

Set t= he socket option which enables such reporting.

Change-Id: I4457b1d72= 62e0a39c275d33aaef6c4bcbeae6ab3
Signed-off-by: Antonio Quartulli <ant= onio@...2726...>
Acked-by: Gert Doering <gert@...1296...>
Me= ssage-Id: <20250609100216.3997-1-gert@...1296...>
URL: https://www= .mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31885.html
Sign= ed-off-by: Gert Doering <gert@...1296...>
---
M src/openvpn/dco= _linux.c
1 file changed, 8 insertions(+), 3 deletions(-)

git p= ull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/40/1040/3d= iff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c
index 49dbdad..0345413 100644
--- a/src/openvpn/dco_linu= x.c
+++ b/src/openvpn/dco_linux.c
@@ -367,1= 9 +367,19 @@
{
len =3D strnle= n((char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG]),
= nla_len(tb_msg[NLMSGERR_ATTR_MSG]));
- msg(M_WARN, "kernel error: %*s\n&quo= t;, len,
+ msg= (M_WARN, "kernel error: %*s", len,
(= char *)nla_data(tb_msg[NLMSGERR_ATTR_MSG]));
}<= br>
if (tb_msg[OVPN_NLMSGERR_ATTR_MISS_NEST])
{
-= msg(M_WARN, "kernel error: missing required nesting type %u\n&= quot;,
+ msg(M= _WARN, "kernel error: missing required nesting type %u", nla_get_u32(tb_msg[OVPN_NLMSGERR_ATTR_MISS_NEST]));
}

if (tb_msg[OVPN= _NLMSGERR_ATTR_MISS_TYPE])
{
- msg(M_WARN, "kernel error: missing= required attribute type %u\n",
+ msg(M_WARN, "kernel error: missing required a= ttribute type %u",
nla_get_u32(tb_msg[OVP= N_NLMSGERR_ATTR_MISS_TYPE]));
}

@@ -405,6 +405,11 @@
nl_geterror(r= et));
}

+ /* enable Extended ACK for detailed error re= porting */
+ ret = =3D 1;
+ setsockop= t(nl_socket_get_fd(dco->nl_sock), SOL_NETLINK, NETLINK_EXT_ACK,+ &ret, siz= eof(ret));
+ /* set close on exec and non-block on the netlink socket */
set_cloexec(nl_socket_get_fd(dco->nl_sock)); set_nonblock(nl_socket_get_fd(dco->nl_sock));

To view, visit change 1040. To unsubscribe, or for help = writing mail filters, visit = settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4457b1d7262e0a39c275d33aaef= 6c4bcbeae6ab3
Gerrit-Change-Number: 1040
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
--JqMILpvuN1g=--