From: "ordex (Code Review)" Date: Mon, 9 Jun 2025 08:06:14 +0000 In-Reply-To: References: Reply-To: antonio@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., gert@...1296... Message-ID: <0b867f80cb9088739daedb6330099b6b1638c075-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="c+W5o/olBuM="; 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 --c+W5o/olBuM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, flichtenheld, ordex, plaisthos. Hello cron2, flichtenheld, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/1040?usp=3Demail to look at the new patch set (#2). The following approvals got outdated and were removed: Code-Review-1 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 --- 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/2 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: 2 Gerrit-Owner: ordex Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-Attention: ordex Gerrit-MessageType: newpatchset --c+W5o/olBuM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: cron2, flichtenheld, ordex, plais= thos.

ordex uploaded patch set #2 to this change.

View Change

The following approvals got outdated and were removed: Code-Review-1 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...>
---
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/2
diff --git a/src/openvpn/dco_=
linux.c b/src/openvpn/dco_linux.c
index 49dbdad..0345413 10= 0644
--- a/src/openvpn/dco_linux.c
+++ b/sr= c/openvpn/dco_linux.c
@@ -367,19 +367,19 @@
{
len =3D strnlen((char *)nla_data(tb_msg[NL= MSGERR_ATTR_MSG]),
nla_len(tb_msg[NL= MSGERR_ATTR_MSG]));
- = msg(M_WARN, "kernel error: %*s\n", len,
+ msg(M_WARN, "kernel error:= %*s", len,
(char *)nla_data(tb_msg[NLMSG= ERR_ATTR_MSG]));
}

= if (tb_msg[OVPN_NLMSGERR_ATTR_MISS_NEST])
{=
- msg(M_WARN, "ke= rnel error: missing required nesting type %u\n",
+ msg(M_WARN, "kernel error: m= issing required nesting type %u",
nla_get= _u32(tb_msg[OVPN_NLMSGERR_ATTR_MISS_NEST]));
}<= br>
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,1= 1 @@
nl_geterror(ret));
}=

+ = /* enable Extended ACK for detailed error reporting */
+ ret =3D 1;
+ setsockopt(nl_socket_get_fd(dco->n= l_sock), SOL_NETLINK, NETLINK_EXT_ACK,
+ &ret, sizeof(ret));
+
/* set close on= exec and non-block on the netlink socket */
set_cloex= ec(nl_socket_get_fd(dco->nl_sock));
set_nonblock(nl= _socket_get_fd(dco->nl_sock));

To vi= ew, 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: 2
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-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: cron2 <gert@...1296...>= ;
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: ordex <antonio@...2726...= >
Gerrit-MessageType: newpatchset
--c+W5o/olBuM=--