aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/packet.h3
-rw-r--r--packet-ip.c3
-rw-r--r--packet-ipv6.c94
3 files changed, 90 insertions, 10 deletions
diff --git a/epan/packet.h b/epan/packet.h
index 947797f301..394a849be4 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.62 2002/10/22 22:04:23 jmayer Exp $
+ * $Id: packet.h,v 1.63 2002/10/25 23:23:28 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -60,7 +60,6 @@ typedef struct _packet_counts {
gint gre;
gint netbios;
gint ipx;
- gint ipv6;
gint vines;
gint other;
gint total;
diff --git a/packet-ip.c b/packet-ip.c
index a6a1edb929..942e1921d7 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.175 2002/10/24 06:17:34 guy Exp $
+ * $Id: packet-ip.c,v 1.176 2002/10/25 23:23:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -356,6 +356,7 @@ capture_ip(const guchar *pd, int offset, int len, packet_counts *ld) {
ld->udp++;
break;
case IP_PROTO_ICMP:
+ case IP_PROTO_ICMPV6: /* XXX - separate counters? */
ld->icmp++;
break;
case IP_PROTO_OSPF:
diff --git a/packet-ipv6.c b/packet-ipv6.c
index 64b57a08c8..d884100d49 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.89 2002/10/24 06:17:34 guy Exp $
+ * $Id: packet-ipv6.c,v 1.90 2002/10/25 23:23:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -124,11 +124,91 @@ static GHashTable *ipv6_fragment_table = NULL;
void
capture_ipv6(const guchar *pd, int offset, int len, packet_counts *ld)
{
- ld->ipv6++;
- /* FIXME: We should count the actual ipv6 payload by protocol,
- * but it looks like we need to replicate quite a few
- * parts of the dissection stuff.
- */
+ guint8 nxt;
+ int advance;
+
+ if (!BYTES_ARE_IN_FRAME(offset, len, 4+4+16+16)) {
+ ld->other++;
+ return;
+ }
+ nxt = pd[offset+6]; /* get the "next header" value */
+ offset += 4+4+16+16; /* skip past the IPv6 header */
+ len -= 4+4+16+16;
+
+again:
+ switch (nxt) {
+ case IP_PROTO_HOPOPTS:
+ case IP_PROTO_ROUTING:
+ case IP_PROTO_DSTOPTS:
+ if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
+ ld->other++;
+ return;
+ }
+ nxt = pd[offset];
+ advance = (pd[offset+1] + 1) << 3;
+ if (!BYTES_ARE_IN_FRAME(offset, len, advance)) {
+ ld->other++;
+ return;
+ }
+ offset += advance;
+ len -= advance;
+ goto again;
+ case IP_PROTO_FRAGMENT:
+ if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
+ ld->other++;
+ return;
+ }
+ nxt = pd[offset];
+ advance = 8;
+ if (!BYTES_ARE_IN_FRAME(offset, len, advance)) {
+ ld->other++;
+ return;
+ }
+ offset += advance;
+ len -= advance;
+ goto again;
+ case IP_PROTO_AH:
+ if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
+ ld->other++;
+ return;
+ }
+ nxt = pd[offset];
+ advance = 8 + ((pd[offset+1] - 1) << 2);
+ if (!BYTES_ARE_IN_FRAME(offset, len, advance)) {
+ ld->other++;
+ return;
+ }
+ offset += advance;
+ len -= advance;
+ goto again;
+ }
+
+ switch(nxt) {
+ case IP_PROTO_SCTP:
+ ld->sctp++;
+ break;
+ case IP_PROTO_TCP:
+ ld->tcp++;
+ break;
+ case IP_PROTO_UDP:
+ ld->udp++;
+ break;
+ case IP_PROTO_ICMP:
+ case IP_PROTO_ICMPV6: /* XXX - separate counters? */
+ ld->icmp++;
+ break;
+ case IP_PROTO_OSPF:
+ ld->ospf++;
+ break;
+ case IP_PROTO_GRE:
+ ld->gre++;
+ break;
+ case IP_PROTO_VINES:
+ ld->vines++;
+ break;
+ default:
+ ld->other++;
+ }
}
static void
@@ -217,7 +297,7 @@ dissect_frag6(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
}
if (tree) {
ti = proto_tree_add_text(tree, tvb, offset, len,
- "Fragmention Header");
+ "Fragmentation Header");
rthdr_tree = proto_item_add_subtree(ti, ett_ipv6);
proto_tree_add_text(rthdr_tree, tvb,