public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] fwd_rule: Restore forwarding of ephemeral ports for -t auto, -u auto
@ 2026-11-15 22:40 Stefano Brivio
  2026-11-16  3:10 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2026-11-15 22:40 UTC (permalink / raw)
  To: passt-dev; +Cc: Frajo Haider, Sean McGinnis, David Gibson

From: Frajo Haider <frajo@frajo.fi>

From an original patch by Frajo: commit 4e09ddf03443 ("conf: Allow
user-specified auto-scanned port forwarding ranges") made automatic
port forwarding exclude ephemeral ports, consistently with -t all and
-u all, and I thought this should actually be desirable, because those
ports are ephemeral, after all, and no services should be bound to
them.

On the other hand, services that can already be contacted on some
other port might want to expose additional (ephemeral indeed) ports.
So perhaps we should really expose them.

Now, Sean reports that this "feature" actually breaks things for the
kind (Kubernetes-in-Docker) project, because Docker relies on the
rootlesskit integration of pasta, which uses automatic port forwarding
instead of explicit configuration.

So, feature or not (and I'm fairly convinced it's a bug by now), it
causes a regression, so restore the previous behaviour: if ports are
automatically forwarded, don't exclude ephemeral ports.

Reported-by: Frajo Haider <frajo@frajo.fi>
Reported-by: Sean McGinnis <sean.mcginnis@gmail.com>
Link: https://bugs.passt.top/show_bug.cgi?id=219
Link: https://github.com/kubernetes-sigs/kind/issues/4293
Fixes: 4e09ddf03443 ("conf: Allow user-specified auto-scanned port forwarding ranges")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 fwd_rule.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fwd_rule.c b/fwd_rule.c
index 312bc60..a1294d6 100644
--- a/fwd_rule.c
+++ b/fwd_rule.c
@@ -694,7 +694,8 @@ static void fwd_rule_parse_ports(struct fwd_table *fwd, bool del, uint8_t proto,
 
 	/* Finally handle "all" and exclude only cases */
 	if (exclude_only) {
-		fwd_port_map_ephemeral(exclude);
+		if (!(flags & FWD_SCAN))
+			fwd_port_map_ephemeral(exclude);
 
 		fwd_rule_range_except(fwd, del, proto, addr, ifname,
 				      1, NUM_PORTS - 1, exclude,
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fwd_rule: Restore forwarding of ephemeral ports for -t auto, -u auto
  2026-11-15 22:40 [PATCH] fwd_rule: Restore forwarding of ephemeral ports for -t auto, -u auto Stefano Brivio
@ 2026-11-16  3:10 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2026-11-16  3:10 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: passt-dev, Frajo Haider, Sean McGinnis

[-- Attachment #1: Type: text/plain, Size: 2440 bytes --]

On Sun, Nov 15, 2026 at 11:40:44PM +0100, Stefano Brivio wrote:
> From: Frajo Haider <frajo@frajo.fi>
> 
> >From an original patch by Frajo: commit 4e09ddf03443 ("conf: Allow
> user-specified auto-scanned port forwarding ranges") made automatic
> port forwarding exclude ephemeral ports, consistently with -t all and
> -u all, and I thought this should actually be desirable, because those
> ports are ephemeral, after all, and no services should be bound to
> them.
> 
> On the other hand, services that can already be contacted on some
> other port might want to expose additional (ephemeral indeed) ports.
> So perhaps we should really expose them.
> 
> Now, Sean reports that this "feature" actually breaks things for the
> kind (Kubernetes-in-Docker) project, because Docker relies on the
> rootlesskit integration of pasta, which uses automatic port forwarding
> instead of explicit configuration.
> 
> So, feature or not (and I'm fairly convinced it's a bug by now), it
> causes a regression, so restore the previous behaviour: if ports are
> automatically forwarded, don't exclude ephemeral ports.
> 
> Reported-by: Frajo Haider <frajo@frajo.fi>
> Reported-by: Sean McGinnis <sean.mcginnis@gmail.com>
> Link: https://bugs.passt.top/show_bug.cgi?id=219
> Link: https://github.com/kubernetes-sigs/kind/issues/4293
> Fixes: 4e09ddf03443 ("conf: Allow user-specified auto-scanned port forwarding ranges")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Note that until this patch is applied, the old behaviour can also be
forced with:
	-t 1024-65535,auto -u 1024-65535,auto

> ---
>  fwd_rule.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fwd_rule.c b/fwd_rule.c
> index 312bc60..a1294d6 100644
> --- a/fwd_rule.c
> +++ b/fwd_rule.c
> @@ -694,7 +694,8 @@ static void fwd_rule_parse_ports(struct fwd_table *fwd, bool del, uint8_t proto,
>  
>  	/* Finally handle "all" and exclude only cases */
>  	if (exclude_only) {
> -		fwd_port_map_ephemeral(exclude);
> +		if (!(flags & FWD_SCAN))
> +			fwd_port_map_ephemeral(exclude);
>  
>  		fwd_rule_range_except(fwd, del, proto, addr, ifname,
>  				      1, NUM_PORTS - 1, exclude,
> -- 
> 2.43.0
> 

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-16  4:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15 22:40 [PATCH] fwd_rule: Restore forwarding of ephemeral ports for -t auto, -u auto Stefano Brivio
2026-11-16  3:10 ` David Gibson

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).