[OpenAFS-devel] small fix for afs callback expires

Jim Rees rees@umich.edu
Fri, 17 Jan 2003 13:50:02 -0500


Ethereal version 0.9.5 has a small bug in the afs dissector.  Callback
"expires" field is relative to the current time, but is treated as absolute
by the dissector.  The following fix is not quite right, because it uses
current time rather than the time the packet was generated, but it's better
than what's there now.  Maybe someone who knows ethereal better than I can
fix this.

Version 0.9.8 appears to have the same bug.

--- packet-afs-macros.h-	Sat Feb 23 14:12:14 2002
+++ packet-afs-macros.h	Fri Jan 17 13:37:47 2003
@@ -107,6 +107,14 @@
 	offset += 4; \
 	}
 
+#define OUT_RELDATE(field) \
+	{ nstime_t ts; \
+	ts.secs = time(NULL) + tvb_get_ntohl(tvb, offset); \
+	ts.nsecs = 0; \
+	proto_tree_add_time(tree,field, tvb,offset,sizeof(guint32),&ts); \
+	offset += 4; \
+	}
+
 /* Output a rx style string, up to a maximum length first 
    4 bytes - length, then char data */
 #define OUT_RXString(field) \
@@ -146,7 +154,7 @@
 		save = tree; \
 		tree = proto_item_add_subtree(ti, ett_afs_callback); \
 		OUT_UINT(hf_afs_fs_callback_version); \
-		OUT_DATE(hf_afs_fs_callback_expires); \
+		OUT_RELDATE(hf_afs_fs_callback_expires); \
 		OUT_UINT(hf_afs_fs_callback_type); \
 		tree = save; \
 	}
@@ -158,7 +166,7 @@
 		save = tree; \
 		tree = proto_item_add_subtree(ti, ett_afs_callback); \
 		OUT_UINT(hf_afs_cb_callback_version); \
-		OUT_DATE(hf_afs_cb_callback_expires); \
+		OUT_RELDATE(hf_afs_cb_callback_expires); \
 		OUT_UINT(hf_afs_cb_callback_type); \
 		tree = save; \
 	}