From patchwork Wed Nov 26 11:40:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4635 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6c3:b0:7b1:439f:bdf with SMTP id j3csp3268081maw; Wed, 26 Nov 2025 03:41:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV8Wi3GircRtoSuQzmz3O3PYcnmx0fb4jkaSB8T99Zz1646M77Q/HxpRltb3Vcm/HN5mHmtYkyxFM8=@openvpn.net X-Google-Smtp-Source: AGHT+IHGm8Aw7uk1SuV2oYCwJ3/M6a98WrXcUdkHBMKD0ELpDkcHTC3X2d2zbQSPKokux65RZNKO X-Received: by 2002:a05:6830:1296:b0:7c7:53bd:23c1 with SMTP id 46e09a7af769-7c78eb37c5cmr8554934a34.17.1764157268224; Wed, 26 Nov 2025 03:41:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1764157268; cv=none; d=google.com; s=arc-20240605; b=eDyc1xd6syxkVz+Y+T9q1lKWqG5sON4QBICISarPnm06izWoQGSsYB5HEe5D3xEu4P lrOV0s1nkBDnApSR2Z6okflM7fy3pwe5YrHFPX9RtYkLiqjRAeNQZlaR6Xa8M496mVT9 2f03/ZVrGBcaRK8ZkwEIS5L0oZF5UlwaGVHc5fVOXzykvq/3QlAtOskgU33D4X2qvT3c o8g/30G8/r5PkcmRoKa6eHoFCteHl8Voe6jAL0QeIbeue88goY3Bf1xemQlyU9uF2d0E vDGLwXzjyLD/IzQX8WE9zcjHC71qbpOpMSrvXicSnIcRC8aLhpDsl0lg52nrITAJ6T1w 1/mg== 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=m9S9oiKHdjgiNMZJNPKHWcuMFI+a61OHn9ze1nelpJ4=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=PRb0xuGESA/jJrmzdTwJLIwAN9k7Y42aLw46yOBHRh3RDBzLnvlpODoVFMdZxFvM8q Phms2Tq28PWddhv07VmXsVWd8pmW7+g3I9CxDuAaHjigHMFR0GITMM8+eGb8R+tG/yZp 4CttfvkkKTlPfct/mtqbqfMph1ZJCwAwwmSTQQtApKviRsmg2Ekv5eEJ1NddHgpuM99r 8yue96tHq4wrr74XoDLBCjzO/U5LHBaBikr3WPZ5q2hV4kEV3QbYApgOVBuQiAsNo7Rw DmHnvhduU4VX0wRTLTFg9CGLX3z9ZXdB+lJyFWNQO8pO2y/a5m6YsMiA8tnTyK5SpHlY EFag==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=aDHn0rBW; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=LWjQ2bG1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=KJmy+9pp; 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 006d021491bc7-65782b7856fsi2726283eaf.147.2025.11.26.03.41.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Nov 2025 03:41:08 -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=aDHn0rBW; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=LWjQ2bG1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=KJmy+9pp; 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=m9S9oiKHdjgiNMZJNPKHWcuMFI+a61OHn9ze1nelpJ4=; b=aDHn0rBW/c/zs9S/9oqgo2H7lC 7PFkMsqzUbXz2dzCPZ3vds7WxRPBGWkoIaWLOc6O0eL/VjDtku+FHefWcG1u3G5M9S+jCa1h0sIZx 31Wd/qF7cYrHlf/AAfItw+lxJev8iHAcyqhumDEBsTvh5WU/C7odUM1aVZ/JwocR6Bhs=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vODtQ-0007xg-Fv; Wed, 26 Nov 2025 11:41:05 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vODtP-0007xC-EG for openvpn-devel@lists.sourceforge.net; Wed, 26 Nov 2025 11:41:04 +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=L6fzXs5xeEzJx4hXIY3D2p5lOG8v8Vbm977r6HwijGg=; b=LWjQ2bG1woI1cHjaorbcTj5w7P HG6DybsN9WHjQe3F7l51+02lP3wwtFTDvh721ANNZxfnLBJWUHp+4t0leMrzxUX0UGRQgxNjWPvdc hD/41JCijqMEToWnrSSnpazvj6FNGgiLY9P0XAnyIVPr2Em4TeGXaQL/jB7iJRhlclkU=; 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=L6fzXs5xeEzJx4hXIY3D2p5lOG8v8Vbm977r6HwijGg=; b=KJmy+9pppGchV+afAZ9M+WbhDO h6PtwmOkrmnf0IJj3NYWVbnwRGVzPMGzS2PghiF1J9jd0jUT4mX4XubGykWZPKg4P45S2G6hag+mj pJ3NQM9PqOk8Kmz+lLETizIIlkgXxtu3znxfCyowAx9H4wgxJEpioFBC6W2b+NuAlts4=; Received: from [193.149.48.134] (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 1vODtM-0003k8-8s for openvpn-devel@lists.sourceforge.net; Wed, 26 Nov 2025 11:41:01 +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 5AQBemIX010295 for ; Wed, 26 Nov 2025 12:40:48 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5AQBemOY010294 for openvpn-devel@lists.sourceforge.net; Wed, 26 Nov 2025 12:40:48 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 26 Nov 2025 12:40:40 +0100 Message-ID: <20251126114047.10280-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.51.2 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: Frank Lichtenheld We only check for < 0 so no reason not to allow bigger signed values. This makes it easier to feed result values of read/write to it. Fixes a conversion warning in process_outgoing_tun. 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: 1vODtM-0003k8-8s Subject: [Openvpn-devel] [PATCH v4] error: Allow status argument to check_status to be ssize_t 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?1849852971846990485?= X-GMAIL-MSGID: =?utf-8?q?1849852971846990485?= From: Frank Lichtenheld We only check for < 0 so no reason not to allow bigger signed values. This makes it easier to feed result values of read/write to it. Fixes a conversion warning in process_outgoing_tun. Also changes register_activity to int64_t for similar reasons. Change-Id: I750a46246c0d2447a6691e5c25c4732e3d335a63 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1357 --- 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/+/1357 This mail reflects revision 4 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/error.c b/src/openvpn/error.c index bd588d4..83eb9eb 100644 --- a/src/openvpn/error.c +++ b/src/openvpn/error.c @@ -621,14 +621,14 @@ * from the OS. */ void -x_check_status(int status, const char *description, struct link_socket *sock, struct tuntap *tt) +x_check_status(ssize_t status, const char *description, struct link_socket *sock, struct tuntap *tt) { const char *extended_msg = NULL; bool crt_error = false; int my_errno = openvpn_errno_maybe_crt(&crt_error); - msg(x_cs_verbose_level, "%s %s returned %d", + msg(x_cs_verbose_level, "%s %s returned %zd", sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "", description, status); if (status < 0) diff --git a/src/openvpn/error.h b/src/openvpn/error.h index 2913498..3088dbb 100644 --- a/src/openvpn/error.h +++ b/src/openvpn/error.h @@ -307,11 +307,11 @@ void set_check_status(unsigned int info_level, unsigned int verbose_level); -void x_check_status(int status, const char *description, struct link_socket *sock, +void x_check_status(ssize_t status, const char *description, struct link_socket *sock, struct tuntap *tt); static inline void -check_status(int status, const char *description, struct link_socket *sock, struct tuntap *tt) +check_status(ssize_t status, const char *description, struct link_socket *sock, struct tuntap *tt) { if (status < 0 || check_debug_level(x_cs_verbose_level)) { diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index f01fb4c..e592eb5 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1673,6 +1673,10 @@ #undef MAX_ICMPV6LEN } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + void process_ip_header(struct context *c, unsigned int flags, struct buffer *buf, struct link_socket *sock) @@ -1915,7 +1919,7 @@ /* * Write to TUN/TAP device. */ - int size; + ssize_t size; #ifdef LOG_RW if (c->c2.log_rw) @@ -1956,7 +1960,7 @@ if (size != BLEN(&c->c2.to_tun)) { msg(D_LINK_ERRORS, - "TUN/TAP packet was destructively fragmented on write to %s (tried=%d,actual=%d)", + "TUN/TAP packet was destructively fragmented on write to %s (tried=%d,actual=%zd)", c->c1.tuntap->actual_name, BLEN(&c->c2.to_tun), size); } @@ -1977,10 +1981,6 @@ buf_reset(&c->c2.to_tun); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - void pre_select(struct context *c) { diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h index a575faf..3cd710e 100644 --- a/src/openvpn/forward.h +++ b/src/openvpn/forward.h @@ -343,7 +343,7 @@ } static inline void -register_activity(struct context *c, const int size) +register_activity(struct context *c, const int64_t size) { if (c->options.inactivity_timeout) {