Skip to content

Commit 65577c9

Browse files
committed
USB: Update the link-layer dissector to a void function
Moreover: Remove trailing "_if" from protocol names.
1 parent 337875c commit 65577c9

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

netdissect.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ extern u_int sll2_if_print IF_PRINTER_ARGS;
522522
extern u_int sunatm_if_print IF_PRINTER_ARGS;
523523
extern void symantec_if_print IF_PRINTER_ARGS;
524524
extern u_int token_if_print IF_PRINTER_ARGS;
525-
extern u_int usb_linux_48_byte_if_print IF_PRINTER_ARGS;
526-
extern u_int usb_linux_64_byte_if_print IF_PRINTER_ARGS;
525+
extern void usb_linux_48_byte_if_print IF_PRINTER_ARGS;
526+
extern void usb_linux_64_byte_if_print IF_PRINTER_ARGS;
527527
extern u_int vsock_if_print IF_PRINTER_ARGS;
528528

529529
/*

print-usb.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,21 @@ usb_header_print(netdissect_options *ndo, const pcap_usb_header *uh)
247247
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
248248
* is the number of bytes actually captured.
249249
*/
250-
u_int
250+
void
251251
usb_linux_48_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
252252
const u_char *p)
253253
{
254-
ndo->ndo_protocol = "usb_linux_48_byte_if";
254+
ndo->ndo_protocol = "usb_linux_48_byte";
255255
if (h->caplen < sizeof(pcap_usb_header)) {
256+
ndo->ndo_ll_header_length += h->caplen;
256257
nd_print_trunc(ndo);
257-
return(sizeof(pcap_usb_header));
258+
return;
258259
}
260+
ndo->ndo_ll_header_length += sizeof (pcap_usb_header);
259261

260262
usb_header_print(ndo, (const pcap_usb_header *) p);
261263

262-
return(sizeof(pcap_usb_header));
264+
return;
263265
}
264266

265267
#ifdef DLT_USB_LINUX_MMAPPED
@@ -271,19 +273,21 @@ usb_linux_48_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
271273
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
272274
* is the number of bytes actually captured.
273275
*/
274-
u_int
276+
void
275277
usb_linux_64_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
276278
const u_char *p)
277279
{
278-
ndo->ndo_protocol = "usb_linux_64_byte_if";
280+
ndo->ndo_protocol = "usb_linux_64_byte";
279281
if (h->caplen < sizeof(pcap_usb_header_mmapped)) {
282+
ndo->ndo_ll_header_length += h->caplen;
280283
nd_print_trunc(ndo);
281-
return(sizeof(pcap_usb_header_mmapped));
284+
return;
282285
}
286+
ndo->ndo_ll_header_length += sizeof (pcap_usb_header_mmapped);
283287

284288
usb_header_print(ndo, (const pcap_usb_header *) p);
285289

286-
return(sizeof(pcap_usb_header_mmapped));
290+
return;
287291
}
288292
#endif /* DLT_USB_LINUX_MMAPPED */
289293

print.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,6 @@ static const struct uint_printer uint_printers[] = {
108108
#ifdef DLT_IPOIB
109109
{ ipoib_if_print, DLT_IPOIB },
110110
#endif
111-
#ifdef DLT_USB_LINUX
112-
{ usb_linux_48_byte_if_print, DLT_USB_LINUX},
113-
#endif /* DLT_USB_LINUX */
114-
#ifdef DLT_USB_LINUX_MMAPPED
115-
{ usb_linux_64_byte_if_print, DLT_USB_LINUX_MMAPPED},
116-
#endif /* DLT_USB_LINUX_MMAPPED */
117111
#ifdef DLT_C_HDLC
118112
{ chdlc_if_print, DLT_C_HDLC },
119113
#endif
@@ -255,6 +249,12 @@ static const struct void_printer void_printers[] = {
255249
#ifdef DLT_SYMANTEC_FIREWALL
256250
{ symantec_if_print, DLT_SYMANTEC_FIREWALL },
257251
#endif
252+
#ifdef DLT_USB_LINUX
253+
{ usb_linux_48_byte_if_print, DLT_USB_LINUX},
254+
#endif /* DLT_USB_LINUX */
255+
#ifdef DLT_USB_LINUX_MMAPPED
256+
{ usb_linux_64_byte_if_print, DLT_USB_LINUX_MMAPPED},
257+
#endif /* DLT_USB_LINUX_MMAPPED */
258258
{ NULL, 0 },
259259
};
260260

0 commit comments

Comments
 (0)