From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>, passt-dev@passt.top
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 3/6] fwd: Don't initialise unused port bitmaps
Date: Tue, 10 Mar 2026 15:16:02 +1100 [thread overview]
Message-ID: <20260310041605.1322552-4-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20260310041605.1322552-1-david@gibson.dropbear.id.au>
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 <david@gibson.dropbear.id.au>
---
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
next prev parent reply other threads:[~2026-03-10 4:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 4:15 [PATCH 0/6] Unify TCP and UDP forwarding tables David Gibson
2026-03-10 4:16 ` [PATCH 1/6] conf, fwd: Make overall forwarding mode local to conf path David Gibson
2026-03-10 19:33 ` Stefano Brivio
2026-03-11 1:34 ` David Gibson
2026-03-10 4:16 ` [PATCH 2/6] tcp: Remove stale description of port_to_tap field David Gibson
2026-03-10 4:16 ` David Gibson [this message]
2026-03-10 4:16 ` [PATCH 4/6] Fix misnamed field in struct ctx comments David Gibson
2026-03-10 4:16 ` [PATCH 5/6] fwd: Split forwarding table from port scanning state David Gibson
2026-03-10 4:16 ` [PATCH 6/6] fwd: Unify TCP and UDP forwarding tables David Gibson
2026-03-10 19:33 ` Stefano Brivio
2026-03-11 1:39 ` 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=20260310041605.1322552-4-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).