]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-chdlc.c
Avoiding conditional directives that break statements
[tcpdump] / print-chdlc.c
index 8e8bb46dfff581a9024b7faf87762677a56fa01f..ef22a36d2a4bd394af0c34e31cd8449aa8aa0576 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
 #include "ethertype.h"
 #include "extract.h"
@@ -56,7 +55,8 @@ chdlc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register co
 }
 
 u_int
-chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length) {
+chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length)
+{
        u_int proto;
 
        proto = EXTRACT_16BITS(&p[2]);
@@ -75,11 +75,9 @@ chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length) {
        case ETHERTYPE_IP:
                ip_print(ndo, p, length);
                break;
-#ifdef INET6
        case ETHERTYPE_IPV6:
                ip6_print(ndo, p, length);
                break;
-#endif
        case CHDLC_TYPE_SLARP:
                chdlc_slarp_print(ndo, p, length);
                break;
@@ -172,8 +170,7 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length)
 
                 if (length >= SLARP_MAX_LEN) { /* uptime-stamp is optional */
                         cp += SLARP_MIN_LEN;
-                        if (!ND_TTEST2(*cp, 4))
-                                goto trunc;
+                        ND_TCHECK2(*cp, 4);
                         sec = EXTRACT_32BITS(cp) / 1000;
                         min = sec / 60; sec -= min * 60;
                         hrs = min / 60; min -= hrs * 60;