]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-null.c
Merge pull request #760 from leres/master
[tcpdump] / print-null.c
index f1067ff5ca1d673560b0a7aad96b0026f786e125..f730a23f405f96cbd6d54dc9995958fc877504ce 100644 (file)
@@ -33,7 +33,6 @@
 #include "extract.h"
 #include "af.h"
 
-static const char tstr[] = " [|null]";
 
 /*
  * The DLT_NULL packet header is 4 bytes long. It contains a host-byte-order
@@ -82,11 +81,12 @@ null_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
        u_int caplen = h->caplen;
        uint32_t family;
 
+       ndo->ndo_protocol = "null_if";
        if (caplen < NULL_HDRLEN)
                goto trunc;
 
        ND_TCHECK_4(p);
-       memcpy((char *)&family, (const char *)p, sizeof(family));
+       family = GET_HE_U_4(p);
 
        /*
         * This isn't necessarily in our host byte order; if this is
@@ -140,13 +140,6 @@ null_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
 
        return (NULL_HDRLEN);
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
        return (NULL_HDRLEN);
 }
-
-/*
- * Local Variables:
- * c-style: whitesmith
- * c-basic-offset: 8
- * End:
- */