From patchwork Mon Dec 15 14:55:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4682 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7001:1490:b0:7b1:439f:bdf with SMTP id bf16csp1867606mac; Mon, 15 Dec 2025 06:55:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXrFWyDwHLJZCOQCs8HMOqQhSbTBMR2tuM7OMdH3bv5EsFIqP/LhhMyRoAcEIBM4VgdezROxE2lUpM=@openvpn.net X-Google-Smtp-Source: AGHT+IFCSojvwxvH2+2SgDYZeYd67f/3O8NDNtXXzsH+oJKXz/Q/G9b4NaoRBFZzP7hjO0L0nMl9 X-Received: by 2002:a05:6820:1344:b0:659:9a49:9062 with SMTP id 006d021491bc7-65b4523c746mr4466042eaf.45.1765810543168; Mon, 15 Dec 2025 06:55:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1765810543; cv=none; d=google.com; s=arc-20240605; b=aLpL77zKnW1Bjm7CkaiwljhQPIol65wsC0P471R76TVZ3qWT6Nh9syMEB318oLEM+n BUDtUojqKICd38oluXZHYChfLaAfoYgazknixwEbnPkjNyHk3J54XOFpFU0ZAlHJLbRq oYXo8G+1udJCDbxMudiYYSg6TDJOXyCsH3C6pkeZbtg2Dkkjq/8mxBHYuk8YKeSvREAc o1ZgxyO1GSLEZL2G8Tx3Hi64mtPKKHkf7enmarL6LyyokuXA3BOE2JqztyPjfA5o1dYt ES9D1vA/s2ib8ActJu7Xz5HzmjAZ52U6fgFiRmrPBUcv6ob4ABOd42FvoEG427kZKkVh OPtA== 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=9rOH1aAc6LHvRdz8TtDqP27o43yTk2/Oh9Oc3zHTJus=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=gK4uFep8ypGA0Ai/9mbrIayZBxoBb55vDOsIryk6dSiT5eYck4kTUtRYbDVpewjna6 nLsBGbjZ199KZbSagy4a5NxssL6xHsbT47sd8qzfpYC+HKbTPlkNYokfJtWKMmn49OJJ VO9eRFMCIBRXMjDQefzBCdOvN4bUZRLyRv2as/T+0LOyVglyeKQkPw5vQ0vPmQEOZmte mO4BZ679jITGmfzY96jedOC5sdPR1DV1jQXf/J2xoELD8l0uKS/cV/Rf5XvO0x9txfow vlHfOTWmVwCLZcgXBlYyQH54VvfplnG0/1HC/cFmfe/ht5StgZ3jXYjyJqEJ3L9s8qc4 9i2A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=FEUPKM7h; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=WuTxZkO+; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=EnM7rdt8; 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-65b3625eb7asi8048291eaf.53.2025.12.15.06.55.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Dec 2025 06:55:43 -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=FEUPKM7h; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=WuTxZkO+; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=EnM7rdt8; 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=9rOH1aAc6LHvRdz8TtDqP27o43yTk2/Oh9Oc3zHTJus=; b=FEUPKM7hn/1O8hRsrHRXIeud9D FD6wvAlgyfaWt2Z3vOLHpRu+MiaH2ZbunFxJ0UB0Ss41/lifb5IhftKFqo0701qnJxryanZJg1e3B OYrnrJ0DYMHnJ2XltdmYc9rkslo/tvWgkYTwr4lDZzFBqs1YvWgsdVyW5QokIziEO9RE=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vV9z8-0008UD-A4; Mon, 15 Dec 2025 14:55:38 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vV9z6-0008U6-QD for openvpn-devel@lists.sourceforge.net; Mon, 15 Dec 2025 14:55:36 +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=oNQLghO9USrcUWfiOVzCYRd2K/sDaKLpuOLdcm0fjU4=; b=WuTxZkO+oO9QK/pA8TTMk20dGv LxDgxmH0/47HwaBbm1lF1lc3zLK+MTcmizLI7qaKGJMWVlpwPZc1kT5779mGeE2JugTe+bKP6SLf1 BjR+C3O2r2Qj7PvXbVyrLiLm3PzwvXIlsXFKT5V/gneG6JUhAfmUms+brEURFYvxa89E=; 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=oNQLghO9USrcUWfiOVzCYRd2K/sDaKLpuOLdcm0fjU4=; b=EnM7rdt8RjtVek0+/f8HyzzevI 0Z87Ssu0A/Wcpf5NVoeNcNlB/QvUivnjDBididhZSLQw+XH7YZCcoiPk43QWCwvQJJJ0qh4xuAFoI T/+gfZg0AajpJ9B9f0nz0VHbIN9bgVn/uBqb9sMXQiWngXcsysjYzdblI4LuO8kNNWf4=; 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 1vV9z5-0001ik-Ty for openvpn-devel@lists.sourceforge.net; Mon, 15 Dec 2025 14:55:36 +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 5BFEtTQa018062 for ; Mon, 15 Dec 2025 15:55:29 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5BFEtTuB018061 for openvpn-devel@lists.sourceforge.net; Mon, 15 Dec 2025 15:55:29 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 15 Dec 2025 15:55:23 +0100 Message-ID: <20251215145528.18047-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-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: From: Frank Lichtenheld Change-Id: Idede28c850def5e3b4a17dcbd0a5771f15cfc668 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/open [...] 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: 1vV9z5-0001ik-Ty Subject: [Openvpn-devel] [PATCH v9] multi: Fix type handling for hashes, mostly inotify_watchers 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?1851586556401669695?= X-GMAIL-MSGID: =?utf-8?q?1851586556401669695?= From: Frank Lichtenheld Change-Id: Idede28c850def5e3b4a17dcbd0a5771f15cfc668 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1312 --- 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/+/1312 This mail reflects revision 9 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index d9cb3a9..20d72c1 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -257,7 +257,7 @@ */ int_hash_function(const void *key, uint32_t iv) { - return (unsigned long)key; + return (uint32_t)(uintptr_t)key; } static bool @@ -295,22 +295,23 @@ * to determine which client sent an incoming packet * which is seen on the TCP/UDP socket. */ - m->hash = hash_init(t->options.real_hash_size, get_random(), mroute_addr_hash_function, - mroute_addr_compare_function); + m->hash = hash_init(t->options.real_hash_size, (uint32_t)get_random(), + mroute_addr_hash_function, mroute_addr_compare_function); /* * Virtual address hash table. Used to determine * which client to route a packet to. */ - m->vhash = hash_init(t->options.virtual_hash_size, get_random(), mroute_addr_hash_function, - mroute_addr_compare_function); + m->vhash = hash_init(t->options.virtual_hash_size, (uint32_t)get_random(), + mroute_addr_hash_function, mroute_addr_compare_function); /* * This hash table is a clone of m->hash but with a * bucket size of one so that it can be used * for fast iteration through the list. */ - m->iter = hash_init(1, get_random(), mroute_addr_hash_function, mroute_addr_compare_function); + m->iter = hash_init(1, (uint32_t)get_random(), mroute_addr_hash_function, + mroute_addr_compare_function); #ifdef ENABLE_MANAGEMENT m->cid_hash = hash_init(t->options.real_hash_size, 0, cid_hash_function, cid_compare_function); @@ -321,8 +322,8 @@ * Mapping between inotify watch descriptors and * multi_instances. */ - m->inotify_watchers = - hash_init(t->options.real_hash_size, get_random(), int_hash_function, int_compare_function); + m->inotify_watchers = hash_init(t->options.real_hash_size, (uint32_t)get_random(), + int_hash_function, int_compare_function); #endif /* @@ -609,7 +610,7 @@ #ifdef ENABLE_ASYNC_PUSH if (mi->inotify_watch != -1) { - hash_remove(m->inotify_watchers, (void *)(unsigned long)mi->inotify_watch); + hash_remove(m->inotify_watchers, (void *)(uintptr_t)mi->inotify_watch); mi->inotify_watch = -1; } #endif @@ -2821,7 +2822,7 @@ msg(D_MULTI_DEBUG, "MULTI: modified fd %d, mask %d", pevent->wd, pevent->mask); struct multi_instance *mi = - hash_lookup(m->inotify_watchers, (void *)(unsigned long)pevent->wd); + hash_lookup(m->inotify_watchers, (void *)(uintptr_t)pevent->wd); if (pevent->mask & IN_CLOSE_WRITE) { @@ -2840,7 +2841,7 @@ /* this event is _always_ fired when watch is removed or file is deleted */ if (mi) { - hash_remove(m->inotify_watchers, (void *)(unsigned long)pevent->wd); + hash_remove(m->inotify_watchers, (void *)(uintptr_t)pevent->wd); mi->inotify_watch = -1; } } @@ -2978,14 +2979,14 @@ const char *file) { /* watch acf file */ - long watch_descriptor = inotify_add_watch(inotify_fd, file, IN_CLOSE_WRITE | IN_ONESHOT); + int watch_descriptor = inotify_add_watch(inotify_fd, file, IN_CLOSE_WRITE | IN_ONESHOT); if (watch_descriptor >= 0) { if (mi->inotify_watch != -1) { - hash_remove(m->inotify_watchers, (void *)(unsigned long)mi->inotify_watch); + hash_remove(m->inotify_watchers, (void *)(uintptr_t)mi->inotify_watch); } - hash_add(m->inotify_watchers, (const uintptr_t *)watch_descriptor, mi, true); + hash_add(m->inotify_watchers, (void *)(uintptr_t)watch_descriptor, mi, true); mi->inotify_watch = watch_descriptor; } else