aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-04-20 07:05:58 +0000
committerGuy Harris <guy@alum.mit.edu>2000-04-20 07:05:58 +0000
commitedd1f261709079cbe0ebe7f9bb8b447a250271c5 (patch)
treec53d7501daab4f29fddb7a458d040b7799b4eea9
parentc2a68f6b86c75772f44e15b5d926ea25966e9241 (diff)
Have the IPv6 dissector use the same dissector table as the IPv4
dissector. Don't dissect the payload of any fragmented IPv6 packet unless it's the initial fragment (that's what we do for IPv4). svn path=/trunk/; revision=1882
-rw-r--r--Makefile.am4
-rw-r--r--packet-icmpv6.c12
-rw-r--r--packet-icmpv6.h26
-rw-r--r--packet-ip.c48
-rw-r--r--packet-ip.h5
-rw-r--r--packet-ipsec.c6
-rw-r--r--packet-ipsec.h4
-rw-r--r--packet-ipv6.c93
-rw-r--r--packet-pim.c4
-rw-r--r--packet-pim.h26
-rw-r--r--packet-tcp.c4
-rw-r--r--packet-tcp.h4
-rw-r--r--packet-udp.c4
-rw-r--r--packet-udp.h4
14 files changed, 71 insertions, 173 deletions
diff --git a/Makefile.am b/Makefile.am
index d9d3d187df..7db57f76b1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
-# $Id: Makefile.am,v 1.190 2000/04/20 02:17:54 guy Exp $
+# $Id: Makefile.am,v 1.191 2000/04/20 07:05:52 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@@ -82,7 +82,6 @@ DISSECTOR_SOURCES = \
packet-http.c \
packet-http.h \
packet-icmpv6.c\
- packet-icmpv6.h\
packet-icp.c \
packet-icq.c \
packet-imap.c \
@@ -148,7 +147,6 @@ DISSECTOR_SOURCES = \
packet-ospf.c \
packet-ospf.h \
packet-pim.c \
- packet-pim.h \
packet-pop.c \
packet-portmap.c \
packet-portmap.h \
diff --git a/packet-icmpv6.c b/packet-icmpv6.c
index 9d39912efa..6f6125e28f 100644
--- a/packet-icmpv6.c
+++ b/packet-icmpv6.c
@@ -1,7 +1,7 @@
/* packet-icmpv6.c
* Routines for ICMPv6 packet disassembly
*
- * $Id: packet-icmpv6.c,v 1.14 2000/03/12 04:47:38 gram Exp $
+ * $Id: packet-icmpv6.c,v 1.15 2000/04/20 07:05:53 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -56,6 +56,7 @@
#include <glib.h>
#include "packet.h"
#include "packet-ipv6.h"
+#include "packet-ip.h"
#include "resolv.h"
#ifndef offsetof
@@ -198,7 +199,7 @@ again:
goto again;
}
-void
+static void
dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
proto_tree *icmp6_tree, *field_tree;
@@ -600,3 +601,10 @@ proto_register_icmpv6(void)
proto_register_field_array(proto_icmpv6, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
+
+void
+proto_reg_handoff_icmpv6(void)
+{
+ dissector_add("ip.proto", IP_PROTO_ICMPV6, dissect_icmpv6);
+}
+
diff --git a/packet-icmpv6.h b/packet-icmpv6.h
deleted file mode 100644
index 3134d28939..0000000000
--- a/packet-icmpv6.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* packet-icmpv6.h
- *
- * $Id: packet-icmpv6.h,v 1.1 2000/02/15 21:02:14 gram Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * 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.
- */
-
-
-void dissect_icmpv6(const u_char *, int, frame_data *, proto_tree *);
diff --git a/packet-ip.c b/packet-ip.c
index 11c91b9288..b0c66f3b49 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
- * $Id: packet-ip.c,v 1.82 2000/04/17 00:32:38 guy Exp $
+ * $Id: packet-ip.c,v 1.83 2000/04/20 07:05:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -98,7 +98,8 @@ static gint ett_ip_option_sec = -1;
static gint ett_ip_option_route = -1;
static gint ett_ip_option_timestamp = -1;
-static dissector_table_t ip_dissector_table;
+/* Used by IPv6 as well, so not static */
+dissector_table_t ip_dissector_table;
static int proto_igmp = -1;
static int hf_igmp_version = -1;
@@ -862,28 +863,6 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
/* XXX - check to make sure this is at least IPH_MIN_LEN. */
hlen = lo_nibble(iph.ip_v_hl) * 4; /* IP header length, in bytes */
- switch (iph.ip_p) {
- case IP_PROTO_ICMP:
- case IP_PROTO_IGMP:
- case IP_PROTO_TCP:
- case IP_PROTO_UDP:
- case IP_PROTO_OSPF:
- case IP_PROTO_GRE:
- case IP_PROTO_ESP:
- case IP_PROTO_AH:
- case IP_PROTO_IPV6:
- case IP_PROTO_PIM:
- case IP_PROTO_VINES:
- /* Names are set in the associated dissect_* routines */
- break;
- default:
- if (check_col(fd, COL_PROTOCOL))
- col_add_str(fd, COL_PROTOCOL, "IP");
- if (check_col(fd, COL_INFO))
- col_add_fstr(fd, COL_INFO, "%s (0x%02x)",
- ipprotostr(iph.ip_p), iph.ip_p);
- }
-
if (tree) {
switch (IPTOS_TOS(iph.ip_tos)) {
@@ -995,20 +974,22 @@ dissect_ip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
}
again:
-
- /* do lookup with the subdissector table */
- if (dissector_try_port(ip_dissector_table, nxt, pd, offset, fd, tree))
- return;
-
switch (nxt) {
case IP_PROTO_AH:
advance = dissect_ah(pd, offset, fd, tree);
nxt = pd[offset];
offset += advance;
goto again;
- default:
- dissect_data(pd, offset, fd, tree);
- break;
+ }
+
+ /* do lookup with the subdissector table */
+ if (!dissector_try_port(ip_dissector_table, nxt, pd, offset, fd, tree)) {
+ /* Unknown protocol */
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, "IP");
+ if (check_col(fd, COL_INFO))
+ col_add_fstr(fd, COL_INFO, "%s (0x%02x)", ipprotostr(iph.ip_p), iph.ip_p);
+ dissect_data(pd, offset, fd, tree);
}
}
@@ -1486,8 +1467,9 @@ proto_reg_handoff_ip(void)
{
dissector_add("ethertype", ETHERTYPE_IP, dissect_ip);
dissector_add("ppp.protocol", PPP_IP, dissect_ip);
- dissector_add("ip.proto", IP_PROTO_IPV4, dissect_ip);
dissector_add("llc.dsap", SAP_IP, dissect_ip);
+ dissector_add("ip.proto", IP_PROTO_IPV4, dissect_ip);
+ dissector_add("ip.proto", IP_PROTO_IPIP, dissect_ip);
}
void
diff --git a/packet-ip.h b/packet-ip.h
index 24f94d58e0..025b7a201c 100644
--- a/packet-ip.h
+++ b/packet-ip.h
@@ -1,7 +1,7 @@
/* packet-ip.h
* Definitions for IP packet disassembly structures and routines
*
- * $Id: packet-ip.h,v 1.11 2000/02/15 21:02:18 gram Exp $
+ * $Id: packet-ip.h,v 1.12 2000/04/20 07:05:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -83,4 +83,7 @@ typedef struct ip_tcp_opt {
void dissect_ip_tcp_options(const u_char *, int, guint,
const ip_tcp_opt *, int, int, proto_tree *);
+/* Dissector table for "ip.proto"; used by IPv6 as well as IPv4 */
+dissector_table_t ip_dissector_table;
+
#endif
diff --git a/packet-ipsec.c b/packet-ipsec.c
index 3475cf852f..8fd2b5d882 100644
--- a/packet-ipsec.c
+++ b/packet-ipsec.c
@@ -1,7 +1,7 @@
/* packet-ipsec.c
* Routines for IPsec/IPComp packet disassembly
*
- * $Id: packet-ipsec.c,v 1.13 2000/04/16 22:46:20 guy Exp $
+ * $Id: packet-ipsec.c,v 1.14 2000/04/20 07:05:55 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -141,7 +141,7 @@ dissect_ah(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
return advance;
}
-void
+static void
dissect_esp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
proto_tree *esp_tree;
@@ -178,7 +178,7 @@ dissect_esp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
}
}
-void
+static void
dissect_ipcomp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
proto_tree *ipcomp_tree;
diff --git a/packet-ipsec.h b/packet-ipsec.h
index bb945d2619..38bea778b8 100644
--- a/packet-ipsec.h
+++ b/packet-ipsec.h
@@ -1,6 +1,6 @@
/* packet-ipsec.h
*
- * $Id: packet-ipsec.h,v 1.1 2000/02/15 21:02:20 gram Exp $
+ * $Id: packet-ipsec.h,v 1.2 2000/04/20 07:05:55 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -24,5 +24,3 @@
int dissect_ah(const u_char *, int, frame_data *, proto_tree *);
-void dissect_esp(const u_char *, int, frame_data *, proto_tree *);
-void dissect_ipcomp(const u_char *, int, frame_data *, proto_tree *);
diff --git a/packet-ipv6.c b/packet-ipv6.c
index 35226668ac..267a7ae543 100644
--- a/packet-ipv6.c
+++ b/packet-ipv6.c
@@ -1,7 +1,7 @@
/* packet-ipv6.c
* Routines for IPv6 packet disassembly
*
- * $Id: packet-ipv6.c,v 1.34 2000/04/16 22:46:20 guy Exp $
+ * $Id: packet-ipv6.c,v 1.35 2000/04/20 07:05:56 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -45,11 +45,9 @@
#include "etypes.h"
#include "ppptypes.h"
#include "packet.h"
-#include "packet-icmpv6.h"
#include "packet-ip.h"
#include "packet-ipsec.h"
#include "packet-ipv6.h"
-#include "packet-pim.h"
#include "packet-tcp.h"
#include "packet-udp.h"
#include "resolv.h"
@@ -268,9 +266,6 @@ dissect_ipv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
SET_ADDRESS(&pi.net_dst, AT_IPv6, 16, &pd[offset + IP6H_DST]);
SET_ADDRESS(&pi.dst, AT_IPv6, 16, &pd[offset + IP6H_DST]);
- if (check_col(fd, COL_PROTOCOL))
- col_add_str(fd, COL_PROTOCOL, "IPv6");
-
if (tree) {
/* !!! specify length */
ti = proto_tree_add_item(tree, proto_ipv6, offset, 40, NULL);
@@ -345,9 +340,6 @@ again:
nxt = pd[poffset = offset];
offset += advance;
goto again;
- case IP_PROTO_IPIP:
- dissect_ip(pd, offset, fd, tree);
- break;
case IP_PROTO_ROUTING:
advance = dissect_routing6(pd, offset, fd, tree);
nxt = pd[poffset = offset];
@@ -358,74 +350,46 @@ again:
nxt = pd[poffset = offset];
offset += advance;
goto again;
- case IP_PROTO_ICMPV6:
-#ifdef TEST_FINALHDR
- proto_tree_add_item_hidden(ipv6_tree, hf_ipv6_final, poffset, 1, nxt);
-#endif
- if (!frag)
- dissect_icmpv6(pd, offset, fd, tree);
- else
- dissect_data(pd, offset, fd, tree);
- break;
- case IP_PROTO_NONE:
-#ifdef TEST_FINALHDR
- proto_tree_add_item_hidden(ipv6_tree, hf_ipv6_final, poffset, 1, nxt);
-#endif
- if (check_col(fd, COL_INFO)) {
- col_add_fstr(fd, COL_INFO, "IPv6 no next header");
- }
- break;
case IP_PROTO_AH:
advance = dissect_ah(pd, offset, fd, tree);
nxt = pd[poffset = offset];
offset += advance;
goto again;
- case IP_PROTO_ESP:
- dissect_esp(pd, offset, fd, tree);
- break;
case IP_PROTO_DSTOPTS:
advance = dissect_dstopts(pd, offset, fd, tree);
nxt = pd[poffset = offset];
offset += advance;
goto again;
- case IP_PROTO_TCP:
-#ifdef TEST_FINALHDR
- proto_tree_add_item_hidden(ipv6_tree, hf_ipv6_final, poffset, 1, nxt);
-#endif
- if (!frag)
- dissect_tcp(pd, offset, fd, tree);
- else
- dissect_data(pd, offset, fd, tree);
- break;
- case IP_PROTO_UDP:
-#ifdef TEST_FINALHDR
- proto_tree_add_item_hidden(ipv6_tree, hf_ipv6_final, poffset, 1, nxt);
-#endif
- if (!frag)
- dissect_udp(pd, offset, fd, tree);
- else
- dissect_data(pd, offset, fd, tree);
- break;
- case IP_PROTO_PIM:
-#ifdef TEST_FINALHDR
- proto_tree_add_item_hidden(ipv6_tree, hf_ipv6_final, poffset, 1, nxt);
-#endif
- dissect_pim(pd, offset, fd, tree);
- break;
- case IP_PROTO_IPCOMP:
- dissect_ipcomp(pd, offset, fd, tree);
- break;
- default:
+ }
+
#ifdef TEST_FINALHDR
- proto_tree_add_item_hidden(ipv6_tree, hf_ipv6_final, poffset, 1, nxt);
+ proto_tree_add_item_hidden(ipv6_tree, hf_ipv6_final, poffset, 1, nxt);
#endif
- if (check_col(fd, COL_INFO)) {
- col_add_fstr(fd, COL_INFO, "%s (0x%02x)",
- ipprotostr(nxt), nxt);
- }
- dissect_data(pd, offset, fd, tree);
- break;
+ if (frag) {
+ /* fragmented */
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, "IPv6");
+ /* COL_INFO was filled in by "dissect_frag6()" */
+ dissect_data(pd, offset, fd, tree);
+ } else {
+ /* do lookup with the subdissector table */
+ if (!dissector_try_port(ip_dissector_table, nxt, pd, offset, fd, tree)) {
+ /* Unknown protocol */
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, "IPv6");
+ if (check_col(fd, COL_INFO))
+ col_add_fstr(fd, COL_INFO, "%s (0x%02x)", ipprotostr(nxt), nxt);
+ dissect_data(pd, offset, fd, tree);
}
+ }
+}
+
+static void
+dissect_ipv6_none(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
+ if (check_col(fd, COL_INFO))
+ col_add_fstr(fd, COL_INFO, "IPv6 no next header");
+
+ /* XXX - dissect the payload as padding? */
}
void
@@ -479,4 +443,5 @@ proto_reg_handoff_ipv6(void)
dissector_add("ethertype", ETHERTYPE_IPv6, dissect_ipv6);
dissector_add("ppp.protocol", PPP_IPV6, dissect_ipv6);
dissector_add("ip.proto", IP_PROTO_IPV6, dissect_ipv6);
+ dissector_add("ip.proto", IP_PROTO_NONE, dissect_ipv6_none);
}
diff --git a/packet-pim.c b/packet-pim.c
index 9868af188c..4bb7065020 100644
--- a/packet-pim.c
+++ b/packet-pim.c
@@ -2,7 +2,7 @@
* Routines for PIM disassembly
* (c) Copyright Jun-ichiro itojun Hagino <itojun@itojun.org>
*
- * $Id: packet-pim.c,v 1.11 2000/04/16 22:46:22 guy Exp $
+ * $Id: packet-pim.c,v 1.12 2000/04/20 07:05:56 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -162,7 +162,7 @@ dissect_pim_addr(const u_char *bp, const u_char *ep, enum pimv2_addrtype at,
return buf;
}
-void
+static void
dissect_pim(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
struct pim pim;
static const value_string type1vals[] = {
diff --git a/packet-pim.h b/packet-pim.h
deleted file mode 100644
index 7023542ea4..0000000000
--- a/packet-pim.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* packet-pim.h
- *
- * $Id: packet-pim.h,v 1.1 2000/02/15 21:02:50 gram Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * 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.
- */
-
-
-void dissect_pim(const u_char *, int, frame_data *, proto_tree *);
diff --git a/packet-tcp.c b/packet-tcp.c
index 64fec61cb4..67b4b6dbe0 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.71 2000/04/17 02:39:54 guy Exp $
+ * $Id: packet-tcp.c,v 1.72 2000/04/20 07:05:57 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -423,7 +423,7 @@ decode_tcp_ports( const u_char *pd, int offset, frame_data *fd, proto_tree *tree
}
-void
+static void
dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
e_tcphdr th;
proto_tree *tcp_tree = NULL, *field_tree = NULL;
diff --git a/packet-tcp.h b/packet-tcp.h
index d57793e0ec..f903a80e5e 100644
--- a/packet-tcp.h
+++ b/packet-tcp.h
@@ -1,6 +1,6 @@
/* packet-tcp.h
*
- * $Id: packet-tcp.h,v 1.3 2000/04/12 22:53:15 guy Exp $
+ * $Id: packet-tcp.h,v 1.4 2000/04/20 07:05:57 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -27,5 +27,3 @@ extern guint16 tcp_urgent_pointer;
extern void decode_tcp_ports(const u_char *, int, frame_data *,
proto_tree *, int, int);
-
-void dissect_tcp(const u_char *, int, frame_data *, proto_tree *);
diff --git a/packet-udp.c b/packet-udp.c
index eebfc9fa45..da4219969e 100644
--- a/packet-udp.c
+++ b/packet-udp.c
@@ -1,7 +1,7 @@
/* packet-udp.c
* Routines for UDP packet disassembly
*
- * $Id: packet-udp.c,v 1.68 2000/04/18 04:46:07 guy Exp $
+ * $Id: packet-udp.c,v 1.69 2000/04/20 07:05:57 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -140,7 +140,7 @@ decode_udp_ports( const u_char *pd, int offset, frame_data *fd,
}
-void
+static void
dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
e_udphdr uh;
guint16 uh_sport, uh_dport, uh_ulen, uh_sum;
diff --git a/packet-udp.h b/packet-udp.h
index 1187497e17..47ef7207e9 100644
--- a/packet-udp.h
+++ b/packet-udp.h
@@ -1,6 +1,6 @@
/* packet-udp.h
*
- * $Id: packet-udp.h,v 1.2 2000/04/12 22:53:16 guy Exp $
+ * $Id: packet-udp.h,v 1.3 2000/04/20 07:05:58 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -24,5 +24,3 @@
extern void decode_udp_ports(const u_char *, int, frame_data *,
proto_tree *, int, int);
-
-void dissect_udp(const u_char *, int, frame_data *, proto_tree *);