diff options
author | John Thacker <johnthacker@gmail.com> | 2021-12-15 01:22:34 -0500 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-12-15 14:04:58 +0000 |
commit | 67a4e70382c02f20f84a7be00ce365075b9863e7 (patch) | |
tree | b5a6b80fb43ae2bb767a56d7961144fff54fb1b6 /wiretap/file_access.c | |
parent | bf153432417e0a2bf83cd20569fd19373d3d0313 (diff) |
wiretap: have dummy IDBs set OPT_IDB_TSRESOL if needed
In wtap_dump_init_dumper(), when constructing a dummy IDB for files
that don't have one, if the tsprecision value is anything other than
the default, then the OPT_IDB_TSRESOL option also needs to be set.
Without it, for a pcapng the timestamps will be written according to the
tsprecision and time_units_per_second values, but when it is read,
the values will be interpreted incorrectly.
It would probably be better if the consistency of these values were enforced.
Diffstat (limited to 'wiretap/file_access.c')
-rw-r--r-- | wiretap/file_access.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 46fb195792..6d5ede5571 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -2289,26 +2289,32 @@ wtap_dump_init_dumper(int file_type_subtype, wtap_compression_type compression_t case WTAP_TSPREC_SEC: descr_mand->time_units_per_second = 1; + wtap_block_add_uint8_option(descr, OPT_IDB_TSRESOL, 0); break; case WTAP_TSPREC_DSEC: descr_mand->time_units_per_second = 10; + wtap_block_add_uint8_option(descr, OPT_IDB_TSRESOL, 1); break; case WTAP_TSPREC_CSEC: descr_mand->time_units_per_second = 100; + wtap_block_add_uint8_option(descr, OPT_IDB_TSRESOL, 2); break; case WTAP_TSPREC_MSEC: descr_mand->time_units_per_second = 1000; + wtap_block_add_uint8_option(descr, OPT_IDB_TSRESOL, 3); break; case WTAP_TSPREC_USEC: descr_mand->time_units_per_second = 1000000; + /* This is the default, so we save a few bytes by not adding the option. */ break; case WTAP_TSPREC_NSEC: descr_mand->time_units_per_second = 1000000000; + wtap_block_add_uint8_option(descr, OPT_IDB_TSRESOL, 9); break; default: |