From: "Wesley Aptekar-Cassels" <me@wesleyac.com>
To: qemu-devel@nongnu.org
Subject: [PATCH] hw/usb/pcap: Prevent truncation of USB data in pacp files.
Date: Tue, 25 Nov 2025 23:07:43 -0500 [thread overview]
Message-ID: <4156bca7-ef99-4158-867d-c41893f7c8e3@app.fastmail.com> (raw)
Currently, packet data is truncated to 256 bytes in pcap files. The
original length is recorded, but the actual data is discarded. This
shows up in Wireshark as "bytes captured" being smaller than "bytes on
wire".
This is because DATA_LEN is used to limit the maximum pcap size.
I'm not sure why 256 was initially picked. There are several sources
that report 1024 as the maximum size of a USB packet, so that seems like
a reasonable thing to set it to.
It also might be reasonable to allow the value to be configurable. I
have opted not to do this, since it's more complex, and there does not
seem to be a significant downside to increasing it to the maximum, other
than the potential increase in size of the pcap files, which is a
tradeoff that people capturing pcaps are likely to want to make.
Signed-off-by: Wesley Aptekar-Cassels <me@wesleyac.com>
---
hw/usb/pcap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/usb/pcap.c b/hw/usb/pcap.c
index dbff00be25..86eb603b5b 100644
--- a/hw/usb/pcap.c
+++ b/hw/usb/pcap.c
@@ -70,7 +70,7 @@ struct usbmon_packet {
/* ------------------------------------------------------------------------ */
#define CTRL_LEN 4096
-#define DATA_LEN 256
+#define DATA_LEN 1024
static int usbmon_status(USBPacket *p)
{
--
2.50.1
reply other threads:[~2025-11-26 14:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4156bca7-ef99-4158-867d-c41893f7c8e3@app.fastmail.com \
--to=me@wesleyac.com \
--cc=qemu-devel@nongnu.org \
/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.
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 NNTP newsgroup(s).