pcap streams are text files which insert 0xD in Windows version
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Since Windows text files use CRLFs for all \n, the Windows version of QEMU inserts a CR in the PCAP stream when a LF is encountered when using USB PCAP files.
Starting at line 275 in hw/usb/bus (https:/
I think the following patch would fix the issue:
if (dev->pcap_
- int fd = qemu_open_
+ int fd = qemu_open_
if (fd < 0) {
return;
}
- dev->pcap = fdopen(fd, "w");
+ dev->pcap = fdopen(fd, "wb");
}
To show an example, when using a very common protocol to USB disks, the BBB protocol uses a 10-byte command packet. For example, the READ_CAPACITY(10) command (implemented at https:/
Actual CBW:
0040 55 53 42 43 01 00 00 00 08 00 00 00 80 00 0a 25 USBC............
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 %..............
PCAP CBW
0040 55 53 42 43 01 00 00 00 08 00 00 00 80 00 0d 0a USBC............
0050 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 %..............
I believe simply opening the PCAP file as BINARY instead of TEXT will fix this issue.
Thank you.
Changed in qemu: | |
status: | New → Confirmed |
Hi Benjamin,
QEMU bug tracker is on GitLab: /gitlab. com/qemu- project/ qemu/-/ issues
https:/
But instead of re-opening the issue there, since you /www.qemu. org/docs/ master/ devel/submittin g-a-patch. html
already figured the problem, do you mind directly post
your patch? See guidelines there:
https:/
Thanks!
Phil.