]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ATM: Update the link-layer dissector to a void function
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 2 Aug 2020 11:58:24 +0000 (13:58 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 2 Aug 2020 20:11:51 +0000 (22:11 +0200)
Moreover:
Remove trailing "_if" from the protocol name.

netdissect.h
print-atm.c
print.c

index 34051267a3647b3fb71efcf35f5ff2d16439a3b8..408cff8a026dc0275ca3f40b6f6b875b4b5fc9c8 100644 (file)
@@ -468,7 +468,7 @@ extern if_printer_t lookup_printer(netdissect_options *, int);
 extern void ap1394_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 atm_if_print IF_PRINTER_ARGS;
 extern void bt_if_print IF_PRINTER_ARGS;
 extern void brcm_tag_if_print IF_PRINTER_ARGS;
 extern void brcm_tag_prepend_if_print IF_PRINTER_ARGS;
index e6b7caa3a3dc4cbe54275f6fc0951b2514d65dd2..33a5cafa3505d7f5e2c3c9c62daf4ac49056038e 100644 (file)
@@ -243,7 +243,7 @@ atm_llc_print(netdissect_options *ndo,
  * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
-u_int
+void
 atm_if_print(netdissect_options *ndo,
              const struct pcap_pkthdr *h, const u_char *p)
 {
@@ -252,10 +252,11 @@ atm_if_print(netdissect_options *ndo,
        uint32_t llchdr;
        u_int hdrlen = 0;
 
-       ndo->ndo_protocol = "atm_if";
+       ndo->ndo_protocol = "atm";
        if (caplen < 1) {
                nd_print_trunc(ndo);
-               return (caplen);
+               ndo->ndo_ll_hdr_len += caplen;
+               return;
        }
 
         /* Cisco Style NLPID ? */
@@ -263,7 +264,8 @@ atm_if_print(netdissect_options *ndo,
             if (ndo->ndo_eflag)
                 ND_PRINT("CNLPID ");
             isoclns_print(ndo, p + 1, length - 1);
-            return hdrlen;
+            ndo->ndo_ll_hdr_len += hdrlen;
+            return;
         }
 
        /*
@@ -272,7 +274,8 @@ atm_if_print(netdissect_options *ndo,
         */
        if (caplen < 3) {
                nd_print_trunc(ndo);
-               return (caplen);
+               ndo->ndo_ll_hdr_len += caplen;
+               return;
        }
 
        /*
@@ -304,7 +307,8 @@ atm_if_print(netdissect_options *ndo,
                 */
                if (caplen < 20) {
                        nd_print_trunc(ndo);
-                       return (caplen);
+                       ndo->ndo_ll_hdr_len += caplen;
+                       return;
                }
                if (ndo->ndo_eflag)
                        ND_PRINT("%08x%08x %08x%08x ",
@@ -318,7 +322,7 @@ atm_if_print(netdissect_options *ndo,
                hdrlen += 20;
        }
        hdrlen += atm_llc_print(ndo, p, length, caplen);
-       return (hdrlen);
+       ndo->ndo_ll_hdr_len += hdrlen;
 }
 
 /*
diff --git a/print.c b/print.c
index 14a7f5f0e30b54407c3b13f7a969c4ce665bda59..414a8955a134c207ab3c4dada3d6ea537261d9a0 100644 (file)
--- a/print.c
+++ b/print.c
@@ -74,7 +74,6 @@ static const struct uint_printer uint_printers[] = {
 #ifdef DLT_MFR
        { mfr_if_print,         DLT_MFR },
 #endif
-       { atm_if_print,         DLT_ATM_RFC1483 },
 #ifdef DLT_LTALK
        { ltalk_if_print,       DLT_LTALK },
 #endif
@@ -99,6 +98,7 @@ static const struct void_printer void_printers[] = {
 #ifdef DLT_ARCNET_LINUX
        { arcnet_linux_if_print, DLT_ARCNET_LINUX },
 #endif
+       { atm_if_print,         DLT_ATM_RFC1483 },
 #ifdef DLT_DSA_TAG_BRCM
        { brcm_tag_if_print,    DLT_DSA_TAG_BRCM },
 #endif