* [PATCH 0/2] Fix regression when one IP version is disabled
@ 2026-05-15 8:24 David Gibson
2026-05-15 8:24 ` [PATCH 1/2] fwd_rule: Don't attempt dual stack listen()s if only one IP family David Gibson
2026-05-15 8:24 ` [PATCH 2/2] fwd_rule: Allow parsing * as a forwarding address David Gibson
0 siblings, 2 replies; 3+ messages in thread
From: David Gibson @ 2026-05-15 8:24 UTC (permalink / raw)
To: passt-dev, Stefano Brivio; +Cc: j.d03, David Gibson
Fix for a simple but nasty regression caused by the recent forwarding
table work. Plus a tiny feature in adjacent code.
Link: https://bugs.passt.top/show_bug.cgi?id=205
David Gibson (2):
fwd_rule: Don't attempt dual stack listen()s if only one IP family
fwd_rule: Allow parsing * as a forwarding address
fwd_rule.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--
2.54.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] fwd_rule: Don't attempt dual stack listen()s if only one IP family
2026-05-15 8:24 [PATCH 0/2] Fix regression when one IP version is disabled David Gibson
@ 2026-05-15 8:24 ` David Gibson
2026-05-15 8:24 ` [PATCH 2/2] fwd_rule: Allow parsing * as a forwarding address David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2026-05-15 8:24 UTC (permalink / raw)
To: passt-dev, Stefano Brivio; +Cc: j.d03, David Gibson
With the recent rework to forwarding configuration, we're stricter about
what forwarding rules we allow. In particular we don't allow dual stack
forwards (listening on both IPv4 and IPv6 addresses) if we only have one
IP family enabled.
This makes what I think was a pre-existing minor bug into a nasty failure.
If we use default forwards with no address specified, e.g.:
$ pasta -t 1234 -4
$ pasta -U 4321 -6
these are interpreted as dual-stack forwards. Previously these would be
applied, leading to a surprising dual stack socket. Since 0aeda87ca185,
they instead result in an immediate fatal error.
Add logic to interpret a default "any" address as only one IP family if
only one IP family is enabled.
Link: https://bugs.passt.top/show_bug.cgi?id=205
Reported-by: <j.d03@cpc.cx>
Fixes: 0aeda87ca185 ("conf, fwd: Stricter rule checking in fwd_rule_add()")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
fwd_rule.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/fwd_rule.c b/fwd_rule.c
index 5fc04d76..cb37a990 100644
--- a/fwd_rule.c
+++ b/fwd_rule.c
@@ -650,8 +650,9 @@ bad:
void fwd_rule_parse(char optname, bool del, const char *optarg,
struct fwd_table *fwd)
{
- union inany_addr addr_buf = inany_any6, *addr = &addr_buf;
char buf[BUFSIZ], *spec, *ifname = NULL;
+ union inany_addr addr_buf = inany_any6;
+ const union inany_addr *addr = &addr_buf;
uint8_t proto;
if (optname == 't' || optname == 'T')
@@ -708,7 +709,7 @@ void fwd_rule_parse(char optname, bool del, const char *optarg,
p++;
}
- if (!inany_pton(p, addr))
+ if (!inany_pton(p, &addr_buf))
die("Bad forwarding address '%s'", p);
}
} else {
@@ -741,6 +742,12 @@ void fwd_rule_parse(char optname, bool del, const char *optarg,
ifname = "lo";
}
+ /* No need for dual stack if we only have one IP version */
+ if (!addr && !(fwd->caps & FWD_CAP_IPV4))
+ addr = &inany_any6;
+ else if (!addr && !(fwd->caps & FWD_CAP_IPV6))
+ addr = &inany_any4;
+
if (ifname && !(fwd->caps & FWD_CAP_IFNAME)) {
die(
"Device binding for '-%c %s' unsupported (requires kernel 5.7+)",
--
2.54.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] fwd_rule: Allow parsing * as a forwarding address
2026-05-15 8:24 [PATCH 0/2] Fix regression when one IP version is disabled David Gibson
2026-05-15 8:24 ` [PATCH 1/2] fwd_rule: Don't attempt dual stack listen()s if only one IP family David Gibson
@ 2026-05-15 8:24 ` David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2026-05-15 8:24 UTC (permalink / raw)
To: passt-dev, Stefano Brivio; +Cc: j.d03, David Gibson
In our output in various places, we use "*", or sometimes "[*]" to indicate
a dual stack unspecified address: that is a case where we listen on both
0.0.0.0 and ::. However we don't currently allow the same syntax when
specifying forwarding rules on the command line.
A * address can be indirectly specified by omitting the address entirely,
but for consistency allow an explicit "*" or "[*]" as well.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
fwd_rule.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fwd_rule.c b/fwd_rule.c
index cb37a990..04a0101d 100644
--- a/fwd_rule.c
+++ b/fwd_rule.c
@@ -709,7 +709,9 @@ void fwd_rule_parse(char optname, bool del, const char *optarg,
p++;
}
- if (!inany_pton(p, &addr_buf))
+ if (strcmp(p, "*") == 0)
+ addr = NULL;
+ else if (!inany_pton(p, &addr_buf))
die("Bad forwarding address '%s'", p);
}
} else {
--
2.54.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-15 8:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-15 8:24 [PATCH 0/2] Fix regression when one IP version is disabled David Gibson
2026-05-15 8:24 ` [PATCH 1/2] fwd_rule: Don't attempt dual stack listen()s if only one IP family David Gibson
2026-05-15 8:24 ` [PATCH 2/2] fwd_rule: Allow parsing * as a forwarding address 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).