From patchwork Fri Mar 6 16:29:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4804 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7001:a68f:b0:83c:d90d:321 with SMTP id wf15csp1672929mab; Fri, 6 Mar 2026 08:29:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVk7NcXbxwk4yWm75QvDex/Hht7dzy1XTcwRA9nmV2T6lJBr4hPqL3KC6RNR32u9nbGToWnzdMmspQ=@openvpn.net X-Received: by 2002:a05:6870:1411:b0:404:3055:cb82 with SMTP id 586e51a60fabf-416e4e37257mr1533214fac.25.1772814577973; Fri, 06 Mar 2026 08:29:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772814577; cv=none; d=google.com; s=arc-20240605; b=G90mc+cPVKEJbWqPMLwFO7wNsKkIZjkro9cA5ECue57ttLKe6yphBa5ABF8B+0T41O 391Lq2QBeyp5iv2Rkfas1EvGxbxo4vPWequC/njFV8p7TKwzaEAlMUXlinZf5LRLx/7w f93OVhm9Qq44qxd/a/BDz+SKNA/dLR5XILRM8w/JnTcN/9+oh/Iy3Usbn9fyf3mBkDWo BjCgPhQekaMEw3EUkV6DNRUAcPdkItCWOokeKrH2GJYHJVNPWtuGQ5hJMVLgeUy6qkzZ E4RQLYsHHR1H6TzEYa8NIfuQU/OPLh9MGF2i1CsYO8BFAwTPBgjzfBNH9QuZRPGbYYvV fJ4Q== 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=VWYy89hjbP5VHndXBUU3AqOZypWzpRYaYWSQ5BwocBc=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=dGCHYO5os2DaDXzodfifa0MdbIpQRplngZ0REn5KNEamJAzCKtZnSV71altXz8vEH9 lniDndd0FVgROJrCoXKvr+nXs+IKxwqQY5jZsOPbQqXQH5xuCx+lxxba7VpEkdeqldZk CkA4iejZnhDrytfzE+/cWrBRAShl5VYQUUZhURq3IumwISabTtJ3dGacSxwHJ39N/miA WbISTSCUZpAIvO1n4JGxQ+d7+TwIvf0fQKEOwLXOQoEsb6LqHraeXxQZKgtglOKq/3pB zal8RhRAnGVcert+SuHmUaHFX/c9+3FLAPjrXYZe54BAyNdU0MVZh3XuW0JY3SjeyRXW X6Vg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="kRWyIbc/"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=EENmwLU1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cWNFurjB; 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-416e68027c0si1509359fac.223.2026.03.06.08.29.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2026 08:29:37 -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="kRWyIbc/"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=EENmwLU1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cWNFurjB; 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=VWYy89hjbP5VHndXBUU3AqOZypWzpRYaYWSQ5BwocBc=; b=kRWyIbc/Ut67y99pTMZwlumWoX 0kKr/RZelq9HocTpCZTVUVRB9FvexgscjZMONFEJjsEspVx0ed2Swwv5p2WCql918ZH8DXyNM1UIK VrGeFGs/OgFgIEjuCUE6aKwEQCn9/Qx1gIyA5hKjlx5PJEjVtTwh9e2zpd08YPUNu92U=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vyY3T-0002xf-Qr; Fri, 06 Mar 2026 16:29:35 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vyY3R-0002xY-Mo for openvpn-devel@lists.sourceforge.net; Fri, 06 Mar 2026 16:29:33 +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=6kFU5Mt2ymIiVLhfYwWSyEQZP7HgGf+iFnwdUlt/u+g=; b=EENmwLU1aqDfySsZn39iPKy2X7 gGifwzySmlEaxCG8SADzaqTolsPMR4xS3Eqm8Be7Pf6xjU7iY9pXbsSmAMlmgJiP+k51Nm3FDGzvV Wk7GKtngB//uTMeOXCSxMGpaOx7/4EHGlZewyFK8VcbX7f5ikklIq5VlSo4DSzuofoCM=; 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=6kFU5Mt2ymIiVLhfYwWSyEQZP7HgGf+iFnwdUlt/u+g=; b=cWNFurjBb7Vq+6vNNfE5dOSBv4 pJ44rYv5H4yrgBgiEGNDv6+qrs+2Rk+o2z6y079+oPBGeLTs14EZ6DnMHkRpewq0KCJuuj0eLz4TK Irbt/6SAwYZbVjyXJdIpgYSB5u2+jz7Km94RT/OU2ppofhnxk/1Pb2Aa7Lk04MWxJ5tM=; 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 1vyY3Q-0005tr-PY for openvpn-devel@lists.sourceforge.net; Fri, 06 Mar 2026 16:29:33 +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 626GTPFB002378 for ; Fri, 6 Mar 2026 17:29:25 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 626GTPaF002377 for openvpn-devel@lists.sourceforge.net; Fri, 6 Mar 2026 17:29:25 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 6 Mar 2026 17:29:19 +0100 Message-ID: <20260306162925.2359-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: Frank Lichtenheld Just use the same type that the other values already have. While here review and remove some other useless casts in msg() calls. 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: 1vyY3Q-0005tr-PY Subject: [Openvpn-devel] [PATCH v3] tun: Avoid sign-compare issues in tun_read_queue 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?1858930818934754684?= X-GMAIL-MSGID: =?utf-8?q?1858930818934754684?= From: Frank Lichtenheld Just use the same type that the other values already have. While here review and remove some other useless casts in msg() calls. Change-Id: Ifc7ad2407b9cca8cfcef79d7392a058735416139 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1525 --- 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/+/1525 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 8105db2..f46802f 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -3264,24 +3264,18 @@ #elif defined(_WIN32) -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif - int tun_read_queue(struct tuntap *tt, int maxsize) { if (tt->reads.iostate == IOSTATE_INITIAL) { - DWORD len; BOOL status; int err; /* reset buf to its initial state */ tt->reads.buf = tt->reads.buf_init; - len = maxsize ? maxsize : BLEN(&tt->reads.buf); + int len = maxsize ? maxsize : BLEN(&tt->reads.buf); ASSERT(len <= BLEN(&tt->reads.buf)); /* the overlapped read will signal this event on I/O completion */ @@ -3298,8 +3292,8 @@ tt->reads.iostate = IOSTATE_IMMEDIATE_RETURN; tt->reads.status = 0; - dmsg(D_WIN32_IO, "WIN32 I/O: TAP Read immediate return [%d,%d]", (int)len, - (int)tt->reads.size); + dmsg(D_WIN32_IO, "WIN32 I/O: TAP Read immediate return [%d,%lu]", len, + tt->reads.size); } else { @@ -3308,7 +3302,7 @@ { tt->reads.iostate = IOSTATE_QUEUED; tt->reads.status = err; - dmsg(D_WIN32_IO, "WIN32 I/O: TAP Read queued [%d]", (int)len); + dmsg(D_WIN32_IO, "WIN32 I/O: TAP Read queued [%d]", len); } else /* error occurred */ { @@ -3316,7 +3310,7 @@ ASSERT(SetEvent(tt->reads.overlapped.hEvent)); tt->reads.iostate = IOSTATE_IMMEDIATE_RETURN; tt->reads.status = err; - dmsg(D_WIN32_IO, "WIN32 I/O: TAP Read error [%d] : %s", (int)len, + dmsg(D_WIN32_IO, "WIN32 I/O: TAP Read error [%d] : %s", len, strerror_win32(status, &gc)); gc_free(&gc); } @@ -3353,8 +3347,8 @@ tt->writes.status = 0; - dmsg(D_WIN32_IO, "WIN32 I/O: TAP Write immediate return [%d,%d]", BLEN(&tt->writes.buf), - (int)tt->writes.size); + dmsg(D_WIN32_IO, "WIN32 I/O: TAP Write immediate return [%d,%lu]", BLEN(&tt->writes.buf), + tt->writes.size); } else { @@ -5447,14 +5441,14 @@ if (DeviceIoControl(tt->hand, TAP_WIN_IOCTL_GET_VERSION, &info, sizeof(info), &info, sizeof(info), &len, NULL)) { - msg(D_TUNTAP_INFO, "TAP-Windows Driver Version %d.%d %s", (int)info[0], (int)info[1], + msg(D_TUNTAP_INFO, "TAP-Windows Driver Version %lu.%lu %s", info[0], info[1], (info[2] ? "(DEBUG)" : "")); } if (!(info[0] == TAP_WIN_MIN_MAJOR && info[1] >= TAP_WIN_MIN_MINOR)) { msg(M_FATAL, "ERROR: This version of " PACKAGE_NAME - " requires a TAP-Windows driver that is at least version %d.%d -- If you recently upgraded your " PACKAGE_NAME + " requires a TAP-Windows driver that is at least version %u.%u -- If you recently upgraded your " PACKAGE_NAME " distribution, a reboot is probably required at this point to get Windows to see the new driver.", TAP_WIN_MIN_MAJOR, TAP_WIN_MIN_MINOR); } @@ -5465,8 +5459,8 @@ if (tt->type == DEV_TYPE_TUN && info[0] == 9 && info[1] < 8) { msg(M_INFO, - "WARNING: Tap-Win32 driver version %d.%d does not support IPv6 in TUN mode. IPv6 will not work. Upgrade your Tap-Win32 driver.", - (int)info[0], (int)info[1]); + "WARNING: Tap-Win32 driver version %lu.%lu does not support IPv6 in TUN mode. IPv6 will not work. Upgrade your Tap-Win32 driver.", + info[0], info[1]); } /* tap driver 9.8 (2.2.0 and 2.2.1 release) is buggy @@ -5474,8 +5468,7 @@ if (tt->type == DEV_TYPE_TUN && info[0] == 9 && info[1] == 8) { msg(M_FATAL, - "ERROR: Tap-Win32 driver version %d.%d is buggy regarding small IPv4 packets in TUN mode. Upgrade your Tap-Win32 driver.", - (int)info[0], (int)info[1]); + "ERROR: Tap-Win32 driver version 9.8 is buggy regarding small IPv4 packets in TUN mode. Upgrade your Tap-Win32 driver."); } } @@ -5487,7 +5480,7 @@ if (DeviceIoControl(tt->hand, TAP_WIN_IOCTL_GET_MTU, &mtu, sizeof(mtu), &mtu, sizeof(mtu), &len, NULL)) { - msg(D_MTU_INFO, "TAP-Windows MTU=%d", (int)mtu); + msg(D_MTU_INFO, "TAP-Windows MTU=%lu", mtu); } } @@ -5608,10 +5601,6 @@ gc_free(&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - static void tuntap_set_connected(const struct tuntap *tt) {