]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ARCNET: Update the link-layer dissectors to void functions
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 28 Mar 2020 19:56:02 +0000 (20:56 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 28 Mar 2020 19:56:02 +0000 (20:56 +0100)
netdissect.h
print-arcnet.c
print.c

index 401d62d72da5d914522d4ee650f8c3ff7be61ef0..1be9c1626db3c37155dec317cc6e0fd97916692a 100644 (file)
@@ -464,8 +464,8 @@ extern if_printer_t lookup_printer(netdissect_options *, int);
 /* The DLT printer routines */
 
 extern void ap1394_if_print IF_PRINTER_ARGS;
-extern u_int arcnet_if_print IF_PRINTER_ARGS;
-extern u_int arcnet_linux_if_print IF_PRINTER_ARGS;
+extern void arcnet_if_print IF_PRINTER_ARGS;
+extern void arcnet_linux_if_print IF_PRINTER_ARGS;
 extern u_int atm_if_print IF_PRINTER_ARGS;
 extern void bt_if_print IF_PRINTER_ARGS;
 extern u_int brcm_tag_if_print IF_PRINTER_ARGS;
index 7077c109438bbad6eeda2c7ed3b527b31e37d692..0fa64b29126a1e70f96fc842a6f929c0347ec38e 100644 (file)
@@ -178,7 +178,7 @@ arcnet_print(netdissect_options *ndo, const u_char *bp, u_int length, int phds,
  * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
-u_int
+void
 arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int caplen = h->caplen;
@@ -193,7 +193,8 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
        ndo->ndo_protocol = "arcnet_if";
        if (caplen < ARC_HDRLEN) {
                nd_print_trunc(ndo);
-               return (caplen);
+               ndo->ndo_ll_header_length += caplen;
+               return;
        }
 
        ap = (const struct arc_header *)p;
@@ -216,7 +217,8 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
                        arcnet_print(ndo, p, length, 0, 0, 0);
                        ND_PRINT(" phds");
                        nd_print_trunc(ndo);
-                       return (caplen);
+                       ndo->ndo_ll_header_length += caplen;
+                       return;
                }
 
                flag = GET_U_1(ap->arc_flag);
@@ -225,7 +227,8 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
                                arcnet_print(ndo, p, length, 0, 0, 0);
                                ND_PRINT(" phds extended");
                                nd_print_trunc(ndo);
-                               return (caplen);
+                               ndo->ndo_ll_header_length += caplen;
+                               return;
                        }
                        flag = GET_U_1(ap->arc_flag2);
                        seqid = GET_BE_U_2(ap->arc_seqid2);
@@ -251,13 +254,14 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
                /*
                 * This is a middle fragment.
                 */
-               return (archdrlen);
+               ndo->ndo_ll_header_length += archdrlen;
+               return;
        }
 
        if (!arcnet_encap_print(ndo, arc_type, p, length, caplen))
                ND_DEFAULTPRINT(p, caplen);
 
-       return (archdrlen);
+       ndo->ndo_ll_header_length += archdrlen;
 }
 
 /*
@@ -270,7 +274,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
  * reassembled packets rather than raw frames, and headers have an
  * extra "offset" field between the src/dest and packet type.
  */
-u_int
+void
 arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int caplen = h->caplen;
@@ -283,7 +287,8 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons
        ndo->ndo_protocol = "arcnet_linux_if";
        if (caplen < ARC_LINUX_HDRLEN) {
                nd_print_trunc(ndo);
-               return (caplen);
+               ndo->ndo_ll_header_length += caplen;
+               return;
        }
 
        ap = (const struct arc_linux_header *)p;
@@ -294,7 +299,8 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons
                archdrlen = ARC_LINUX_HDRNEWLEN;
                if (caplen < ARC_LINUX_HDRNEWLEN) {
                        nd_print_trunc(ndo);
-                       return (caplen);
+                       ndo->ndo_ll_header_length += caplen;
+                       return;
                }
                break;
        case ARCTYPE_IP_OLD:
@@ -317,7 +323,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons
        if (!arcnet_encap_print(ndo, arc_type, p, length, caplen))
                ND_DEFAULTPRINT(p, caplen);
 
-       return (archdrlen);
+       ndo->ndo_ll_header_length += archdrlen;
 }
 
 /*
diff --git a/print.c b/print.c
index 4f5de270ce12baa857dd287aac1adce29ab0d69e..5998c6d983e77d08b61a07c8170869c7a96b5511 100644 (file)
--- a/print.c
+++ b/print.c
@@ -83,10 +83,6 @@ static const struct uint_printer uint_printers[] = {
 #endif
 #ifdef DLT_LANE8023
        { lane_if_print,        DLT_LANE8023 },
-#endif
-       { arcnet_if_print,      DLT_ARCNET },
-#ifdef DLT_ARCNET_LINUX
-       { arcnet_linux_if_print, DLT_ARCNET_LINUX },
 #endif
 #ifdef DLT_IPOIB
        { ipoib_if_print,       DLT_IPOIB },
@@ -216,6 +212,10 @@ static const struct uint_printer uint_printers[] = {
 static const struct void_printer void_printers[] = {
 #ifdef DLT_APPLE_IP_OVER_IEEE1394
        { ap1394_if_print,      DLT_APPLE_IP_OVER_IEEE1394 },
+#endif
+       { arcnet_if_print,      DLT_ARCNET },
+#ifdef DLT_ARCNET_LINUX
+       { arcnet_linux_if_print, DLT_ARCNET_LINUX },
 #endif
 #ifdef DLT_BLUETOOTH_HCI_H4_WITH_PHDR
        { bt_if_print,          DLT_BLUETOOTH_HCI_H4_WITH_PHDR},