]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ipfc.c
Skip the LLC and SNAP headers with -x.
[tcpdump] / print-ipfc.c
index b2869eb81318f6ceb73dc81ee9893c351f33981f..6d07f80edfe21cb08ba75eab9390295347b51579 100644 (file)
@@ -76,15 +76,16 @@ ipfc_hdr_print(netdissect_options *ndo,
        ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length));
 }
 
-static void
+static u_int
 ipfc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
 {
        const struct ipfc_header *ipfcp = (const struct ipfc_header *)p;
        struct ether_header ehdr;
+       int llc_hdrlen;
 
        if (caplen < IPFC_HDRLEN) {
                ND_PRINT((ndo, "[|ipfc]"));
-               return;
+               return (caplen);
        }
        /*
         * Get the network addresses into a canonical form
@@ -100,14 +101,17 @@ ipfc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
        caplen -= IPFC_HDRLEN;
 
        /* Try to print the LLC-layer header & higher layers */
-       if (llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr)) == 0) {
+       llc_hdrlen = llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr));
+       if (llc_hdrlen < 0) {
                /*
                 * Some kinds of LLC packet we cannot
                 * handle intelligently
                 */
                if (!ndo->ndo_suppress_default_print)
                        ND_DEFAULTPRINT(p, caplen);
+               llc_hdrlen = -llc_hdrlen;
        }
+       return (IPFC_HDRLEN + llc_hdrlen);
 }
 
 /*
@@ -119,7 +123,5 @@ ipfc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
 u_int
 ipfc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p)
 {
-       ipfc_print(ndo, p, h->len, h->caplen);
-
-       return (IPFC_HDRLEN);
+       return (ipfc_print(ndo, p, h->len, h->caplen));
 }