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=202512 header.b=aq62ZjyC; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 958B55A0652 for ; Fri, 12 Dec 2025 08:10:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1765523440; bh=z8X9/oSKr7uT6UfrmKrLvBdjVhQK9lUDPapueoRX+2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aq62ZjyCx7RG0+LFFiTNjIBEfz+dwjezvwQ3GULPuQNe/bI/CrKmv748sl1SOrkpl yNOMhF3zaDK8u6joJP7hIJ4FP+LcdN2an9mSvoc7CrROV9m+ZmmLA3jPktz3VS6hvx 1b4LWV3aevDqv8JxaVNFo/bcI72feScOXOAypJaqxftiIyleOXhP3sWzkIrwPTgqZA V0wdciEvIMZyo5I0abf+HUlcP1M6diO3Dh8UF/XoO7bqUeX2m2fOe/bsyI7bnLe0y4 evSmQzxYR8bdcgLF6NZ3jds0E8QlrEZqaPZ/6glHhazBFqGERQUXRj11vCwvzzyiPl mO8/8WRZiQWdg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dSLFr1kfyz4wM8; Fri, 12 Dec 2025 18:10:40 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 2/5] conf, fwd: Move initialisation of auto port scanning out of conf() Date: Fri, 12 Dec 2025 18:10:35 +1100 Message-ID: <20251212071038.3943933-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251212071038.3943933-1-david@gibson.dropbear.id.au> References: <20251212071038.3943933-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 4G6K7IEOR4K57HPH4EGRMJ4TDU2BI4W5 X-Message-ID-Hash: 4G6K7IEOR4K57HPH4EGRMJ4TDU2BI4W5 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: We call fwd_scan_ports_init() at (almost) the end of conf(). It's a bit odd to do actual work from a function that's ostensibly about getting our configuration. It's not the only instance of this, but to make things a bit clearer move the call to main(), right after flow_init(). Signed-off-by: David Gibson --- conf.c | 2 -- passt.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/conf.c b/conf.c index 24b44419..2942c8c2 100644 --- a/conf.c +++ b/conf.c @@ -2144,8 +2144,6 @@ void conf(struct ctx *c, int argc, char **argv) if (!c->udp.fwd_out.mode) c->udp.fwd_out.mode = fwd_default; - fwd_scan_ports_init(c); - if (!c->quiet) conf_print(c); } diff --git a/passt.c b/passt.c index cf38822f..7488a84c 100644 --- a/passt.c +++ b/passt.c @@ -396,6 +396,7 @@ int main(int argc, char **argv) die_perror("Failed to get CLOCK_MONOTONIC time"); flow_init(); + fwd_scan_ports_init(&c); if ((!c.no_udp && udp_init(&c)) || (!c.no_tcp && tcp_init(&c))) passt_exit(EXIT_FAILURE); -- 2.52.0