public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 2/5] conf, fwd: Move initialisation of auto port scanning out of conf()
Date: Fri, 12 Dec 2025 18:10:35 +1100	[thread overview]
Message-ID: <20251212071038.3943933-3-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20251212071038.3943933-1-david@gibson.dropbear.id.au>

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 <david@gibson.dropbear.id.au>
---
 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


  parent reply	other threads:[~2025-12-12  7:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-12  7:10 [PATCH 0/5] RFC: Forwarding table data structure David Gibson
2025-12-12  7:10 ` [PATCH 1/5] tcp: Remove extra space from TCP_INFO debug messages (trivial) David Gibson
2025-12-12  7:10 ` David Gibson [this message]
2025-12-12  7:10 ` [PATCH 3/5] conf, fwd: Keep a table of our port forwarding configuration David Gibson
2025-12-12  7:10 ` [PATCH 4/5] conf: Accurately record ifname and address for outbound forwards David Gibson
2025-12-12  7:10 ` [PATCH 5/5] conf, fwd: Record "auto" port forwards in forwarding table David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251212071038.3943933-3-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).