From 35fa86a7871767d6a382b13e71c429abf47f88ab Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 12 Dec 2025 18:10:35 +1100 Subject: conf, fwd: Move initialisation of auto port scanning out of conf() 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 Signed-off-by: Stefano Brivio --- conf.c | 2 -- passt.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/conf.c b/conf.c index 24b4441..2942c8c 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 cf38822..7488a84 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); -- cgit v1.2.3