Ethereal-dev: [Ethereal-dev] patch for packet-icmpv6.c

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

From: Shusaku Ueda <ueda@xxxxxxxxx>
Date: Thu, 29 Jan 2004 10:29:13 +0900 (JST)
Hi all,

Attached patch fixes the TODO in packet-icmpv6.c.
- show all Home Agent Addresses of DHAAD Reply
- show ICMP options of Mobile Prefix Advertisement

Please review and check in.

Thanks.

--
Shusaku Ueda (ueda@xxxxxxxxx)
--- packet-icmpv6.c.org	Mon Jan 19 17:53:43 2004
+++ packet-icmpv6.c	Tue Jan 20 09:22:51 2004
@@ -75,6 +75,7 @@
 static int hf_icmpv6_code = -1;
 static int hf_icmpv6_checksum = -1;
 static int hf_icmpv6_checksum_bad = -1;
+static int hf_icmpv6_haad_ha_addrs = -1;
 
 static gint ett_icmpv6 = -1;
 static gint ett_icmpv6opt = -1;
@@ -1414,7 +1415,18 @@
 	    proto_tree_add_text(icmp6_tree, tvb,
 		offset + 6, 2, "Reserved: %d",
 		tvb_get_ntohs(tvb, offset + 6));
-	    /* TODO Show all Home Agent Addresses */
+	    /* Show all Home Agent Addresses */
+	    {
+		int i, suboffset;
+		int ha_num = (length - 8)/16;
+
+		for (i = 0; i < ha_num; i++) {
+		    suboffset = 16 * i;
+		    proto_tree_add_ipv6(icmp6_tree, hf_icmpv6_haad_ha_addrs,
+			tvb, offset + 8 + suboffset, 16,
+			tvb_get_ptr(tvb, offset + 8 + suboffset, 16));
+		}
+	    }
 	    break;
 	case ICMP6_MIP6_MPS:
 	    proto_tree_add_text(icmp6_tree, tvb,
@@ -1431,18 +1443,22 @@
 		tvb_get_ntohs(tvb, offset + 4),
 		tvb_get_ntohs(tvb, offset + 4));
 	    proto_tree_add_text(icmp6_tree, tvb,
-		offset + 6, 2,
+		offset + 6, 1,
 		decode_boolean_bitfield(tvb_get_guint8(tvb, offset + 6),
-		    0x8000, 16,
+		    0x80, 8,
 		    "Managed Address Configuration",
 		    "No Managed Address Configuration"));
 	    proto_tree_add_text(icmp6_tree, tvb,
-		offset + 6, 2,
+		offset + 6, 1,
 		decode_boolean_bitfield(tvb_get_guint8(tvb, offset + 6),
-		    0x4000, 16,
+		    0x40, 8,
 		    "Other Stateful Configuration",
 		    "No Other Stateful Configuration"));
-	    /* TODO Show all options */
+	    proto_tree_add_text(icmp6_tree, tvb,
+		offset + 7, 1, "Reserved: %d",
+		tvb_get_guint8(tvb, offset + 7));
+	    /* Show all options */
+	    dissect_icmpv6opt(tvb, offset + 8, pinfo, icmp6_tree);
 	    break;
 	default:
 	    next_tvb = tvb_new_subset(tvb, offset + sizeof(*dp), -1, -1);
@@ -1468,6 +1484,10 @@
     { &hf_icmpv6_checksum_bad,
       { "Bad Checksum",   "icmpv6.checksum_bad", FT_BOOLEAN, BASE_NONE,	NULL, 0x0,
 	"", HFILL }},
+    { &hf_icmpv6_haad_ha_addrs,
+      { "Home Agent Addresses", "icmpv6.haad.ha_addrs",
+       FT_IPv6, BASE_HEX, NULL, 0x0,
+       "", HFILL }},
   };
   static gint *ett[] = {
     &ett_icmpv6,