aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capture_info.c6
-rw-r--r--epan/dissectors/Makefile.common1
-rw-r--r--epan/dissectors/packet-enc.c24
-rw-r--r--epan/dissectors/packet-enc.h29
4 files changed, 43 insertions, 17 deletions
diff --git a/capture_info.c b/capture_info.c
index 192c64ce0c..66ec62e6c2 100644
--- a/capture_info.c
+++ b/capture_info.c
@@ -54,8 +54,7 @@
#include <epan/dissectors/packet-prism.h>
#include <epan/dissectors/packet-ipfc.h>
#include <epan/dissectors/packet-arcnet.h>
-
-
+#include <epan/dissectors/packet-enc.h>
static void capture_info_packet(
packet_counts *counts, gint wtap_linktype, const guchar *pd, guint32 caplen, union wtap_pseudo_header *pseudo_header);
@@ -216,6 +215,9 @@ capture_info_packet(packet_counts *counts, gint wtap_linktype, const guchar *pd,
case WTAP_ENCAP_FRELAY_WITH_PHDR:
capture_fr(pd, 0, caplen, counts);
break;
+ case WTAP_ENCAP_ENC:
+ capture_enc(pd, caplen, counts);
+ break;
/* XXX - some ATM drivers on FreeBSD might prepend a 4-byte ATM
pseudo-header to DLT_ATM_RFC1483, with LLC header following;
we might have to implement that at some point. */
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index 027e4b29ed..aeec387053 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -728,6 +728,7 @@ DISSECTOR_INCLUDES = \
packet-dvmrp.h \
packet-e164.h \
packet-edonkey.h \
+ packet-enc.h \
packet-esis.h \
packet-ess.h \
packet-eth.h \
diff --git a/epan/dissectors/packet-enc.c b/epan/dissectors/packet-enc.c
index 701e2294e9..7e81cfe10b 100644
--- a/epan/dissectors/packet-enc.c
+++ b/epan/dissectors/packet-enc.c
@@ -32,6 +32,7 @@
#include <epan/packet.h>
#include <epan/etypes.h>
#include <epan/addr_resolv.h>
+#include "packet-enc.h"
#include "packet-ip.h"
#include "packet-ipv6.h"
@@ -67,33 +68,26 @@ static int hf_enc_flags = -1;
static gint ett_enc = -1;
-static void
-capture_enc(const guchar *pd, int offset, int len, packet_counts *ld)
+void
+capture_enc(const guchar *pd, int len, packet_counts *ld)
{
- struct enchdr ench;
+ guint32 af;
- if (!BYTES_ARE_IN_FRAME(offset, len, (int)ENC_HDRLEN)) {
+ if (!BYTES_ARE_IN_FRAME(0, len, (int)ENC_HDRLEN)) {
ld->other++;
return;
}
- offset += ENC_HDRLEN;
-
- /* Copy out the enc header to insure alignment */
- memcpy(&ench, pd, sizeof(ench));
- ench.af = g_ntohl(ench.af);
-
- switch (ench.af) {
+ af = pntohl(pd + offsetof(struct enchdr, af));
+ switch (af) {
case BSD_ENC_INET:
- capture_ip(pd, offset, len, ld);
+ capture_ip(pd, ENC_HDRLEN, len, ld);
break;
-#ifdef notyet
case BSD_ENC_INET6:
- capture_ipv6(pd, offset, len, ld);
+ capture_ipv6(pd, ENC_HDRLEN, len, ld);
break;
-#endif
default:
ld->other++;
diff --git a/epan/dissectors/packet-enc.h b/epan/dissectors/packet-enc.h
new file mode 100644
index 0000000000..c6795a3251
--- /dev/null
+++ b/epan/dissectors/packet-enc.h
@@ -0,0 +1,29 @@
+/* packet-enc.h
+ *
+ * $Id$
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PACKET_ENC_H__
+#define __PACKET_ENC_H__
+
+void capture_enc(const guchar *, int, packet_counts *);
+
+#endif