]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-symantec.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / print-symantec.c
index a421b2d39917f2e01bfa2f138fad49f1d8fc5a0a..0d394e30f2ec8b79becd4b825c35154bcaffce85 100644 (file)
 /* \summary: Symantec Enterprise Firewall printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "extract.h"
 #include "ethertype.h"
@@ -37,7 +38,7 @@ struct symantec_header {
        nd_byte     stuff2[36];
 };
 
-static inline void
+static void
 symantec_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
 {
        const struct symantec_header *sp;
@@ -45,7 +46,7 @@ symantec_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
 
        sp = (const struct symantec_header *)bp;
 
-       etype = EXTRACT_BE_U_2(sp->ether_type);
+       etype = GET_BE_U_2(sp->ether_type);
        if (!ndo->ndo_qflag) {
                if (etype <= MAX_ETHERNET_LENGTH_VAL)
                          ND_PRINT("invalid ethertype %u", etype);
@@ -69,7 +70,7 @@ symantec_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
  * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
-u_int
+void
 symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int length = h->len;
@@ -77,11 +78,10 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
        const struct symantec_header *sp;
        u_short ether_type;
 
-       if (caplen < sizeof (struct symantec_header)) {
-               ND_PRINT("[|symantec]");
-               return caplen;
-       }
+       ndo->ndo_protocol = "symantec";
+       ND_TCHECK_LEN(p, sizeof(struct symantec_header));
 
+       ndo->ndo_ll_hdr_len += sizeof (struct symantec_header);
        if (ndo->ndo_eflag)
                symantec_hdr_print(ndo, p, length);
 
@@ -90,7 +90,7 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
        sp = (const struct symantec_header *)p;
        p += sizeof (struct symantec_header);
 
-       ether_type = EXTRACT_BE_U_2(sp->ether_type);
+       ether_type = GET_BE_U_2(sp->ether_type);
 
        if (ether_type <= MAX_ETHERNET_LENGTH_VAL) {
                /* ether_type not known, print raw packet */
@@ -107,6 +107,4 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_
                if (!ndo->ndo_suppress_default_print)
                        ND_DEFAULTPRINT(p, caplen);
        }
-
-       return (sizeof (struct symantec_header));
 }