Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] [PATCH] ICMPv6

From: Nicolas DICHTEL <nicolas.dichtel@xxxxxxxxx>
Date: Thu, 02 Nov 2006 17:33:26 +0100
Hello,

here is a patch that transforms "valid lifetime" and "prefered lifetime" in a prefix option (in RA) in human readable format. Following the RFC2461 Section 4.6.2, if the value is 0xffffffff, this means lifetime
is infinity.


Regards,
Nicolas
--- wireshark-0.99.4-SVN-19424-orig/epan/dissectors/packet-icmpv6.c	2006-10-04 09:32:25.000000000 +0200
+++ wireshark-0.99.4-SVN-19424/epan/dissectors/packet-icmpv6.c	2006-10-31 12:31:40.000000000 +0100
@@ -8,6 +8,7 @@
  * Copyright 1998 Gerald Combs
  *
  * MobileIPv6 support added by Tomislav Borosa <tomislav.borosa@xxxxxxxxxx>
+ * Copyright 2006, Nicolas DICHTEL - 6WIND - <nicolas.dichtel@xxxxxxxxx>
  *
  * HMIPv6 support added by Martti Kuparinen <martti.kuparinen@xxxxxx>
  *
@@ -315,14 +316,24 @@ again:
 	    decode_boolean_bitfield(pi->nd_opt_pi_flags_reserved,
 		    ND_OPT_PI_FLAG_SITEPREF, 8,
 		    "Site prefix", "Not site prefix"));
-	proto_tree_add_text(icmp6opt_tree, tvb,
-	    offset + offsetof(struct nd_opt_prefix_info, nd_opt_pi_valid_time),
-	    4, "Valid lifetime: 0x%08x",
-	    pntohl(&pi->nd_opt_pi_valid_time));
-	proto_tree_add_text(icmp6opt_tree, tvb,
-	    offset + offsetof(struct nd_opt_prefix_info, nd_opt_pi_preferred_time),
-	    4, "Preferred lifetime: 0x%08x",
-	    pntohl(&pi->nd_opt_pi_preferred_time));
+	if (pntohl(&pi->nd_opt_pi_valid_time) == 0xffffffff)
+		proto_tree_add_text(icmp6opt_tree, tvb,
+				offset + offsetof(struct nd_opt_prefix_info, nd_opt_pi_valid_time),
+				4, "Valid lifetime: infinity");
+	else
+		proto_tree_add_text(icmp6opt_tree, tvb,
+				offset + offsetof(struct nd_opt_prefix_info, nd_opt_pi_valid_time),
+				4, "Valid lifetime: %u",
+				pntohl(&pi->nd_opt_pi_valid_time));
+	if (pntohl(&pi->nd_opt_pi_preferred_time) == 0xffffffff)
+		proto_tree_add_text(icmp6opt_tree, tvb,
+				offset + offsetof(struct nd_opt_prefix_info, nd_opt_pi_preferred_time),
+				4, "Preferred lifetime: infinity");
+	else
+		proto_tree_add_text(icmp6opt_tree, tvb,
+				offset + offsetof(struct nd_opt_prefix_info, nd_opt_pi_preferred_time),
+				4, "Preferred lifetime: %u",
+				pntohl(&pi->nd_opt_pi_preferred_time));
 	proto_tree_add_text(icmp6opt_tree, tvb,
 	    offset + offsetof(struct nd_opt_prefix_info, nd_opt_pi_prefix),
 	    16, "Prefix: %s", ip6_to_str(&pi->nd_opt_pi_prefix));