From: "plaisthos (Code Review)" Date: Wed, 18 Feb 2026 18:02:55 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="o2kErrNAnBc="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Fix setting DCO ifmode failing on big endian archs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: openvpn-devel --o2kErrNAnBc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable plaisthos has uploaded this change for review. ( http://gerrit.openvpn.net/= c/openvpn/+/1547?usp=3Demail ) Change subject: Fix setting DCO ifmode failing on big endian archs ...................................................................... Fix setting DCO ifmode failing on big endian archs The problem is basically that SITNL_ADDATTR is not type safe 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. Change-Id: I560f45fb0011180be8ca2b0e7fbc63030fa10f35 --- M src/openvpn/networking_sitnl.c 1 file changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/47/1547/1 diff --git a/src/openvpn/networking_sitnl.c b/src/openvpn/networking_sitnl.c index a5b2905..1214db2 100644 --- a/src/openvpn/networking_sitnl.c +++ b/src/openvpn/networking_sitnl.c @@ -1337,7 +1337,13 @@ { 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 causes the values to be 0 when passed + * on big endian arch as we only take the byte directly at the add= ress + */ + 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: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I560f45fb0011180be8ca2b0e7fbc63030fa10f35 Gerrit-Change-Number: 1547 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-CC: openvpn-devel --o2kErrNAnBc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

plaisthos has upl= oaded this change for review.

View Change

Fix setting DCO ifmode failing on big endian archs

The problem i= s basically that SITNL_ADDATTR is not type safe and on
big endian archit= cutre passing a smaller size than the underlying
integer type of data ca= uses only the more significant byte(s) to be passed
instead.

Chan= ge-Id: I560f45fb0011180be8ca2b0e7fbc63030fa10f35
---
M src/openvpn/ne= tworking_sitnl.c
1 file changed, 7 insertions(+), 1 deletion(-)

<= /pre>
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/cha=
nges/47/1547/1
diff --git a/src/openvpn/networking_sitnl.c b/src/op=
envpn/networking_sitnl.c
index a5b2905..1214db2 100644
--- a/src/openvpn/networking_sitnl.c
+++ b/src/= openvpn/networking_sitnl.c
@@ -1337,7 +1337,13 @@ {
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->if= mode, sizeof(uint8_t));
+
+ /* the = netlink format is uint8_t for this and using something
+ * other than uint8_t here cause= s the values to be 0 when passed
+ * on big endian arch as we only take the byte directl= y at the address
+ = */
+ uin= t8_t ifmode =3D (uint8_t)dco->ifmode;
+ SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OV= PN_MODE, &ifmode, sizeof(uint8_t));
SITNL_NEST= _END(&req.n, data);
}
#endif

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

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I560f45fb0011180be8ca2b0e7fb= c63030fa10f35
Gerrit-Change-Number: 1547
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --o2kErrNAnBc=--