From: Stefano Brivio <sbrivio@redhat.com>
To: Yumei Huang <yuhuang@redhat.com>
Cc: passt-dev@passt.top, david@gibson.dropbear.id.au, lvivier@redhat.com
Subject: Re: [PATCH v2] tap: Drop frames if no client connected
Date: Thu, 25 Sep 2025 22:29:52 +0200 [thread overview]
Message-ID: <20250925222952.4ea81b82@elisabeth> (raw)
In-Reply-To: <20250912081705.20796-1-yuhuang@redhat.com>
On Fri, 12 Sep 2025 16:17:05 +0800
Yumei Huang <yuhuang@redhat.com> wrote:
> If no client is attached, discard outgoing frames and report them as
> sent. Without this we will get an EBADF in either writev() (pasta) or
> sendmsg() (passt). That's basically harmless, but a bit ugly.
> Explicitly catching this case results in behaviour that's probably a
> bit clearer to debug if we hit it.
>
> There are several different approaches we can take here. Here's some
> reasoning as David explained:
>
> * Don't listen() until the tap connection is ready
>
> - It's not clear that the host rejecting the connection is better
> than the host accepting, then the connection stalling until the
> guest is ready.
> - Would require substantial rework because we currently listen() as
> we parse the command line and don't store the information we'd need
> to do it later.
>
> * Don't accept() until the tap connection is ready
>
> - To the peer, will behave basically the same as this patch - the
> host will complete the TCP handshake, then the connection will stall
> until the guest is ready.
> - More work to implement, because essentially every sock-side handler
> has to check fd_tap and abort early
>
> * Drop packets in tap_send_frames(), but return 0
>
> - To the peer, would behave basically the same
> - Would make the TCP code do a bunch of busy work attempting to
> resend, probably to no avail
> - Handling of errors returned by tap_send_frames() is on the basis
> that it's probably a transient fault (buffer full) and we want to
> resend very soon. That approach doesn't make sense for a missing
> guest.
>
> Suggested-by: David Gibson <david@gibson.dropbear.id.au>
> Signed-off-by: Yumei Huang <yuhuang@redhat.com>
Applied. Sorry for the delay.
--
Stefano
prev parent reply other threads:[~2025-09-25 20:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-12 8:17 Yumei Huang
2025-09-15 1:59 ` David Gibson
2025-09-25 20:29 ` 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=20250925222952.4ea81b82@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).