From: "cron2 (Code Review)" Date: Thu, 19 Feb 2026 15:52:00 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, ralf@...2726..., antonio@...2726... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="HriykoxsW4c="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: DCO Linux: Fix setting DCO ifmode failing on big endian archs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , ralf_lici Cc: openvpn-devel --HriykoxsW4c= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#4) to the change originally created by= plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1547?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by ordex Change subject: DCO Linux: Fix setting DCO ifmode failing on big endian arc= hs ...................................................................... DCO Linux: Fix setting DCO ifmode failing on big endian archs The problem is that SITNL_ADDATTR is not forcing type safety and on big endian architcutre passing a smaller size than the underlying integer type of data causes only the more significant byte(s) to be passed instead. A proper fix would be to add specific methods for common integer types like SITNL_ADDATTR_u8, SITNL_ADDATTR_u16, SITNL_ADDATTR_u32 like netlink library does with NLA_PUT_U32, NLA_PUT_U16, NLA_PUT_U8. Change-Id: I560f45fb0011180be8ca2b0e7fbc63030fa10f35 Github: closes OpenVPN/ovpn-dco#96 Signed-off-by: Arne Schwabe Acked-by: Antonio Quartulli Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1547 Message-Id: <20260219110954.21471-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 752.html Signed-off-by: Gert Doering --- M src/openvpn/networking_sitnl.c 1 file changed, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/47/1547/4 diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c index a5b2905..ad7edef 100644 --- a/src/openvpn/networking_sitnl.c +++ b/src/openvpn/networking_sitnl.c @@ -1337,7 +1337,15 @@ { dco_context_t *dco =3D arg; struct rtattr *data =3D SITNL_NEST(&req.n, sizeof(req), IFLA_INFO_= DATA); - SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &dco->ifmode, s= izeof(uint8_t)); + + /* the netlink format is uint8_t for this and using something + * other than uint8_t here (enum underlying type is undefined but + * commonly int) causes the values to be 0 when passed + * on big endian arch as we only take the (biggest endian) byte + * directly at the address + */ + uint8_t ifmode =3D (uint8_t)dco->ifmode; + SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &ifmode, sizeof= (uint8_t)); SITNL_NEST_END(&req.n, data); } #endif -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1547?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I560f45fb0011180be8ca2b0e7fbc63030fa10f35 Gerrit-Change-Number: 1547 Gerrit-PatchSet: 4 Gerrit-Owner: plaisthos Gerrit-Reviewer: ordex Gerrit-Reviewer: ralf_lici Gerrit-CC: openvpn-devel --HriykoxsW4c= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #4 to the change originally created by plaisthos.<= /p>

Vi= ew Change

The following approvals got outdated and were removed: Code-Review+2 by ordex

DCO Linux: Fix setting DCO ifmode f=
ailing on big endian archs

The problem is that SITNL_ADDATTR is not = forcing type safety and on
big endian architcutre passing a smaller size= than the underlying
integer type of data causes only the more significa= nt byte(s) to be passed
instead.

A proper fix would be to add spe= cific methods for common integer types like
SITNL_ADDATTR_u8, SITNL_ADDA= TTR_u16, SITNL_ADDATTR_u32 like netlink library
does with NLA_PUT_U32, N= LA_PUT_U16, NLA_PUT_U8.

Change-Id: I560f45fb0011180be8ca2b0e7fbc6303= 0fa10f35
Github: closes OpenVPN/ovpn-dco#96
Signed-off-by: Arne Schwa= be <arne@...1227...>
Acked-by: Antonio Quartulli <antonio@...1664...= 26...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1547
Mes= sage-Id: <20260219110954.21471-1-gert@...1296...>
URL: https://www= .mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35752.html
Sign= ed-off-by: Gert Doering <gert@...1296...>
---
M src/openvpn/net= working_sitnl.c
1 file changed, 9 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/chan=
ges/47/1547/4
diff --git a/src/openvpn/networking_sitnl.c b/src/ope=
nvpn/networking_sitnl.c
index a5b2905..ad7edef 100644
--- a/src/openvpn/networking_sitnl.c
+++ b/src/o= penvpn/networking_sitnl.c
@@ -1337,7 +1337,15 @@
= {
dco_context_t *dco =3D arg; struct rtattr *data =3D SITNL_NEST(&req.n, sizeof(req),= IFLA_INFO_DATA);
- = SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &dco->ifm= ode, sizeof(uint8_t));
+ /* the n= etlink format is uint8_t for this and using something
+ * other than uint8_t here (enum = underlying type is undefined but
+ * commonly int) causes the values to be 0 when passed=
+ * on big e= ndian arch as we only take the (biggest endian) byte
+ * directly at the address=
+ */
+ uint8_t ifmode =3D (uint8_= t)dco->ifmode;

+ = SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &ifmode, s= izeof(uint8_t));
SITNL_NEST_END(&req.n, data);=
}
#endif

=

To view, visit change 1547. To unsubscribe, or for help writing mail f= ilters, visit se= ttings.

<= div itemscope itemprop=3D"action" itemtype=3D"http://schema.org/ViewAction"= >
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I560f45fb0011180be8ca2b0e7fb= c63030fa10f35
Gerrit-Change-Number: 1547
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: ralf_lici <ralf@...2726...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --HriykoxsW4c=--