From patchwork Fri Nov 7 17:48:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4572 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:d11a:b0:7b1:1082:6501 with SMTP id lw26csp683240mab; Fri, 7 Nov 2025 09:48:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWhd7BAM4lTtyR8jjznatptCQsR2hZfhHD3bHGCWHbcJ4bMd/zYwKvrrfFY3Bv/sZ5tMxBzsCVcLQw=@openvpn.net X-Google-Smtp-Source: AGHT+IG6bJVPPxO7HCmWJaSkHLDEFOmJwM+0dQrb68J6+ludM3MBhx3eN2/dmbr5BwPqXJfGBva0 X-Received: by 2002:a05:6871:2b0c:b0:3e0:ffcb:2f84 with SMTP id 586e51a60fabf-3e7c289ea78mr170451fac.28.1762537707656; Fri, 07 Nov 2025 09:48:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1762537707; cv=none; d=google.com; s=arc-20240605; b=buf0k8RlgO4Y25XAQUa31USs0HeEWt21zjUIX1+6bGo/++obH3YOyBwRLMLXX40QJr PVTuHvfP+imhS1VqXt4Tx4fOxNK6qMD2x25fQ+jELLmwslXKW6nYquk3iyOFw7aZqLbh pZnkq3kcWzl8q3uO9khUNF7jaAmWgkUxZ7jeIbeOszGwOQEl1sRknzMeU0WI61LCq2V2 tKoZzLBPs5/xv5IGgWj9ot9HP3Vakq3GMDALAkVUzLPDGMFLymxAuQYiHMWuUnhgb1m6 Txo1ruLUBRhhkp4XPZaAptwP5Y7GfZ9REZ/qn/vH7x7gIjHuzE115btZQ4tw94k+DD5x 7AGw== 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=/KgJ2QOUw4cLuQHiq3p/+/YB2eVc/qw34Fomz6q7jSk=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=S1whlOylM9uBPViZ8TLTUgT3IktNkxDk8PcV7LHeHy20oK2+9wDJJfHaThAg2hPyZb 4enNblIiA/vq/kNyLt2zSUHp0auZZVT4qGczky9Z9J+N8sco8yYjS2MhzGK2/19FDcVi CbXoAjP68vJJdyFtEtlZmP0xPTekSW2wA3WFm/3QQfHyRJvlukIwNwzCHoVQTZd37dVt h4TKH/3srkQus0OmLgFOnKltqNvX8QYsX2TTWJ1MbTAWQWb4J6rkeT7yq0+gGYFGOzpe 3Ahug+tfNENvX0/uNmeQIvD/fdWo/KWU4alu49Kp9sDb/EMN8Hy6pWCiO4vWd/yOFwcY UVqA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=gbifOq0L; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="VvU5zh/4"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=XrfOTF9F; 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-3e41ed0aa2asi1423104fac.107.2025.11.07.09.48.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Nov 2025 09:48:27 -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=gbifOq0L; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="VvU5zh/4"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=XrfOTF9F; 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=/KgJ2QOUw4cLuQHiq3p/+/YB2eVc/qw34Fomz6q7jSk=; b=gbifOq0L6+kMKiZW30Ut+FazIV pDUZA7eE7cPBosnt+4UCJy+HvgLMlzZIQo47DhBH+yoP4FuUrYtyD6MtN9D2iUSv2XhvqrZAlJNPg kTUtuA5ioGpOd84/NMy+6FL1GfuhmRbpuGG3MA8zcRbR7ejoPEnL1BCxHLndtONys/is=; 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 1vHQZP-0000jg-GI; Fri, 07 Nov 2025 17:48:20 +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 1vHQZO-0000jS-Jc for openvpn-devel@lists.sourceforge.net; Fri, 07 Nov 2025 17:48:19 +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=dBnMcQRKyWPcMxOHFhScehoQg5HDLso9yRGqS83h4yc=; b=VvU5zh/4Cv88UIICdUMDvUKT9f b+Qb2LEHibAeyZszTekeEzYeyntxwaeMs3jneEpsmjSXeCTx4amcrBRkErLEX9XxcVqu187jfF3aF 2Ho3jiG+6WT40ibm12gUk8VfwPJ0LXN1Eb8Ov7J/PX8blG8kmg0WrkbC9SEb924UzcD0=; 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=dBnMcQRKyWPcMxOHFhScehoQg5HDLso9yRGqS83h4yc=; b=XrfOTF9Fl6V28Bxv6B0C+xAFpM lSYXsJkxw1S3Wh/3lHYhCRzc021z1lfGybhW9/9YscyQiFuzSS7x3vBSGs6TTe7a+fKpK2mslAfkZ YGWfUAeveaNrppF91WA+fgQLQ5S5HPj8f57+uYILMrVbnjfHODz39pTGPd4MM3LydU3c=; 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 1vHQZO-0001qZ-8w for openvpn-devel@lists.sourceforge.net; Fri, 07 Nov 2025 17:48:19 +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 5A7HmBHK031868 for ; Fri, 7 Nov 2025 18:48:11 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5A7HmB5r031866 for openvpn-devel@lists.sourceforge.net; Fri, 7 Nov 2025 18:48:11 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 7 Nov 2025 18:48:05 +0100 Message-ID: <20251107174810.31851-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-1.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: Fix all nvlist_get_number() related warnings by explicitly casting - these are all messages coming from DCO, which we trust in this (nothing will crash if a number is truncated, just "things will not [...] 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: 1vHQZO-0001qZ-8w Subject: [Openvpn-devel] [PATCH v1] dco_freebsd.c: fix integer warnings 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?1848154739370041802?= X-GMAIL-MSGID: =?utf-8?q?1848154739370041802?= Fix all nvlist_get_number() related warnings by explicitly casting - these are all messages coming from DCO, which we trust in this (nothing will crash if a number is truncated, just "things will not work correctly"). Remove #pragmas. Change-Id: Ief19ba87b0832baa6530ea8bf039d85115434e3e Signed-off-by: Gert Doering Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1361 --- 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/+/1361 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index 21f0ac0..f2a89ac 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -72,11 +72,6 @@ return (nvl); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static bool nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *ss) { @@ -93,7 +88,7 @@ return (false); } - ss->ss_family = nvlist_get_number(nvl, "af"); + ss->ss_family = (unsigned char)nvlist_get_number(nvl, "af"); switch (ss->ss_family) { @@ -107,7 +102,7 @@ data = nvlist_get_binary(nvl, "address", &len); ASSERT(len == sizeof(in->sin_addr)); memcpy(&in->sin_addr, data, sizeof(in->sin_addr)); - in->sin_port = nvlist_get_number(nvl, "port"); + in->sin_port = (in_port_t)nvlist_get_number(nvl, "port"); break; } @@ -121,11 +116,11 @@ data = nvlist_get_binary(nvl, "address", &len); ASSERT(len == sizeof(in6->sin6_addr)); memcpy(&in6->sin6_addr, data, sizeof(in6->sin6_addr)); - in6->sin6_port = nvlist_get_number(nvl, "port"); + in6->sin6_port = (in_port_t)nvlist_get_number(nvl, "port"); if (nvlist_exists_number(nvl, "scopeid")) { - in6->sin6_scope_id = nvlist_get_number(nvl, "scopeid"); + in6->sin6_scope_id = (uint32_t)nvlist_get_number(nvl, "scopeid"); } break; } @@ -614,9 +609,12 @@ return -EINVAL; } - dco->dco_message_peer_id = nvlist_get_number(nvl, "peerid"); + /* dco_message_peer_id is signed int, because other parts of the + * code treat "-1" as "this is a message not specific to one peer" + */ + dco->dco_message_peer_id = (int)nvlist_get_number(nvl, "peerid"); - type = nvlist_get_number(nvl, "notification"); + type = (enum ovpn_notif_type)nvlist_get_number(nvl, "notification"); switch (type) { @@ -625,7 +623,7 @@ if (nvlist_exists_number(nvl, "del_reason")) { - uint32_t reason = nvlist_get_number(nvl, "del_reason"); + uint32_t reason = (uint32_t)nvlist_get_number(nvl, "del_reason"); if (reason == OVPN_DEL_REASON_TIMEOUT) { dco->dco_del_peer_reason = OVPN_DEL_PEER_REASON_EXPIRED; @@ -869,7 +867,7 @@ for (size_t i = 0; i < npeers; i++) { const nvlist_t *peer = nvpeers[i]; - uint32_t peerid = nvlist_get_number(peer, "peerid"); + uint32_t peerid = (uint32_t)nvlist_get_number(peer, "peerid"); const nvlist_t *bytes = nvlist_get_nvlist(peer, "bytes"); /* we can end here in p2mp mode, or in p2p mode via @@ -890,10 +888,6 @@ return 0; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /* get stats for a single peer * we can get here for "the peer stats" in p2p client mode, or by * being queried for a particular peer in p2mp mode, for --inactive