From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=SFgQhC+7; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id E479D5A0265 for ; Tue, 10 Mar 2026 05:16:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1773116167; bh=e6JbYcheC23YgVfAYVWfwxNuHocYr40P5qZ7nrJWbI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SFgQhC+7zNBCyGQk5PnQ1TuHkdhG3pZuVmPgtwbTxs02CcMV0d9O3cG3zuuPMNH3n Ej4r14gTB2YVf6dOXX2sgodPWBBoUxl+4HZbOfet4+9HfxSXHj6Vx0Jfz9e5PxHGXA cCNv+hSCqNYSJTTL8rKR+HvSt5txaEIv8IKzSVNXmG63o1UuAqqT0tL3qFLIG3oDJe UClponzKOaIaxmQviiev+1Am4pgc5e5C5/xk32RsHOMFpvxsXJ5D9G3sa+K5IACMDd g+pmsYdowK7Py9xyICDmo3zjcC4Gy/q7KgUQ+HedCezHfuyqN0B8+TUqy33Icx1/h7 TmaHDtuBi8e0A== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fVLCq5jllz4wHY; Tue, 10 Mar 2026 15:16:07 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 3/6] fwd: Don't initialise unused port bitmaps Date: Tue, 10 Mar 2026 15:16:02 +1100 Message-ID: <20260310041605.1322552-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260310041605.1322552-1-david@gibson.dropbear.id.au> References: <20260310041605.1322552-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: K4EQDXLUUAFY63OE4HVBG3Y6CADATEAJ X-Message-ID-Hash: K4EQDXLUUAFY63OE4HVBG3Y6CADATEAJ X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Since b223bec48213 ("fwd, tcp, udp: Set up listening sockets based on forward table"), the 'map' field of struct fwd_ports has only been used for forwarding rules with the FWD_SCAN bit, where it is initialised from a port scan. However, we still pointlessly initialise it for rules with !FWD_SCAN. Remove the unneeded code. Fixes: b223bec48213 ("fwd, tcp, udp: Set up listening sockets based on forward table") Signed-off-by: David Gibson --- fwd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fwd.c b/fwd.c index c5090fb1..9e455094 100644 --- a/fwd.c +++ b/fwd.c @@ -405,13 +405,8 @@ void fwd_rule_add(struct fwd_ports *fwd, uint8_t flags, new->socks = &fwd->socks[fwd->sock_count]; fwd->sock_count += num; - for (port = new->first; port <= new->last; port++) { + for (port = new->first; port <= new->last; port++) new->socks[port - new->first] = -1; - - /* Fill in the legacy forwarding data structures to match the table */ - if (!(new->flags & FWD_SCAN)) - bitmap_set(fwd->map, port); - } } /** -- 2.53.0