| Message ID | 20260219110954.21471-1-gert@greenie.muc.de |
|---|---|
| State | New |
| Headers | show |
| Series | [Openvpn-devel,v3] DCO Linux: Fix setting DCO ifmode failing on big endian archs | expand |
Interesting catch, this :-) - I have tested this for "master" and "release/2.6"
on a regular Intel system, just to be sure there was no accidential breakage
on the other endiannes... (things still work).
Your patch has been applied to the master, release/2.7 and release/2.6 branch
(in 2.6, the "SITNL_ADDATTR()" line is wrapped differently, pre-clang-format
formatting, but that was trivially adjusted)
commit b3e0e8696b162794beefc22aad7406b328471cf6 (master)
commit 1c9f9bfa5c1f5e23036b1ffab683d926cd4c1aef (release/2.7)
commit a2037b264169530e7e6ee22007587369becec4be (release/2.6)
Author: Arne Schwabe
Date: Thu Feb 19 12:09:48 2026 +0100
DCO Linux: Fix setting DCO ifmode failing on big endian archs
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@mandelbit.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1547
Message-Id: <20260219110954.21471-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35752.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
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 = arg; struct rtattr *data = SITNL_NEST(&req.n, sizeof(req), IFLA_INFO_DATA); - SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &dco->ifmode, sizeof(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 = (uint8_t)dco->ifmode; + SITNL_ADDATTR(&req.n, sizeof(req), IFLA_OVPN_MODE, &ifmode, sizeof(uint8_t)); SITNL_NEST_END(&req.n, data); } #endif