From patchwork Tue Nov 11 15:48:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4577 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:33c4:b0:7b1:439f:bdf with SMTP id u4csp1972153maf; Tue, 11 Nov 2025 07:49:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUAQ1n/c3ZpG6aZhoIZoRGE9bxriojGCQddHco6PIP+ZkOCKIiVSwCcx9wn6VlGMbwl6feSjqmGPD4=@openvpn.net X-Google-Smtp-Source: AGHT+IFkCD+CGTop31RJOBnmfqcK1tXxjPDNOH7y+70iP1fKVFF6S33CFNg7at/F0ZWitoQhXH6A X-Received: by 2002:a05:6808:80a6:b0:450:5ca:5170 with SMTP id 5614622812f47-4502a48cac8mr5707479b6e.33.1762876145454; Tue, 11 Nov 2025 07:49:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762876145; cv=none; d=google.com; s=arc-20240605; b=gHJCDRxMzyjYdabNKpjWFLDYhwLYmp24zOOTg9b8Axz7HwKRlHK68GTH8zEd8oFRCf vcgAQ0b+hIs2RBWpKNbchvpUyyMeGiVMoHxBsxPe5IY8D0aVKDR5fKQDMBvEwIKazxGQ /W7I2C/FBledPyc1YiCob2Jux4vUGmFiCAxeBGvWot8WF/fFBDG9B+xjF0xfmcDfHLe2 0L3klGC6n4K/AuliZJetVvJDlx/YFxDSHGixv/5y1f8UsQF2uGD++bVDzFtBlBVtSbSC zzaPQe6a300MuUACy8GKn9D2C7uR/oa9pPRfr8r4d4u5q2tFGADczrlP8hNzSbIWwkxe 9FAQ== 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=5z6kQk291/U7Fp5eMoYeh+tgD8FzMbVhCt+RKLBIqY8=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=JcyskqF0WBobTm8VJlqV57quTt6cR24qiSdU29GNrAaygcPkP56rEpp7NlQoL23zac 49jgRCS6oQBGw3s3Mm4JwqUtCEALZaRjXCKPHPWgjn4A1xqTUoJvqD36m7BLhY3pjQQh yVtyliFThXjjJDy4NHQqb6clAdNgqoXoWik1HyrdSr8TDQwq8vp/yPCI7yk596NbovOS E5rT+ClxwfgnmiPw6C9BH7ncB0efHYQGT0Xu9xY9qFhf2jSgDO9bPa2ThJjuMjnmZRaU OHJGwHgPZyvKgMKqfGnOpkSneGfD9XHrP9rdt3IrD3T+SdvmnBFcTdXEsIc3yhDsZmn1 iifA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=QrhbGLpA; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=jpbHDYJW; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=lsEif8o9; 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-450029734acsi5590171b6e.222.2025.11.11.07.49.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Nov 2025 07:49:05 -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=QrhbGLpA; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=jpbHDYJW; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=lsEif8o9; 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=5z6kQk291/U7Fp5eMoYeh+tgD8FzMbVhCt+RKLBIqY8=; b=QrhbGLpA5Ban8j6PxY6pd/k96X cfuP4V6cAD9mt3bybkWoWJMSdw49dl+RW2lytE4hYQu27zeBj5Y379f3UxSDLTyKZ+muwSKHV5y3P YIPUJiAE5jbXyKb2aFAxaWVH3OWoTa0wT/zRP5ft0NNQ4Q27R+e+8GUlyctbmUV7UotA=; 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 1vIqcA-0002CO-6K; Tue, 11 Nov 2025 15:49:02 +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 1vIqc9-0002C8-5b for openvpn-devel@lists.sourceforge.net; Tue, 11 Nov 2025 15:49:01 +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=NHVFYvwFilhFLgXseETNXlxZzRdeipbBizMF+FqsT40=; b=jpbHDYJWd8TLxscHpVtn3pllzO P4uTbhNzkEe3jT16tx6DY3uRs+GdLgeEtd3rM9HZZfnKodnu6TvBixtaJ++Hi0RT9BYOTtpfJtrul GNzRjMj/crV19PPa/bq7WPt5KaWCKZibRyYI16/m+ii2O+kbHd5ZK6qKKvaSQVoEb1ZQ=; 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=NHVFYvwFilhFLgXseETNXlxZzRdeipbBizMF+FqsT40=; b=lsEif8o9UGBYTWFgibnFENErUC Aliun51dgISRAcyJgRjj8hGcK1vpEjmUQXMZ2+/CtS/Azm37IyvHMEjwrPvg2+dHixnCytQMYEAG2 A/HX+xXbGnkWf+h1vE0sbDH2oICKdU8RLn/TmYh64Jz5jwVL57GPf4ucNm82DGsiIlxw=; 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 1vIqc6-00064n-Au for openvpn-devel@lists.sourceforge.net; Tue, 11 Nov 2025 15:49: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 5ABFmkxX031376 for ; Tue, 11 Nov 2025 16:48:46 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5ABFmk1T031375 for openvpn-devel@lists.sourceforge.net; Tue, 11 Nov 2025 16:48:46 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 11 Nov 2025 16:48:39 +0100 Message-ID: <20251111154846.31360-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 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 Removes a few smaller instances: - Fix return type check for socket() on Windows/Unixy - Ignore a few instances related to WSAWaitForMultipleEvents. The compiler says the check is currently useless, 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: 1vIqc6-00064n-Au Subject: [Openvpn-devel] [PATCH v6] Enable -Wtype-limits by default (via -Wextra) 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?1848509617134175557?= X-GMAIL-MSGID: =?utf-8?q?1848509617134175557?= From: Frank Lichtenheld Removes a few smaller instances: - Fix return type check for socket() on Windows/Unixy - Ignore a few instances related to WSAWaitForMultipleEvents. The compiler says the check is currently useless, but we follow the API documentation. Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871 Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1207 --- 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/+/1207 This mail reflects revision 6 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe diff --git a/CMakeLists.txt b/CMakeLists.txt index c9301e6..e812145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,7 @@ check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) add_compile_options(-Wconversion -Wno-sign-conversion) - add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + add_compile_options(-Wextra -Wno-sign-compare -Wno-unused-parameter) # clang doesn't have the different levels but also doesn't include it in -Wextra check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) if (WIN32) diff --git a/configure.ac b/configure.ac index 3117e13..f6e4b6d 100644 --- a/configure.ac +++ b/configure.ac @@ -1410,7 +1410,7 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wconversion -Wno-sign-conversion]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) -ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-parameter]) # clang doesn't have the different levels but also doesn't include it in -Wextra ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) if test "${WIN32}" = "yes"; then diff --git a/src/openvpn/event.c b/src/openvpn/event.c index ca84d19..ca2d0c1 100644 --- a/src/openvpn/event.c +++ b/src/openvpn/event.c @@ -410,6 +410,13 @@ } #endif + /* WSA_WAIT_EVENT_0 == 0 but the API documentation is written in a way + that doesn't guarantee that. So we make useless checks. */ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif + /* * First poll our event list with 0 timeout */ @@ -474,6 +481,9 @@ return -1; } } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } static struct event_set * diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 8eac96d..f7317d1 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -577,7 +577,8 @@ ASSERT(addrinfo); ASSERT(addrinfo->ai_socktype == SOCK_STREAM); - if ((sd = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) < 0) + if ((sd = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + == SOCKET_UNDEFINED) { msg(M_ERR, "Cannot create TCP socket"); } @@ -608,7 +609,8 @@ ASSERT(addrinfo); ASSERT(addrinfo->ai_socktype == SOCK_DGRAM); - if ((sd = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) < 0) + if ((sd = socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinfo->ai_protocol)) + == SOCKET_UNDEFINED) { msg(M_ERR, "UDP: Cannot create UDP/UDP6 socket"); }