]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ipnet.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-ipnet.c
index f958d42c032918d705f25aeb4c78cad609bbd480..65f626163b6d1a4eb98bcae328c0f8ed8da7d0db 100644 (file)
@@ -1,11 +1,10 @@
 /* \summary: Solaris DLT_IPNET printer */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "extract.h"
 
@@ -38,7 +37,6 @@ ipnet_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
        const ipnet_hdr_t *hdr;
        hdr = (const ipnet_hdr_t *)bp;
 
-       ND_TCHECK_SIZE(hdr);
        ND_PRINT("%u > %u", GET_BE_U_4(hdr->iph_zsrc),
                  GET_BE_U_4(hdr->iph_zdst));
 
@@ -55,9 +53,6 @@ ipnet_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
         }
 
        ND_PRINT(", length %u: ", length);
-       return;
-trunc:
-       nd_print_trunc(ndo);
 }
 
 static void
@@ -65,12 +60,8 @@ ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
 {
        const ipnet_hdr_t *hdr;
 
-       if (caplen < sizeof(ipnet_hdr_t)) {
-               ndo->ndo_ll_header_length += caplen;
-               nd_print_trunc(ndo);
-               return;
-       }
-       ndo->ndo_ll_header_length += sizeof(ipnet_hdr_t);
+       ND_TCHECK_LEN(p, sizeof(ipnet_hdr_t));
+       ndo->ndo_ll_hdr_len += sizeof(ipnet_hdr_t);
 
        if (ndo->ndo_eflag)
                ipnet_hdr_print(ndo, p, length);
@@ -99,7 +90,6 @@ ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
                        ND_DEFAULTPRINT(p, caplen);
                break;
        }
-       return;
 }
 
 /*