summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2020-02-12 20:07:56 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2020-02-12 20:07:56 +0000
commitfbc5ef6fa328c59ae8e29ef9b89854ca5385c9ba (patch)
tree7614edf9a6752d720a4979a40372abc6113cdd72 /usr.sbin/tcpdump
parentf9e9cafd15d9d3cc0291b5af608482bf8308d0b8 (diff)
- print 'dlen=' to make it more clear what that number indicates
- add missing rcs id - use 'goto trunc' as is common with other printers ok mpi@
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r--usr.sbin/tcpdump/print-usbpcap.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/tcpdump/print-usbpcap.c b/usr.sbin/tcpdump/print-usbpcap.c
index 1ddc8575eec..365d2a77fcc 100644
--- a/usr.sbin/tcpdump/print-usbpcap.c
+++ b/usr.sbin/tcpdump/print-usbpcap.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: print-usbpcap.c,v 1.2 2020/02/12 20:07:55 jasper Exp $ */
+
/*
* Copyright (c) 2018 Martin Pieuchot <mpi@openbsd.org>
*
@@ -38,10 +40,9 @@ usbpcap_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
ts_print(&h->ts);
/* check length */
- if (caplen < sizeof(uint16_t)) {
- printf("[|usb]");
- goto out;
- }
+ if (caplen < sizeof(uint16_t))
+ goto trunc;
+
uph = (struct usbpcap_pkt_hdr *)p;
hdrlen = letoh16(uph->uph_hlen);
if (hdrlen < sizeof(*uph)) {
@@ -49,10 +50,8 @@ usbpcap_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
goto out;
}
- if (caplen < hdrlen) {
- printf("[|usb]");
- goto out;
- }
+ if (caplen < hdrlen)
+ goto trunc;
printf("bus %u %c addr %u: ep%u",
letoh16(uph->uph_bus),
@@ -64,10 +63,13 @@ usbpcap_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
else
printf(" ??");
- printf(" %u", letoh32(uph->uph_dlen));
+ printf(" dlen=%u", letoh32(uph->uph_dlen));
if (xflag)
default_print(p + sizeof(*uph), length - sizeof(*uph));
out:
putchar('\n');
+ return;
+trunc:
+ printf("[|usb]");
}