]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-llc.c
Avoiding conditional directives that break statements
[tcpdump] / print-llc.c
index 3839240a411d199710fdaf549e53ff7fcad3f2ee..aaaac8e1e8adbb14ee81ae8c835e3d6577a30c88 100644 (file)
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
-#include "extract.h"                   /* must come after interface.h */
+#include "extract.h"
 
 #include "llc.h"
 #include "ethertype.h"
@@ -150,17 +150,17 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
 {
        uint8_t dsap_field, dsap, ssap_field, ssap;
        uint16_t control;
-       u_int hdrlen;
+       int hdrlen;
        int is_u;
 
        if (caplen < 3) {
                ND_PRINT((ndo, "[|llc]"));
-               ND_DEFAULTPRINT((u_char *)p, caplen);
+               ND_DEFAULTPRINT((const u_char *)p, caplen);
                return (caplen);
        }
        if (length < 3) {
                ND_PRINT((ndo, "[|llc]"));
-               ND_DEFAULTPRINT((u_char *)p, caplen);
+               ND_DEFAULTPRINT((const u_char *)p, caplen);
                return (length);
        }
 
@@ -187,12 +187,12 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
                 */
                if (caplen < 4) {
                        ND_PRINT((ndo, "[|llc]"));
-                       ND_DEFAULTPRINT((u_char *)p, caplen);
+                       ND_DEFAULTPRINT((const u_char *)p, caplen);
                        return (caplen);
                }
                if (length < 4) {
                        ND_PRINT((ndo, "[|llc]"));
-                       ND_DEFAULTPRINT((u_char *)p, caplen);
+                       ND_DEFAULTPRINT((const u_char *)p, caplen);
                        return (length);
                }
 
@@ -230,13 +230,6 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
        dsap = dsap_field & ~LLC_IG;
        ssap = ssap_field & ~LLC_GSAP;
 
-       /*
-        * Skip LLC header.
-        */
-       p += hdrlen;
-       length -= hdrlen;
-       caplen -= hdrlen;
-
        if (ndo->ndo_eflag) {
                 ND_PRINT((ndo, "LLC, dsap %s (0x%02x) %s, ssap %s (0x%02x) %s",
                        tok2str(llc_values, "Unknown", dsap),
@@ -253,6 +246,13 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
                }
        }
 
+       /*
+        * Skip LLC header.
+        */
+       p += hdrlen;
+       length -= hdrlen;
+       caplen -= hdrlen;
+
        if (ssap == LLCSAP_SNAP && dsap == LLCSAP_SNAP
            && control == LLC_UI) {
                /*
@@ -303,7 +303,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
                return (hdrlen);
        }
 
-#ifdef TCPDUMP_DO_SMB
+#ifdef ENABLE_SMB
        if (ssap == LLCSAP_NETBEUI && dsap == LLCSAP_NETBEUI
            && (!(control & LLC_S_FMT) || control == LLC_U_FMT)) {
                /*