From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 5/5] fwd: Don't rewrite inbound multicast destinations
Date: Mon, 13 Jul 2026 02:39:54 +0200 (CEST) [thread overview]
Message-ID: <20260713023954.6b7a931b@elisabeth> (raw)
In-Reply-To: <20260710065611.530947-6-david@gibson.dropbear.id.au>
On Fri, 10 Jul 2026 16:56:11 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:
> fwd_nat_from_host() (nearly) always rewrites the destination address for
> inbound flows to the observed guest address. Usually, that makes sense:
> regardless of the host address to which the new flow arrived, we want to
> direct it to the guest. However, that clearly does not make sense for
> multicast - it should still appear as a multicast transmission to the
> guest.
>
> In particular this can work very badly for multicast protocols which use
> the same source and destination ports by convention (e.g. mDNS). In this
> case, we will attempt to forword multicast packets to our own socket,
> causing a forwarding loop (see bug 209 for more details).
>
> While it's certainly not enough to make us handle multicast correctly in
> all circumstances, not translating multicast destinations is closer to
> correct, and prevents bug 209 at least.
>
> Link: https://bugs.passt.top/show_bug.cgi?id=209
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> fwd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fwd.c b/fwd.c
> index 7d39898e..e59413b6 100644
> --- a/fwd.c
> +++ b/fwd.c
> @@ -1045,7 +1045,8 @@ uint8_t fwd_nat_from_host(const struct ctx *c,
> tgt->eport = rule->to + (ini->oport - rule->first);
> if (!inany_is_unspecified(&rule->taddr))
> tgt->eaddr = rule->taddr;
> - else if (c->host_lo_to_ns_lo && inany_is_loopback(&ini->oaddr))
> + else if (inany_is_multicast(&ini->oaddr) ||
This is a bit convoluted: if one reads this commit message it makes
sense, but if one reads just the code later it's absolutely unclear
that this is needed to avoid the inany_is_unspecified(&tgt->eaddr)
clause at the end of the function (mostly).
Should we add a comment? Right now I can't come up with any reasonable
suggestion of where to place it or what to write in it, though.
> + (c->host_lo_to_ns_lo && inany_is_loopback(&ini->oaddr)))
> tgt->eaddr = ini->oaddr;
>
> /* TODO: Allow splicing with specified target address */
--
Stefano
prev parent reply other threads:[~2026-07-13 0:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 6:56 [PATCH 0/5] RFC: Fix bug 209 David Gibson
2026-07-10 6:56 ` [PATCH 1/5] fwd: Clarify semantics of --host-lo-to-ns-lo David Gibson
2026-07-13 0:39 ` Stefano Brivio
2026-07-10 6:56 ` [PATCH 2/5] udp: Validate that we have a unicast source address David Gibson
2026-07-10 6:56 ` [PATCH 3/5] fwd: Rework default address logic for inbound flows David Gibson
2026-07-13 0:39 ` Stefano Brivio
2026-07-10 6:56 ` [PATCH 4/5] fwd: Reorder DNAPT and SNAT steps in fwd_nat_from_host() David Gibson
2026-07-10 6:56 ` [PATCH 5/5] fwd: Don't rewrite inbound multicast destinations David Gibson
2026-07-13 0:39 ` Stefano Brivio [this message]
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=20260713023954.6b7a931b@elisabeth \
--to=sbrivio@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
/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).