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=Smt1uzLp; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id B7A7B5A0619 for ; Wed, 11 Mar 2026 13:03:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1773230596; bh=e6JbYcheC23YgVfAYVWfwxNuHocYr40P5qZ7nrJWbI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Smt1uzLpfuqwOhvEyUB6vqYy/dro9S87qQgT1EAirGXoXV35PJo3X9zJFaO7o7gnO lHt1S+pw3mAESnCuxe8bmfbT+9LtmZjqqT7AVUc4gER12CHKCXjO7z06AqBWx3dkf3 l1OeJB9nMnOCvm5lxDorhULn1NRVXo0vROXpc+aXvyYPMA0B2dlgBKt//SlgbSggxe LkQUR02ZGbtq3FTTJb9sDNFZduZvF8m6oE0evQXF6lLjoN2pX24KG9sfcrm0OvS6mv 20pDEIvT3wsW8mqXUB7lxosIiueOz2vTE8Gp6WC9bJAPsZNG2dBGQ8To3+XC+EXz/W /fNen7UT4cP4g== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fW8XN1j2Dz4wHX; Wed, 11 Mar 2026 23:03:16 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 3/9] fwd: Don't initialise unused port bitmaps Date: Wed, 11 Mar 2026 23:03:08 +1100 Message-ID: <20260311120314.933546-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260311120314.933546-1-david@gibson.dropbear.id.au> References: <20260311120314.933546-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: FKYLH4JGPMYAW7LWBVJ5MD2DJABNREII X-Message-ID-Hash: FKYLH4JGPMYAW7LWBVJ5MD2DJABNREII 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