Ethereal-dev: [Ethereal-dev] nettl (HP-UX) icmp fixes

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Mark C. Brown" <mbrown@xxxxxxxxxx>
Date: Sun, 19 Sep 2004 01:58:12 -0400
Greetings,

Changes to handle oddball HP-UX ICMP and ICMPv6 trace records
which have no link or IP layer - just raw ICMP/ICMPv6 data.

-- 
"If a train station is where a train stops, | Mark C. Brown
 then what's a workstation?" -- D. Huber    | mbrown@xxxxxxxxxx
Index: epan/dissectors/packet-ip.c
===================================================================
--- epan/dissectors/packet-ip.c	(revision 12046)
+++ epan/dissectors/packet-ip.c	(working copy)
@@ -1894,4 +1894,5 @@
 
   icmp_handle = create_dissector_handle(dissect_icmp, proto_icmp);
   dissector_add("ip.proto", IP_PROTO_ICMP, icmp_handle);
+  dissector_add("wtap_encap", WTAP_ENCAP_RAW_ICMP, icmp_handle);
 }
Index: epan/dissectors/packet-icmpv6.c
===================================================================
--- epan/dissectors/packet-icmpv6.c	(revision 12046)
+++ epan/dissectors/packet-icmpv6.c	(working copy)
@@ -1652,6 +1652,7 @@
 
   icmpv6_handle = create_dissector_handle(dissect_icmpv6, proto_icmpv6);
   dissector_add("ip.proto", IP_PROTO_ICMPV6, icmpv6_handle);
+  dissector_add("wtap_encap", WTAP_ENCAP_RAW_ICMPV6, icmpv6_handle);
 
   /*
    * Get a handle for the IPv6 dissector.
Index: wiretap/nettl.c
===================================================================
--- wiretap/nettl.c	(revision 12046)
+++ wiretap/nettl.c	(working copy)
@@ -311,10 +311,12 @@
 	     || (encap[3] == NETTL_SUBSYS_NS_LS_LOOPBACK)
 	     || (encap[3] == NETTL_SUBSYS_NS_LS_UDP)
 	     || (encap[3] == NETTL_SUBSYS_NS_LS_TCP)
-	     || (encap[3] == NETTL_SUBSYS_NS_LS_ICMP)
-	     || (encap[3] == NETTL_SUBSYS_NS_LS_IPV6)
-	     || (encap[3] == NETTL_SUBSYS_NS_LS_ICMPV6) ) {
+	     || (encap[3] == NETTL_SUBSYS_NS_LS_IPV6)) {
 		phdr->pkt_encap = WTAP_ENCAP_RAW_IP;
+	    } else if (encap[3] == NETTL_SUBSYS_NS_LS_ICMP) {
+		phdr->pkt_encap = WTAP_ENCAP_RAW_ICMP;
+	    } else if (encap[3] == NETTL_SUBSYS_NS_LS_ICMPV6) {
+		phdr->pkt_encap = WTAP_ENCAP_RAW_ICMPV6;
 	    } else if (encap[3] == NETTL_SUBSYS_PCI_FDDI) {
 		phdr->pkt_encap = WTAP_ENCAP_FDDI;
 	    } else if( (encap[3] == NETTL_SUBSYS_PCI_TR)
Index: wiretap/wtap.h
===================================================================
--- wiretap/wtap.h	(revision 12046)
+++ wiretap/wtap.h	(working copy)
@@ -153,9 +153,11 @@
 #define WTAP_ENCAP_SYMANTEC			61
 #define WTAP_ENCAP_APPLE_IP_OVER_IEEE1394	62
 #define WTAP_ENCAP_BACNET_MS_TP			63
+#define WTAP_ENCAP_RAW_ICMP			64
+#define WTAP_ENCAP_RAW_ICMPV6			65
 
 /* last WTAP_ENCAP_ value + 1 */
-#define WTAP_NUM_ENCAP_TYPES			64
+#define WTAP_NUM_ENCAP_TYPES			66
 
 /* File types that can be read by wiretap.
    We support writing some many of these file types, too, so we