From: "stipa (Code Review)" Date: Sat, 7 Oct 2023 13:26:38 +0000 References: Reply-To: lstipakov@...277..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <7dc953fc5d0953c52e177890fb6563d0ec2211be-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Bx9/lhZeewI="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[release/2.6]: dco: warn if DATA_V1 packets are sent to userspace List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --Bx9/lhZeewI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/368?usp=3Demail to review the following change. Change subject: dco: warn if DATA_V1 packets are sent to userspace ...................................................................... dco: warn if DATA_V1 packets are sent to userspace Servers 2.4.0 - 2.4.4 support peer-id and AEAD ciphers, but only send DATA_V1 packets. With DCO enabled on the client, connection is established but not working. This is because DCO driver(s) are unable to handle DATA_V1 packets and forwards them to userspace, where they silently disappear since crypto context is in DCO and not in userspace. Starting from 2.4.5 server sends DATA_V2 so problem doesn't happen. We cannot switch to non-DCO on the fly, so we log this and advice user to upgrade the server to 2.4.5 or newer. This fixes https://github.com/OpenVPN/openvpn/issues/422 Change-Id: I8cb2cb083e3cdadf187b7874979d79af3974e759 Signed-off-by: Lev Stipakov --- M src/openvpn/forward.c 1 file changed, 10 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/68/368/1 diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index d8ad0d1..66843b4 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1058,8 +1058,16 @@ * and return false. */ uint8_t opcode =3D *BPTR(&c->c2.buf) >> P_OPCODE_SHIFT; - if (tls_pre_decrypt(c->c2.tls_multi, &c->c2.from, &c->c2.buf, = &co, - floated, &ad_start)) + + if ((opcode =3D=3D P_DATA_V1) && dco_enabled(&c->options)) + { + msg(D_LINK_ERRORS, + "Data Channel Offload doesn't support DATA_V1 packets.= " + "Upgrade your server to 2.4.5 or newer."); + c->c2.buf.len =3D 0; + } + else if (tls_pre_decrypt(c->c2.tls_multi, &c->c2.from, &c->c2.= buf, + &co, floated, &ad_start)) { /* Restore pre-NCP frame parameters */ if (is_hard_reset_method2(opcode)) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/368?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: I8cb2cb083e3cdadf187b7874979d79af3974e759 Gerrit-Change-Number: 368 Gerrit-PatchSet: 1 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --Bx9/lhZeewI= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

stipa would like flichtenheld to review this change.

Vi= ew Change

dco: warn if DATA_V1 packets are sent to userspace

Ser= vers 2.4.0 - 2.4.4 support peer-id and AEAD ciphers,
but only send DATA_= V1 packets. With DCO enabled on the
client, connection is established bu= t not working.

This is because DCO driver(s) are unable to handleDATA_V1 packets and forwards them to userspace, where
they silently dis= appear since crypto context is in
DCO and not in userspace.

Start= ing from 2.4.5 server sends DATA_V2 so problem
doesn't happen.
We cannot switch to non-DCO on the fly, so we log this
and advice user= to upgrade the server to 2.4.5 or newer.

This fixes https://github.= com/OpenVPN/openvpn/issues/422

Change-Id: I8cb2cb083e3cdadf187b78749= 79d79af3974e759
Signed-off-by: Lev Stipakov <lev@...515...>
---=
M src/openvpn/forward.c
1 file changed, 10 insertions(+), 2 deletion= s(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes=
/68/368/1
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.=
c
index d8ad0d1..66843b4 100644
--- a/src/o= penvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -1058,8 +1058,16 @@
* and return false.<= /span>
*/
uint8_t opcod= e =3D *BPTR(&c->c2.buf) >> P_OPCODE_SHIFT;
- if (tls_pre_decrypt(c->c2.= tls_multi, &c->c2.from, &c->c2.buf, &co,
- floate= d, &ad_start))
+<= /span>
+ if ((opc= ode =3D=3D P_DATA_V1) && dco_enabled(&c->options))+ {
+ msg(D_LINK_ERRORS,<= /span>
+ = "Data Channel Offload doesn't support DATA_V1 packets. "

+ &quo= t;Upgrade your server to 2.4.5 or newer.");
+ c->c2.buf.len =3D 0;=
+ }
+ else if (tls_pre_dec= rypt(c->c2.tls_multi, &c->c2.from, &c->c2.buf,
<= span style=3D"color: hsl(120, 100%, 40%);">+ = &co, floated, &ad_start))
{
/* Restore pre-NCP frame parameters */<= br> if (is_hard_reset_method2(opcode))

To view, visit change 368. To unsubscribe, or for help wri= ting mail filters, visit set= tings.

=
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I8cb2cb083e3cdadf187b7874979= d79af3974e759
Gerrit-Change-Number: 368
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--Bx9/lhZeewI=--