From: dev@haytok.jp
To: Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>, passt-dev@passt.top
Subject: Re: [PATCH] Keep listening on remaining rules if one of them fails to bind
Date: Wed, 28 Oct 2026 02:24:40 +0900 [thread overview]
Message-ID: <6A292BDB-99B3-451E-B859-FAC3D2300221@haytok.jp> (raw)
In-Reply-To: <20261025153025.600a4fe9@elisabeth>
Hi Stefano,
Thanks for the detailed explanation, and for the background on the
original design!
> We're not sure whether a rollback after 2. would work: forwarding rules
> that might have worked earlier might not work now (for example because
> host addresses changed).
>
> However, in a general case, I guess that the existing (old) rules are
> still more likely to work than not. That is, given:
>
> a. new forwarding rules don't work because of an unintended
> configuration error
>
> b. old forwarding rules wouldn't work anymore if re-applied because of
> a setup change
>
> I think a. is much more likely, so a rollback would be beneficial and
> give the user the chance to look at possible configuration errors
> without switching to a possibly unintended state. What do you think?
I strongly agree.
In practice, a. is far more likely. Case b. can happen depending on
what changed on the host, but that's beyond what pasta can handle, so
all we can do is report it and let the user fix the setup.
> 1. abort on any failure of fwd_listen_init() (maintaining the current
> behaviour of fwd_listen_sync_()), and:
>
> 2. close any listening sockets (first part of fwd_listen_switch()) that
> we might have just opened
>
> 3. swap the rules again (as you can see, we already preserve the old
> rules, because we planned to complete the rollback implementation at
> some point)
>
> 4. call fwd_listen_init() on the old rules
I agree, and that's what my work-in-progress patch does.
> 5. make sure we report failure to the client
Here's how I'm thinking of implementing this. Please let me know if
I got something wrong:
- make fwd_listen_switch() return an int, distinguishing the case
where we rolled back to the old rules from the case where the
rollback failed too
- in conf_handler(), write that result to the control socket right
after fwd_listen_switch(), before conf_close()
- in pesto, read it after send_conf(), and if the update failed,
print that the old rules were restored and exit non-zero
For the content, I'd start with a status only (success / rolled back /
restore failed). fwd_sync_one() already logs which rule failed on the
pasta side, so returning that to pesto could be added later if needed.
Since this adds a message from the server, we need to bump
PESTO_PROTOCOL_VERSION to 3, and have pesto skip reading the result if
the server version is below 3. Is that OK?
I'm planning to send 5. as a separate patch from the rollback (1. to
4.).
> ...this looks reasonable to me and better than the existing behaviour,
> but it's pointless to do this if we want to finish things up and add
> the rollback for this case.
Agreed, I'll drop this patch.
I was already planning to implement the rollback feature, and I have a
work-in-progress patch covering steps 1. to 4. you listed. I'll send
it once it's ready.
Thanks,
Hayato
next prev parent reply other threads:[~2026-10-27 17:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 15:42 [PATCH] fwd: " Hayato Kiwata
2026-10-25 14:30 ` Stefano Brivio
2026-10-27 17:24 ` dev [this message]
2026-10-28 7:44 ` [PATCH] " 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=6A292BDB-99B3-451E-B859-FAC3D2300221@haytok.jp \
--to=dev@haytok.jp \
--cc=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).