]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-atm.c
Default to first interface from pcap_findalldevs()
[tcpdump] / print-atm.c
index b5d3385f4671e69622c8aeadeec524e0d2240498..7489158b5ba0605c2771d96d50e2415d7dc6c422 100644 (file)
@@ -23,9 +23,9 @@
 #include "config.h"
 #endif
 
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
 
-#include "interface.h"
+#include "netdissect.h"
 #include "extract.h"
 #include "addrtoname.h"
 #include "atm.h"
 #include "extract.h"
 #include "addrtoname.h"
 #include "atm.h"
@@ -214,22 +214,20 @@ static const struct tok *oam_functype_values[16] = {
 /*
  * Print an RFC 1483 LLC-encapsulated ATM frame.
  */
 /*
  * Print an RFC 1483 LLC-encapsulated ATM frame.
  */
-static void
+static u_int
 atm_llc_print(netdissect_options *ndo,
               const u_char *p, int length, int caplen)
 {
 atm_llc_print(netdissect_options *ndo,
               const u_char *p, int length, int caplen)
 {
-       u_short extracted_ethertype;
-
-       if (!llc_print(ndo, p, length, caplen, NULL, NULL,
-           &extracted_ethertype)) {
-               /* ether_type not known, print raw packet */
-               if (extracted_ethertype) {
-                       ND_PRINT((ndo, "(LLC %s) ",
-               etherproto_string(htons(extracted_ethertype))));
-               }
+       int llc_hdrlen;
+
+       llc_hdrlen = llc_print(ndo, p, length, caplen, NULL, NULL);
+       if (llc_hdrlen < 0) {
+               /* packet not known, print raw packet */
                if (!ndo->ndo_suppress_default_print)
                        ND_DEFAULTPRINT(p, caplen);
                if (!ndo->ndo_suppress_default_print)
                        ND_DEFAULTPRINT(p, caplen);
+               llc_hdrlen = -llc_hdrlen;
        }
        }
+       return (llc_hdrlen);
 }
 
 /*
 }
 
 /*
@@ -317,7 +315,7 @@ atm_if_print(netdissect_options *ndo,
                caplen -= 20;
                hdrlen += 20;
        }
                caplen -= 20;
                hdrlen += 20;
        }
-       atm_llc_print(ndo, p, length, caplen);
+       hdrlen += atm_llc_print(ndo, p, length, caplen);
        return (hdrlen);
 }
 
        return (hdrlen);
 }