From patchwork Tue Jul 14 09:25:46 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5106 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:5462:b0:878:73b6:dbac with SMTP id d2csp162809mas; Tue, 14 Jul 2026 02:26:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AFNElJ+5EI5jGls7GYHsxFMBQS8+fiyEWuokFGYZs/j0SfCbI6yjhtxW9zyLafoJlnx4U4b4wPpWA8v2zhk=@openvpn.net X-Received: by 2002:a05:6820:4d0b:b0:69e:313d:a3b0 with SMTP id 006d021491bc7-6a38b887c93mr8890850eaf.2.1784021176885; Tue, 14 Jul 2026 02:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1784021176; cv=none; d=google.com; s=arc-20260327; b=Zwul+W9OZtUNDPSlueAQPY/XtmRUBKZt7V/IwV7yRhlnJKsyM0XAWblt3C+WPrTSam mea9vdu3tMGmp0wYUYHpBDc5u9gahPJU6IOwpL5ApjZaRJrU/TD+1RtStZllhlhz4xut 0Uqba+m3WX3MWn3MO1NnKMdGJgyC/+2myRV0chiKBrMs+IYl7VpqgsXraj6qexnpJgXR h0Tmd3i6cZad9mJPjAK8YuDtw8LEd+y+Hxu6aypXTu3IC/sJE/Wrm0se123PkhLIMbBU y1ANewraT/HkcVbVpqMm/pmAexut0/qWrvEML2kdk07eJFbfEBW3nheU7WgVRD8Sj9/M LYFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; 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=OrrlVy4JMmjp9zUkFjJBOJenAHKc/Xwh0JKiBirhLEs=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=pcu79N6kZWXdf/4xjiJqMgGxEQozTEGztEgyG8fR0qgmBXglGHWT8AF18WGujbLV9H O/kZyjXt24lMfQ6PUrWYPkmj/2dnr1504prIiFnIgreNEEAmnFbu6GKmYkjJRLRt1pIY PxJ5bSIWdUYsIMRwwgjRkyswi/uP9XPwBuJu6JmIiZwKRK1YENHWLvW6w2Uw6deXlBYQ jLCgYj0/uYQE8QfS1PgDxMABJyt4np+3cumvOKeb+b7whD+E1kGnv1XaguXIfLj/nrk3 sCJo10EWukFwUVOgIyzRMtE1KzADjwBdhKRL+KEm4T3OA3t0mSTcfF4bYyYG1VsaACpe idbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=KqP8hrj0; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="gtVQRg/A"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cycADmA8; 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 586e51a60fabf-451db36c729si8820710fac.365.2026.07.14.02.26.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2026 02:26:16 -0700 (PDT) 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=KqP8hrj0; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="gtVQRg/A"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cycADmA8; 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=OrrlVy4JMmjp9zUkFjJBOJenAHKc/Xwh0JKiBirhLEs=; b=KqP8hrj00Ko4KhCQP39P5deFHa D/QraWzKgrnXKvbICcY9luWRrEIxXfc/c11j5fLNYOjW8PWWfaV1Q0bmPPp9IWZMX7gVmx89QuwXa +gvPIonJOWNVcmrawMD4enmht0UdaRuOCF5GhM+5QeOoeW7Z0HF0GQpCBlPqx+H4Adj4=; 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 1wjZOy-0005AI-G5; Tue, 14 Jul 2026 09:26:08 +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 1wjZOx-0005AB-3m for openvpn-devel@lists.sourceforge.net; Tue, 14 Jul 2026 09:26:07 +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=L6KHeXvMkTz4JdSfkoWOXhrjcZRBhUBxaQp4cq/NqZI=; b=gtVQRg/A5KYcdHKSWPnfNIrhMG 1IAh340NY/L/zDaZWZzbBptSgfYc6k8AbDLl0bRtqOCtZgpQTJfaUcaCcPiwcjUKvm4fg9wNPoQcm Qa8iurod3r13wfeDoJpsDYViSKOeQH2aDd2wU3BxmVCcD9Yshk0QhcYn8ut9IcEPS9hk=; 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=L6KHeXvMkTz4JdSfkoWOXhrjcZRBhUBxaQp4cq/NqZI=; b=cycADmA8vt4hm1bnNeLr/X7cyY piL5emH44avKmadjtUP5LJHQnlTpJbOV5/dkHyA9v6tTHl3xBnaScCv4XCWvYq09adbCEJ4hV+sWX gEycmPCIF3dukdyVfCGl4YFWDEAG49Fer1c/ghtgdo4QKctUBJ8rFxSHv7PA0M0R1XEs=; 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 1wjZOu-0003GH-E7 for openvpn-devel@lists.sourceforge.net; Tue, 14 Jul 2026 09:26:06 +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 66E9PqjH018709 for ; Tue, 14 Jul 2026 11:25:52 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 66E9PqcG018708 for openvpn-devel@lists.sourceforge.net; Tue, 14 Jul 2026 11:25:52 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 14 Jul 2026 11:25:46 +0200 Message-ID: <20260714092552.18685-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.53.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: Lev Stipakov Add 64-bit big-endian buffer accessors alongside the existing 8/16/32-bit helpers, using htonll()/ntohll() for the byte-order conversion. buf_read_u64() reports success via a bool out-parameter, mirroring buf_read_u32(). 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: 1wjZOu-0003GH-E7 Subject: [Openvpn-devel] [PATCH v3] buffer: Add buf_read_u64() and buf_write_u64() 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: 1870177968279764789 X-GMAIL-MSGID: 1870681789563561115 From: Lev Stipakov Add 64-bit big-endian buffer accessors alongside the existing 8/16/32-bit helpers, using htonll()/ntohll() for the byte-order conversion. buf_read_u64() reports success via a bool out-parameter, mirroring buf_read_u32(). Change-Id: Ic677f43fc3eb0052f8e80d9a7f098d34ad03dfe1 Signed-off-by: Lev Stipakov Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1740 --- 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/+/1740 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h index fcc923b..1db9367 100644 --- a/src/openvpn/buffer.h +++ b/src/openvpn/buffer.h @@ -25,6 +25,7 @@ #include "basic.h" #include "error.h" +#include "integer.h" #define BUF_SIZE_MAX 1000000 @@ -702,6 +703,13 @@ } static inline bool +buf_write_u64(struct buffer *dest, uint64_t data) +{ + uint64_t u64 = htonll(data); + return buf_write(dest, &u64, sizeof(uint64_t)); +} + +static inline bool buf_copy(struct buffer *dest, const struct buffer *src) { return buf_write(dest, BPTR(src), BLENZ(src)); @@ -827,6 +835,30 @@ } } +/* Read a 64-bit big-endian value (see buf_write_u64()). Sets *good to indicate + * success, like buf_read_u32(). */ +static inline uint64_t +buf_read_u64(struct buffer *buf, bool *good) +{ + uint64_t ret; + if (!buf_read(buf, &ret, sizeof(uint64_t))) + { + if (good) + { + *good = false; + } + return 0; + } + else + { + if (good) + { + *good = true; + } + return ntohll(ret); + } +} + /** Return true if buffer contents are equal */ static inline bool buf_equal(const struct buffer *a, const struct buffer *b)