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 3/3] fwd: Don't explicitly exclude reverse-direction TCP ports for UDP
Date: Wed, 19 Nov 2025 15:26:34 +1100 [thread overview]
Message-ID: <20251119042634.2978171-4-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20251119042634.2978171-1-david@gibson.dropbear.id.au>
In auto-forwarding mode, we forward UDP ports for which there isn't (yet)
a listening UDP port on the other side, but where there is a listening
TCP socket for the same port number. This is useful for certain protocols
such as iperf3.
Correspondinly, when excluding ports from forwarding, we also exclude TCP
ports from the other direction. That sounds like it makes sense, but is
unnecessary: for the purposes of exclusion, we don't care why we have a
listening UDP socket for that port, just whether we have one. That is
already incorporated into the UDP bitmap alone.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
fwd.c | 6 ++----
util.c | 1 +
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/fwd.c b/fwd.c
index c7a880eb..c417e0f5 100644
--- a/fwd.c
+++ b/fwd.c
@@ -410,10 +410,8 @@ static void fwd_scan_ports(struct ctx *c)
memcpy(excl_tcp_out, c->tcp.fwd_in.map, sizeof(excl_tcp_out));
memcpy(excl_tcp_in, c->tcp.fwd_out.map, sizeof(excl_tcp_in));
- bitmap_or(excl_udp_out, PORT_BITMAP_SIZE,
- c->udp.fwd_in.map, c->tcp.fwd_in.map);
- bitmap_or(excl_udp_in, PORT_BITMAP_SIZE,
- c->udp.fwd_out.map, c->tcp.fwd_out.map);
+ memcpy(excl_udp_out, c->udp.fwd_in.map, sizeof(excl_udp_out));
+ memcpy(excl_udp_in, c->udp.fwd_out.map, sizeof(excl_udp_in));
fwd_scan_ports_tcp(&c->tcp.fwd_out, excl_tcp_out);
fwd_scan_ports_tcp(&c->tcp.fwd_in, excl_tcp_in);
diff --git a/util.c b/util.c
index 7944a495..ab23463b 100644
--- a/util.c
+++ b/util.c
@@ -338,6 +338,7 @@ bool bitmap_isset(const uint8_t *map, unsigned bit)
* @a: First operand
* @b: Second operand
*/
+/* cppcheck-suppress unusedFunction */
void bitmap_or(uint8_t *dst, size_t size, const uint8_t *a, const uint8_t *b)
{
unsigned long *dw = (unsigned long *)dst;
--
2.51.1
next prev parent reply other threads:[~2025-11-19 4:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 4:26 [PATCH 0/3] Fix regression in auto port forwarding David Gibson
2025-11-19 4:26 ` [PATCH 1/3] Revert "fwd: Update all port maps before applying exclusions" David Gibson
2025-11-19 4:26 ` [PATCH 2/3] fwd: Exclude ports based on prior mapping state David Gibson
2025-11-19 4:26 ` David Gibson [this message]
2025-11-21 4:45 ` [PATCH 0/3] Fix regression in auto port forwarding Stefano Brivio
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=20251119042634.2978171-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).