[PATCH 05/18] conf: Permit -[tTuU] all in pasta mode

David Gibson
2026-04-07T03:16:41Z

Currently we explicitly forbid -[tTuU] all in pasta mode. While these are
primarily useful for passt, there's no particular reason they can't be
used in pasta mode as well. Indeed you can do the same thing in pasta
by using "-t ~32768-60999" (assuming default Linux configuration of
ephemeral ports). For consistency, permit "all" for pasta as well.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
conf.c | 7 ++-----
passt.1 | 2 +-
2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/conf.c b/conf.c
index 751e500f..870712af 100644
--- a/conf.c
+++ b/conf.c
@@ -358,9 +358,6 @@ static void conf_ports(const struct ctx *c, char optname, const char *optarg,
if (*mode)
goto mode_conflict;

- if (c->mode == MODE_PASTA)
- die("'all' port forwarding is only allowed for passt");
-
*mode = FWD_MODE_ALL;

/* Exclude ephemeral ports */
@@ -1028,6 +1025,7 @@ static void usage(const char *name, FILE *f, int status)
" can be specified multiple times\n"
" SPEC can be:\n"
" 'none': don't forward any ports\n"
+ " 'all': forward all unbound, non-ephemeral ports\n"
"%s"
" a comma-separated list, optionally ranged with '-'\n"
" and optional target ports after ':', with optional\n"
@@ -1050,8 +1048,7 @@ static void usage(const char *name, FILE *f, int status)
" default: %s\n",
strstr(name, "pasta") ?
" 'auto': forward all ports currently bound in namespace\n"
- :
- " 'all': forward all unbound, non-ephemeral ports\n",
+ : "",
strstr(name, "pasta") ? "auto" : "none",
strstr(name, "pasta") ? "auto" : "none");

diff --git a/passt.1 b/passt.1
index a9a8a42a..44113929 100644
--- a/passt.1
+++ b/passt.1
@@ -435,7 +435,7 @@ Configure TCP port forwarding to guest. \fIspec\fR can be one of:
Don't forward any ports

.TP
-.BR all (\fBpasst\fR only)
+.BR all
Forward all unbound, non-ephemeral ports, as permitted by current capabilities.
For low (< 1024) ports, see \fBNOTES\fR. No failures are reported for
unavailable ports, unless no ports could be forwarded at all.
--
2.53.0