From: "ordex (Code Review)" Date: Mon, 19 May 2025 10:36:41 +0000 References: Reply-To: antonio@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <0e43fefba454f7feae249b8ba5947a2ec1f4c088-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Ba/2mj0J9u0="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: dco_linux: print meaningful text when netlink message is not parsed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --Ba/2mj0J9u0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1027?usp=3Demail to review the following change. Change subject: dco_linux: print meaningful text when netlink message is no= t parsed ...................................................................... dco_linux: print meaningful text when netlink message is not parsed We may bail out parsing an incoming DCO message because it may concern a different interface. In that case we print the following debug messages: dco_do_read ovpn-dco: ignoring message (type=3D5) for foreign ifindex 313 process_incoming_dco: received message of type 0 - ignoring However, the last message is confusing, because there is no message of type 0 being received, but the message_type was simply not initialized. Fix that by printing something more appropriate like: process_incoming_dco: received message was not parsed Change-Id: I568faa12a5960e8b69de23c2df413b70b231592c Signed-off-by: Antonio Quartulli --- M src/openvpn/dco_linux.c M src/openvpn/forward.c 2 files changed, 12 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/27/1027/1 diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 3f7965e..29722cb 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -903,6 +903,12 @@ dco_do_read(dco_context_t *dco) { msg(D_DCO_DEBUG, __func__); + + /* set the message type to an invalid value so that we later know + * if a message was properly parsed or we bailed out earlier + */ + dco->dco_message_type =3D -1; + nl_cb_set(dco->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, ovpn_handle_msg, dco); return ovpn_nl_recvmsgs(dco, __func__); diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index ed4cdb4..39c74af 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1251,6 +1251,12 @@ dco_do_read(dco); + if (dco->dco_message_type =3D=3D -1) + { + msg(D_DCO_DEBUG, "%s: received message was not parsed"); + return; + } + /* FreeBSD currently sends us removal notifcation with the old peer-id= in * p2p mode with the ping timeout reason, so ignore that one to not sh= oot * ourselves in the foot and removing the just established session */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1027?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: I568faa12a5960e8b69de23c2df413b70b231592c Gerrit-Change-Number: 1027 Gerrit-PatchSet: 1 Gerrit-Owner: ordex Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --Ba/2mj0J9u0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

ordex would like plaisthos and flichtenheld to review t= his change.

V= iew Change

dco_linux: print meaningful text when netlink message is not=
 parsed

We may bail out parsing an incoming DCO message because it m= ay
concern a different interface.
In that case we print the following= debug messages:

dco_do_read
ovpn-dco: ignoring message (= type=3D5) for foreign ifindex 313
process_incoming_dco: received mes= sage of type 0 - ignoring

However, the last message is confusing, be= cause there is no message
of type 0 being received, but the message_type= was simply not
initialized.

Fix that by printing something more = appropriate like:

process_incoming_dco: received message was not= parsed

Change-Id: I568faa12a5960e8b69de23c2df413b70b231592c
Sign= ed-off-by: Antonio Quartulli <antonio@...2726...>
---
M src/ope= nvpn/dco_linux.c
M src/openvpn/forward.c
2 files changed, 12 insertio= ns(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/ope=
nvpn refs/changes/27/1027/1
diff --git a/src/openvpn/dco_linux.c b/=
src/openvpn/dco_linux.c
index 3f7965e..29722cb 100644
--- a/src/openvpn/dco_linux.c
+++ b/src/openvpn/= dco_linux.c
@@ -903,6 +903,12 @@
dco_do_re= ad(dco_context_t *dco)
{
msg(D_DCO_DE= BUG, __func__);
+
+ /* set the message = type to an invalid value so that we later know
+ * if a message was properly parsed or we ba= iled out earlier
+ = */
+ dco->dco= _message_type =3D -1;
+
nl_cb_set(dco->nl_cb, NL_CB_VALID, NL_CB_CUSTOM,= ovpn_handle_msg, dco);

return ovpn_= nl_recvmsgs(dco, __func__);
diff --git a/src/openvpn/forwar= d.c b/src/openvpn/forward.c
index ed4cdb4..39c74af 100644
--- a/src/openvpn/forward.c
+++ b/src/openvp= n/forward.c
@@ -1251,6 +1251,12 @@
=
dco_do_read(dco);

+ if (dco->dco_message_type =3D=3D -1)<= /span>
+ {
+ msg(D_DCO_DEBUG, "%s:= received message was not parsed");

+ return;
+ }
change 1027. To unsubscribe, or for help wr= iting mail filters, visit se= ttings.

<= div itemscope itemprop=3D"action" itemtype=3D"http://schema.org/ViewAction"= >
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I568faa12a5960e8b69de23c2df4= 13b70b231592c
Gerrit-Change-Number: 1027
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <antonio@...2726...>=
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: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--Ba/2mj0J9u0=--