From patchwork Thu Feb 19 11:09:48 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4779 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:525e:b0:838:aef6:1aff with SMTP id e30csp672497mag; Thu, 19 Feb 2026 03:10:11 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV5S+5/JnWZdjO4HNjRHWwyUfT+PWPyNTnA/58YRD+X1RrZ5OTWKV5UVTXgbbqwWNA02Z2k/RZGlIM=@openvpn.net X-Received: by 2002:a05:6808:1190:b0:463:cf6b:982a with SMTP id 5614622812f47-46410b93013mr2663169b6e.22.1771499411124; Thu, 19 Feb 2026 03:10:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771499411; cv=none; d=google.com; s=arc-20240605; b=O0oGqywzYmV8N6DxVvRjA2Uvrw7sOfkpSa9Y4eEsBPFngFY6DnJJ+CmxFgPgO5Q2mG Eh/ATH66JplfihC7CTms+DdxWPmbke6PQI4XnW5Evq4aYo+VMitziuOuYoDTLVVNnXI0 UyUhI6zxzpRV6v0rzu3hIJAUflplH9TMTVWU5PFxA74tI3fhfGlCqo+5JauBGNI0BRef 3W+1D6B8jt2JI8GQYcDBeB03VUXm+GhnYVQ64kO8c7j0l9XYvE/RUsAb95EUXpvTv/uK YDFUGF6v6U1XzIIQ0i9tYB/yzOpJsfBkaxUx+PBQkqu2PqJWdgfXEfDfoOAofcA5Kake g5zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=2QMYxZQtm/4HDjYwWqbGJgcnhEhb6awaKjlxGt+56AA=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=lxyjb1VGNatS9Zje1x/u/GKqNwfM91z71xPVqU3WO3HBWJdfP1e6pQGbPT2JOhTZei teICE+tLU6yvheKyFOFlOrBUnXoHjwVw4Tu0EmJGcJWU7vyQV/v2YGGW8ubraooJUtmO JJ2Kc5dJpszDer1Ka3EecwOhi2DOpb2NF+RUxLQ+G9iyhJAYtHjMwjL9KKz04nw4QUig Hrej9IsAm6jPy6hb3CZj6uK4ezQrsGwATa7ccpNQKRgX4xw7xJNUX9cywxbTwuPnA5H4 MNLxP6KNPcN3fQW84Qq8Mx74FzgR2MkPB28re62tmTKGLmQNjffZZfzQqt2Qds1R1lpu cqgQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=iQjYSlmN; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ZZiBw3I2; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=QIcmfx51; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5614622812f47-4636af149b5si15074720b6e.58.2026.02.19.03.10.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Feb 2026 03:10:10 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=iQjYSlmN; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ZZiBw3I2; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=QIcmfx51; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2QMYxZQtm/4HDjYwWqbGJgcnhEhb6awaKjlxGt+56AA=; b=iQjYSlmNbgYfbca8mIzmvzfgkA ryhQgOosUvoXm5dA9raFm28j3a01ql2ATBIhAWjCttOUTAHZzD5FRzsgCFmgWdDWJg8eaZnvNBlbm 4tXz29Z3zfD/xSwf97yoXfr4xI5/Vdt2hEavKpTrlI9CEAWDb9Ix0NsifGSuXZPpnvXY=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vt1v2-0004cg-0W; Thu, 19 Feb 2026 11:10:04 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vt1v1-0004cY-25 for openvpn-devel@lists.sourceforge.net; Thu, 19 Feb 2026 11:10:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=I/nKYBUfuAXk5ZY4ivI2oUPgwzuRMpwrwp7krCOJWzM=; b=ZZiBw3I2YelhCfvKHx17OdxFxV ADs8h9Fj73eUXgEAI4FpSugjcvAti9wMKz+cpw6Gu1avPc4W0+3TBwgTGZnB/albimZm7j7LkmLah HDPFbTLRQAuoW0Lh3wkc7Xr1GyYFBqMG/MeVLCZNuHVY+F4htslGrfYyXYV7DfxNN0ug=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=I/nKYBUfuAXk5ZY4ivI2oUPgwzuRMpwrwp7krCOJWzM=; b=QIcmfx51F6agt0jAl+5bGQxsOl f67bBs9NG7gIhvEYzhgElfoNz0MkSIzHqUdeL7H64RiT7BV1VKFXdZSgZ+6wEqfwdue48fj9I7Qqq HBnNI9tULOjtfzJ2UW8WaBhV8HOt1Cynl6fHN53CyJHydZ8ScC+HMa/NOA+20S5aBloE=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vt1uz-0004HX-S9 for openvpn-devel@lists.sourceforge.net; Thu, 19 Feb 2026 11:10:02 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 61JB9tKP021489 for ; Thu, 19 Feb 2026 12:09:55 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 61JB9tnf021488 for openvpn-devel@lists.sourceforge.net; Thu, 19 Feb 2026 12:09:55 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 19 Feb 2026 12:09:48 +0100 Message-ID: <20260219110954.21471-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Arne Schwabe 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 b [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1vt1uz-0004HX-S9 Subject: [Openvpn-devel] [PATCH v3] DCO Linux: Fix setting DCO ifmode failing on big endian archs X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1857551766651862803?= X-GMAIL-MSGID: =?utf-8?q?1857551766651862803?= From: Arne Schwabe 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 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1547 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Antonio Quartulli 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