Correctly write out the isb_startime and isb_endtime options.
authorGuy Harris <guy@alum.mit.edu>
Tue, 17 May 2016 21:04:04 +0000 (14:04 -0700)
committerGuy Harris <guy@alum.mit.edu>
Tue, 17 May 2016 21:04:55 +0000 (21:04 +0000)
They're not marshalled as a 64-bit integer in pcapng files, they're
marshelled as 2 32-bit integers, the first of which is the upper 64 bits
of the value and the second of which is the lower 64 bits of the value.

Bug: 12349
Change-Id: I2bde51ac11b2518ef2ddaecf43672c984f26081a
Reviewed-on: https://code.wireshark.org/review/15492
Reviewed-by: Guy Harris <guy@alum.mit.edu>
wiretap/wtap_opttypes.c

index 7e3b4837c51cdf1139a0e7bcac51fee541a6f9f5..2e7016b78c6aa3e12538f6764e8f85e2b6761eab 100644 (file)
@@ -497,6 +497,21 @@ gboolean wtap_opttype_write_data_uint64(struct wtap_dumper* wdh, wtap_option_typ
     return TRUE;
 }
 
+gboolean wtap_opttype_write_data_uint64_timestamp(struct wtap_dumper* wdh, wtap_option_type* data, int *err)
+{
+    guint32 high, low;
+
+    high = (guint32)(data->uint64val >> 32);
+    low = (guint32)(data->uint64val >> 0);
+    if (!wtap_dump_file_write(wdh, &high, sizeof(guint32), err))
+        return FALSE;
+    wdh->bytes_dumped += 4;
+    if (!wtap_dump_file_write(wdh, &low, sizeof(guint32), err))
+        return FALSE;
+    wdh->bytes_dumped += 4;
+    return TRUE;
+}
+
 int wtap_optionblock_set_option_uint8(wtap_optionblock_t block, guint option_id, guint8 value)
 {
     wtap_optblock_value_t* opt_value = wtap_optionblock_get_option(block, option_id);
@@ -683,8 +698,8 @@ static void nrb_create(wtap_optionblock_t block)
 static void isb_create(wtap_optionblock_t block)
 {
     static wtap_optblock_reg_t comment_option = {"opt_comment", "Optional comment", WTAP_OPTTYPE_STRING, wtap_opttype_write_size_string, wtap_opttype_write_data_string, {0}, {0}};
-    static wtap_optblock_reg_t starttime_option = {"start_time", "Start Time", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not0, wtap_opttype_write_data_uint64, {0}, {0}};
-    static wtap_optblock_reg_t endtime_option = {"end_time", "End Time", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not0, wtap_opttype_write_data_uint64, {0}, {0}};
+    static wtap_optblock_reg_t starttime_option = {"start_time", "Start Time", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not0, wtap_opttype_write_data_uint64_timestamp, {0}, {0}};
+    static wtap_optblock_reg_t endtime_option = {"end_time", "End Time", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not0, wtap_opttype_write_data_uint64_timestamp, {0}, {0}};
     static wtap_optblock_reg_t rcv_pkt_option = {"recv", "Receive Packets", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not_minus1, wtap_opttype_write_data_uint64, {0}, {0}};
     static wtap_optblock_reg_t drop_pkt_option = {"drop", "Dropped Packets", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not_minus1, wtap_opttype_write_data_uint64, {0}, {0}};
     static wtap_optblock_reg_t filteraccept_option = {"filter_accept", "Filter Accept", WTAP_OPTTYPE_UINT64, wtap_opttype_write_uint64_not_minus1, wtap_opttype_write_data_uint64, {0}, {0}};