From: Stefano Brivio <sbrivio@redhat.com>
To: Yumei Huang <yuhuang@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>,
passt-dev@passt.top, lvivier@redhat.com
Subject: Re: [PATCH] tap: Drop frames if no client connected
Date: Thu, 25 Sep 2025 08:05:30 +0200 [thread overview]
Message-ID: <20250925080530.53d7307c@elisabeth> (raw)
In-Reply-To: <CANsz47=xdGV-nLCPb8aP45QpWiFfcNh-=Qnsn5HsVG-fU8YR=g@mail.gmail.com>
On Thu, 25 Sep 2025 13:08:35 +0800
Yumei Huang <yuhuang@redhat.com> wrote:
> On Wed, Sep 24, 2025 at 5:56 PM Stefano Brivio <sbrivio@redhat.com> wrote:
> >
> > On Wed, 24 Sep 2025 11:49:28 +1000
> > David Gibson <david@gibson.dropbear.id.au> wrote:
> >
> > > So... summarising. As I see it, we have two main cases to consider:
> > > the one where the guest comes online pretty soon, and the one where it
> > > doesn't. Here's what I think the behaviour would be for these two
> > > cases with a variety of ways of handling it. This is more-or-less
> > > from the peer's perspective.
> > >
> > > (0) Physicaly disconnected guest (bridged network, no passt involved)
> > >
> > > (0a) Guest online never
> > > SYN ... SYN ... SYN ... <peer times out>
> > >
> > > (0b) Guest online soonish
> > > SYN ... SYN ... SYN-ACK, ACK <working connection>
> > >
> > > (1) Status quo
> > >
> > > Passt doesn't resend SYNs, and will time out the connection after 10s.
> > >
> > > (1a) Guest online never
> > > SYN, SYN-ACK, ACK ... ... ... ... <passt times out> RST
> > >
> > > (0b) Guest online soonish
> > > SYN, SYN-ACK, ACK ... ... ... ... <passt times out> RST
> > >
> > > (2) Yumei's patch
> > >
> > > As (1), but without EBADFs
> > >
> > > (3) passt resends SYNs
> > >
> > > (3a) Guest online never
> > > SYN, SYN-ACK, ACK ... ... ... ... ... <passt times out> RST
> > >
> > > (3b) Guest online soonish
> > > SYN, SYN-ACK, ACK ... ... ... ... <working connection>
> > >
> > > (4) Passt resends SYNs + Yumei's patch
> > >
> > > As (3), but without EBADFs
> > >
> > > (5) passt explicitly resets when guest is not present
> > >
> > > (6a) Guest online never
> > > SYN, SYN-ACK, ACK, RST
> > >
> > > (6b) Guest online soonish
> > > SYN, SYN-ACK, ACK, RST
> > >
> > > (6) Delayed listen()
> > >
> > > (6a) Guest online never
> > > SYN, RST
> > >
> > > (6b) Guest online soonish
> > > SYN, RST
> > >
> > > (99) Bridged guest isn't listening (no passt)
> > >
> > > (99a) Guest online never
> > > SYN, RST
> > >
> > > (99b) Guest online soonish
> > > SYN, RST
> > >
> > > =====
> >
> > It all makes sense, thanks for summarising those.
> >
> > > So, if (99) is our model, we can match it pretty exactly with delayed
> > > listen(). But if (0) is our model, the closest we can get is (3) or
> > > (4), which I think will look fairly similar to peer application, even
> > > though it looks different to the peer TCP stack.
> > >
> > > I think (0) is a better model, because it means we won't reset
> > > connections if they happen to land when a still running guest has its
> > > connection to passt temporarily interrupted.
> > >
> > > Which brings me, I think, to the same conclusion you had: we should
> > > resend SYNs.
> > >
> > > Suggested next steps:
> > > - Apply Yumei's patch, it doesn't change behaviour and removes the
> > > odd EBADFs
> > > - Yumei investigates implementing SYN resends
> >
> > Right, that also makes sense to me.
>
> Glad we reached an agreement here. BTW, in case you missed it, the v2
> patch was sent as
> https://archives.passt.top/passt-dev/20250912081705.20796-1-yuhuang@redhat.com/T/#u.
I never miss patches. :) No worries, I just got a few interruptions in
a row but I plan to apply it soon.
> > For the second part, we could probably reuse a mechanism similar to
> > what we do for re-transmits, and perhaps rename 'retrans' in struct
> > tcp_tap_conn to 'retries', so that we can use it for both (we're a bit
> > tight on space there).
>
> I got an initial thought about calling tcp_send_flag() in
> tcp_flow_defer(). But it seems not working. Trying to figure that
> out..
That might work, even though, I guess, the most natural alternative
would be to change the handling of an expired SYN_TIMEOUT in
tcp_timer_handler(). Look at this case:
} else if (conn->flags & ACK_FROM_TAP_DUE) {
if (!(conn->events & ESTABLISHED)) {
flow_dbg(conn, "handshake timeout");
...it should become a bit more like this one:
} else {
flow_dbg(conn, "ACK timeout, retry");
conn->retrans++;
...
where we retry for a few times, before resetting the connection.
With timers, you already have timed triggers, as opposed to trying
things out periodically from tcp_flow_defer().
--
Stefano
prev parent reply other threads:[~2025-09-25 6:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-11 8:55 Yumei Huang
2025-09-11 9:54 ` Stefano Brivio
2025-09-12 2:01 ` David Gibson
2025-09-12 2:45 ` Yumei Huang
2025-09-15 6:13 ` Stefano Brivio
2025-09-15 6:13 ` Stefano Brivio
2025-09-18 4:28 ` David Gibson
2025-09-18 7:17 ` Stefano Brivio
2025-09-19 1:33 ` David Gibson
2025-09-22 7:17 ` Yumei Huang
2025-09-22 20:03 ` Stefano Brivio
2025-09-23 7:53 ` David Gibson
2025-09-23 11:00 ` Stefano Brivio
2025-09-23 11:26 ` David Gibson
2025-09-23 23:56 ` Stefano Brivio
2025-09-24 1:49 ` David Gibson
2025-09-24 9:56 ` Stefano Brivio
2025-09-25 5:08 ` Yumei Huang
2025-09-25 6:05 ` 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=20250925080530.53d7307c@elisabeth \
--to=sbrivio@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
--cc=yuhuang@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).