Commit Graph

366 Commits

Author SHA1 Message Date
João Valverde 5f79503d67 Fix config.h include order
The header "config.h" needs to be the first header included in the
source file, no exceptions.
2021-09-20 20:16:52 +01:00
João Valverde 8df2a73594 Use the musl in-tree getopt_long() everywhere
Besides the obvious limitation of being unavailable on Windows,
the standard is vague about getopt() and getopt_long() has many
non-portable pitfalls and buggy implementations, that increase
the maintainance cost a lot. Also the GNU libc code currently
in the tree is not suited for embedding and is unmaintainable.

Own maintainership for getopt_long() and use the musl implementation
everywhere. This way we don't need to worry if optreset is available,
or if the $OPERATING_SYSTEM version behaves in subtly different ways.

The API is under the Wireshark namespace to avoid conflicts with
system headers.

Side-note, the Mingw-w64 9.0 getopt_long() implementation is buggy
with opterr and known to crash. In my experience it's a headache to
use the embedded getopt implementation if the system provides one.
2021-09-17 00:43:54 +01:00
Alexis La Goutte 4a55281078 dpauxmon(extcap): Fix Dead Store found by Clang Analyzer
dpauxmon.c:290:7: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' [deadcode.DeadStores]
dpauxmon.c:432:7: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' [deadcode.DeadStores]
dpauxmon.c:437:7: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' [deadcode.DeadStores]
dpauxmon.c:443:7: warning: Although the value stored to 'err' is used in the enclosing expression, the value is never actually read from 'err' [deadcode.DeadStores]
2021-09-06 04:21:14 +00:00
Guy Harris 097656e805 androiddump: get the WIRESHARK_UPPER_PDU tags from the header.
Don't define WIRESHARK_UPPER_PDU_TAG_DISSECTOR_NAME ourselves and use
it, use EXP_PDU_TAG_PROTO_NAME from wsutil/exported_pdu_tlvs.h.
2021-08-20 13:16:15 -07:00
Guy Harris 4e80643cc0 Move LINKTYPE_WIRESHARK_UPPER_PDU definitions to a separate header.
Have wsutil/exported_pdu_tlvs.h define the LINKTYPE_WIRESHARK_UPPER_PDU
TLV type and length values, as well as the port type values written to
files in EXP_PDU_TAG_PORT_TYPE TLVs.

Update the comment that describes the LINKTYPE_WIRESHARK_UPPER_PDU TLVs
to more completely and correctly reflect reality (it was moved from
epan/exported_pdu.h to wsutil/exported_pdu_tlvs.h).

Rename those port type values from OLD_PT_ to EXP_PDU_PT_; there is
nothing "old" about them - yes, they originally had the same numerical
values as the PT_ enum values in libwireshark, but that's no longer the
case, and the two are now defined independently.  Rename routines that
map between libwireshark PT_ values and EXP_PDU_PT_ values to remove
"old" from the name while we're at it.

Don't include epan/exported_pdu.h if we only need the
LINKTYPE_WIRESHARK_UPPER_PDU definitions - just include
wsutil/exported_pdu_tlvs.h.

In extcap/udpdump.c, include wsutil/exported_pdu_tlvs.h rather than
defining the TLV types ourselves.
2021-08-20 02:18:19 -07:00
Guy Harris d679564d7b Use the wsutil/pint.h functions to fill in "exported PDU" headers.
That makes the code cleaner, including making it clearer that the fields
in those headers are big-endian.
2021-08-20 00:35:33 -07:00
Gerald Combs 539ad8a91b CMake: Remove unneeded GLIB2_LIBRARIES.
GLib is part of wsutil's link interface, so we don't need to link to it
explictly.
2021-07-21 10:05:21 +00:00
Joakim Karlsson 5e9ab5c579 CMake: add GCRYPT to sdjournal_LIBS 2021-07-20 19:04:38 +02:00
David Perry dc7089e831 Carry drop count/packet ID/queue ID as options on packet block 2021-07-19 21:25:40 +00:00
Gerald Combs 077b787413 etwdump: Fixup our rec struct syntax.
Fix

```
C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(590,10): error C2232: '->block': left operand has 'struct' type, use '.' [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj]
C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(590,10): error C2232:     rec->block = wtap_block_create(WTAP_BLOCK_PACKET); [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj]
C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(590,10): error C2232:          ^ [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj]
C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(591,39): error C2232: '->block': left operand has 'struct' type, use '.' [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj]
C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\extcap\etl.c(591,39): error C2232:                                       ^ [C:\gitlab-builds\builds\-fyeYoMP\0\wireshark\wireshark\build\extcap\etwdump.vcxproj]
```
2021-07-12 14:40:21 -07:00
David Perry 06ed6930dc Carry EPB flags as an option on the packet block
As requested by [this comment][1] on !2859, move `pack_flags` from a
dedicated field in `wtap_rec` to a block option on the packet block in
`wtap_rec.block`.

[1]: https://gitlab.com/wireshark/wireshark/-/merge_requests/2859#note_615984624
2021-07-12 12:41:57 -04:00
David Perry 73087d6fb4 Use wtap_blocks for packet comments
Mostly functioning proof of concept for #14329. This work is intended to
allow Wireshark to support multiple packet comments per packet.

Uses and expands upon the `wtap_block` API in `wiretap/wtap_opttypes.h`.
It attaches a `wtap_block` structure to `wtap_rec` in place of its
current `opt_comment` and `packet_verdict` members to hold OPT_COMMENT
and OPT_PKT_VERDICT option values.
2021-07-07 18:40:24 +00:00
João Valverde c6a920686c wslog: Check environment initialization for errors
Initialiaze the cmdarg error stream earlier.

Dumpcap also needs to know earlier if it is running in capture
child mode.
2021-06-26 00:18:26 +01:00
João Valverde 759bb234d0 wslog: Check if we are initialized and add missing inits
Instead of receiving the program name from GLib, pass it explicitly
to ws_log_init() instead  and use that to initialize the GLib program
name.

ws_log_parse_args() will now exit the program when it encounters an
argument error if exit_failure >= 0.
2021-06-21 16:03:29 +00:00
João Valverde 0e50979b3f Replace g_assert() with ws_assert() 2021-06-19 01:23:31 +00:00
Guy Harris 6eb3703379 Make various names match the name of the systemd journal export block.
The name of the block, in the pcapng specification is the systemd
Journal Export Block; add "export" after "journal" in various
variable/enum/define names.
2021-06-17 13:52:45 -07:00
João Valverde dcc02b1003 dissectors: Replace g_log() with ws_log() 2021-06-16 12:50:28 +00:00
João Valverde 39df3ae3c0 Replace g_log() calls with ws_log() 2021-06-16 12:50:27 +00:00
João Valverde e86ac706ca wslog: Parse cmd line options in one pass 2021-06-14 22:05:35 +00:00
João Valverde 5ddc007023 wslog: Include pid in format 2021-06-14 14:18:38 +01:00
João Valverde 5a662ba3fb wslog: Add support for domain filtering
A domain filter can be given in the environment variable
'WS_LOG_DOMAINS' or in a command-line options "--log-domains".

The filter is specified as a comma separated case insensitive list,
for example:

    ./tshark  --log-domains=main,capture

Domain data type switches from an enum to a string. There is no
constaint on adding new domains, neither in code or at runtime.
The string format is arbitrary, only positive matches will produce
output.
2021-06-14 13:13:12 +01:00
João Valverde dc7f0b88bb Refactor our logging and extend the wslog API
Experience has shown that:

  1. The current logging methods are not very reliable or practical.
A logging bitmask makes little sense as the user-facing interface (who
would want debug but not crtical messages for example?); it's
computer-friendly and user-unfriendly. More importantly the console
log level preference is initialized too late in the startup process
to be used for the logging subsystem and that fact raises a number
of annoying and hard-to-fix usability issues.

  2. Coding around G_MESSAGES_DEBUG to comply with our log level mask
and not clobber the user's settings or not create unexpected log misses
is unworkable and generally follows the principle of most surprise.
The fact that G_MESSAGES_DEBUG="all" can leak to other programs using
GLib is also annoying.

  3. The non-structured GLib logging API is very opinionated and lacks
configurability beyond replacing the log handler.

  4. Windows GUI has some special code to attach to a console,
but it would be nice to abstract away the rest under a single
interface.

  5. Using this logger seems to be noticeably faster.

Deprecate the console log level preference and extend our API to
implement a log handler in wsutil/wslog.h to provide easy-to-use,
flexible and dependable logging during all execution phases.

Log levels have a hierarchy, from most verbose to least verbose
(debug to error). When a given level is set everything above that
is also enabled.

The log level can be set with an environment variable or a command
line option (parsed as soon as possible but still later than the
environment). The default log level is "message".

Dissector logging is not included because it is not clear what log
domain they should use. An explosion to thousands of domains is
not desirable and putting everything in a single domain is probably
too coarse and noisy. For now I think it makes sense to let them do
their own thing using g_log_default_handler() and continue using the
G_MESSAGES_DEBUG mechanism with specific domains for each individual
dissector.

In the future a mechanism may be added to selectively enable these
domains at runtime while trying to avoid the problems introduced
by G_MESSAGES_DEBUG.
2021-06-11 09:40:28 +00:00
Odysseus Yang c4b32c8f46 ETWDUMP: Update to support live capture
etwdump will read events from a live session with the params as the filter, also the params can be used as filter when reading from a etl file.
2021-05-13 21:17:09 +00:00
Guy Harris 3bfe597f5b etl: fix handling of the packet flags.
Use #defines, not numbers, for inbound and outbound. and test only the
direction part of the packet flags, in case any other bits are set.
2021-04-28 19:10:57 +00:00
Tomasz Moń 4bd5830cda CMake: Add ENABLE_VLD option for MSVC
Calling cmake with -DENABLE_VLD=ON when building with Visual Studio,
results in debug configuration being linked to Visual Leak Detector.
By default, Visual Leak Detector outputs the leak summary to Visual
Studio debug window. When ENABLE_VLD is active, VLD is linked to all
wireshark libraries and executables.
2021-04-10 21:53:59 +00:00
Guy Harris c33e2f7b51 Add more error-reporting routines that call through a function pointer.
Have routines to report capture-file errors, using libwireshark error
codes and strings, that call through a pointer, so they can pop up
dialogs in GUI apps, print a message to the standard error on
command-line apps, and possibly do something different on server
programs.

Have init_report_message() take a pointer to structure containing those
function pointers, rather than the function pointers themselves, as
arguments.

Make other API changes to make that work.
2021-03-15 12:17:59 -07:00
Guy Harris 166159f15d wiretap: eliminate the pcap/nspcap/pcapng WTAP_FILE_TYPE_SUBTYPE_ values.
Register the pcap and pcapng file types/subtypes rather than hardwiring
them into the table.

Call the registration routines for them directly, rather than through a
generated table; they're always supposed to be there, as some code in
Wireshark either writes only one of those formats or defaults to writing
one of those formats.  Don't run their source code through the
registration-routine-finder script.

Have the file type/subtype codes for them be directly exported to the
libwiretap core, and provide routines to return each of them, to be used
by the aforementioned code.

When reporting errors with cfile_write_failure_message(), use
wtap_dump_file_type_subtype() to get the file type/subtype value for the
wtap_dumper to which we're writing, rather than hardcoding it.

Have the "export PDU" code capable of supporting arbitrary file
types/subtypes, although we currently only use pcapng.

Get rid of declarations of now-static can_write_encap and
dump_open routines in various headers.
2021-02-23 21:56:20 +00:00
Guy Harris 842a7cccf9 wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported.  Indicate whether "supported" means "one instance" or
"multiple instances".

"Supports" doesn't just mean "can be written", it also means "could be
read".

Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file.  Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).

Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.

Provide backwards compatibility for Lua.

This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 23:18:35 +00:00
Guy Harris c0711693ab Enable -Wredundant-decls.
Add it to the default list of checks, and fix some errors it causes.
(Sadly, it doesn't work in CLang.)
2021-02-14 14:43:42 -08:00
Guy Harris 09684644ee wiretap: clean up WTAP_BLOCK_ names.
Remove NG from the names - it adds nothing.

Don't use the abbreviations for pcapng block names, spell out what the
block does (e.g. "WTAP_BLOCK_DECRYPTION_SECRETS" rather than
"WTAP_BLOCK_DSB"), to make it more obvious what the block does.

Spell out some other abbreviations.

Add WTAP_BLOCK_PACKET for future use for packet blocks; there's no need
to distinguish between the Enhanced Packet Block, the Simple Packet
Block, and the deprecated Packet Block here.
2021-02-09 22:32:57 +00:00
Guy Harris 93a472575d Rename WTAP_ENCAP_ETL to WTAP_ENCAP_ETW.
It corresponds to LINKTYPE_ETW in pcap and pcapng files; the structures
in the record format come from the Event Tracing for Windows (ETW) API
rather than directly from Event Trace Log files.

While we're at it, explain what extcap/etl does.
2021-01-27 14:33:09 -08:00
Pascal Quantin 10377c4d92 sshdump: fix detection of custom version in Windows 2020-12-09 22:02:42 +00:00
Guy Harris bb494c11de Fix various spelling errors.
Found by lintian and by looking for the misspelled words that lintian
found.

(Does not fix spelling errors in .asn1 files.)
2020-12-09 05:52:50 +00:00
Odysseus Yang 2a5b34d8b0 MBIM: Update dissector to support DLT_ETW
New link type DLT_ETW is added for write and read Event Trace on Windows.
This change updates MBIM dissector to decode a MBIM message from
a DLT_ETW packet.
2020-12-02 09:05:11 +00:00
Guy Harris 6e6233521a Have WTAP_ERR_INTERNAL include an err_info string giving details.
That way, users won't just see "You got an internal error", the details
will be given, so they can report them in a bug.
2020-10-14 04:51:45 +00:00
Guy Harris 74e917fc6c wiretap: have wtap_dump_flush(), and its callers, check for errors.
Change-Id: Ibcddf1a949f775afa49d36a2d165c3685556035d
Reviewed-on: https://code.wireshark.org/review/38104
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-09 23:08:51 +00:00
Dario Lombardo a60bc4da84 sshdump: allow for multiple instances.
sshdump can now be copied in multiple instances. Each instance will
show up a different interface and will have its own profile.

This will help users connecting to different hosts. Instead of changing
profiles, sshdump can be cloned, and each instance will be used for a
single host.

Change-Id: If4fb42cf78021c6f16213ae91cbf41ec7f61ca77
Reviewed-on: https://code.wireshark.org/review/37883
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-18 04:04:59 +00:00
Guy Harris 3dedaf8064 extcap: put the code to add lissh version information into a common routine.
add_libssh_info() can be used by ciscodump, sshdump. and any other
extcap program that uses libssh.

Change-Id: I60474bd610eeb7dfb6ec07fc1aaaf19c4f745cdd
Reviewed-on: https://code.wireshark.org/review/37882
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-16 10:00:01 +00:00
Guy Harris 9296677472 extcap: assume we're using libssh 0.6 or later.
We require 0.6 or later in CMakeLists.txt, and both ssh_version() and
LIBSSH_VERSION having to be fed to SSH_STRINGIFY() date back before 0.5,
so just assume ssh_version() is available and LIBSSH_VERSION has to be
fed to SSH_STRINGIFY().

Change-Id: I4f62a720424383f88e0410cad07dbe67d0c69297
Reviewed-on: https://code.wireshark.org/review/37881
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-16 09:26:43 +00:00
Guy Harris a1d2d18cb8 extcap: get the libssh version string from the libssh.h header.
Thanks, libssh developers, for making it so straightforward!

This means we don't need to construct it in the CMake module that finds
libssh.

Change-Id: I6c173bf7c0671dfdfac423a7d01ecced7b69e851
Reviewed-on: https://code.wireshark.org/review/37878
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-16 08:18:58 +00:00
Guy Harris e4835191cb extcap: clean up the version number handling.
Have the version parameter be just the version number; other code
expects it to be that.

Have additional parameters for the "compiled with" and "running with"
information.

Add a extcap_version_print() routine to show the version message,
printing

	{exename} version {version}

and then printing

	Compiled with {compiled_with}

if "compiled with" information is supplied and printing

	Running with {running_with}

if "running with" information is supplied.

This fixes some messages, as well as fixing the display of extcap
modules in the About dialog.

Change-Id: I3d298d30e83bd363abd599d75adfc780a90f34fd
Reviewed-on: https://code.wireshark.org/review/37877
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-16 02:48:45 +00:00
Guy Harris 44ca0af5df extcap-base: no need to get the basename of the executable path twice.
Just use extcap->exename.

Change-Id: I85cfda2afaf776f3222cf362bcd6c675b4ff1504
Reviewed-on: https://code.wireshark.org/review/37876
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-16 01:31:16 +00:00
Guy Harris dccc382b4f Show the version of libssh being used, if possible.
If we have ssh_version(), then ssh_version(0) will return a string for
the version being used.

Change-Id: I0717f6d4d5c3fa04aa7938dc6bc0d4c8abfa95fd
Reviewed-on: https://code.wireshark.org/review/37875
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-15 23:43:22 +00:00
Dario Lombardo f793923a12 extcap: add libssh version info to sshdump and ciscodump.
Change-Id: I1e13cc3471e37514a0dd181abd4938607a057ec6
Reviewed-on: https://code.wireshark.org/review/37870
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-15 18:59:10 +00:00
Dario Lombardo d975ebbed4 extcap: improve version output for all extcaps.
Change-Id: I6ecdbdbbdf852bc3b874ad6a9acdd94f8e839c89
Reviewed-on: https://code.wireshark.org/review/37869
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-15 18:58:58 +00:00
Peter Wu 4015992a89 sshdump: remove redundant ssh_userauth_agent call
Since the original introduction of sshdump, ssh_userauth_publickey_auto
was already in use which would try the ssh-agent on non-Windows
platforms. There is no need to explicitly call ssh_userauth_agent which
is dead code anyway due to a typo in the macro name.

Change-Id: I976ec3da9e35ade63983ba5ca01163714d466912
Reviewed-on: https://code.wireshark.org/review/37476
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-06-14 21:47:33 +00:00
Martin Mathieson 569f3bd611 More PVS-Studio issues flagged by Valerii Zapodovnikov.
/opt/SourceCode/wireshark/epan/dissectors/packet-frame.c	818	warn	V547 Expression 'fi' is always true.
/opt/SourceCode/wireshark/epan/dissectors/packet-gsm_sms.c	2692	warn	V547 Expression 'length <= (offset - saved_offset)' is always false.
/opt/SourceCode/wireshark/epan/dissectors/packet-isup.c	4688	warn	V1037 Two or more case-branches perform the same actions. Check lines: 4688, 4697
/opt/SourceCode/wireshark/extcap/androiddump.c	1237	warn	V560 A part of conditional expression is always true: data_str.
/opt/SourceCode/wireshark/extcap/androiddump.c	1603	warn	V547 Expression is always true.
/opt/SourceCode/wireshark/ui/qt/models/packet_list_model.cpp	497	warn	V560 A part of conditional expression is always true: ok_r1.

For the voip_calls.c change, I preferred to initailize along with every other field, rather than set to actual value it gets set to later.

For the isobus-vt change, I could not find a spec but followed the pattern from other error bit fields.

Bug: 16335
Change-Id: Ie55082222b582f6fff4e8c7a992d863acee6cf15
Reviewed-on: https://code.wireshark.org/review/37160
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-05-09 11:34:12 +00:00
Tomasz Moń 040c31c269 sshdump: Use Open dialog for SSH private key
Set mustexist option to true to use Open file dialog instead of Save.

Change-Id: Ic8890facb6eebdacdc52881f617e8137585220f4
Reviewed-on: https://code.wireshark.org/review/36832
Petri-Dish: Tomasz Moń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-04-15 14:27:21 +00:00
Guy Harris 6bd6b1df78 More modeline fixes to put HT tab stops every 8 characters.
Change-Id: If3ea65f24e33b89784b3d9a1e7009d09728d4f7a
Reviewed-on: https://code.wireshark.org/review/36437
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-03-15 16:14:49 +00:00
Erwin Rol 2ab65bf0ba extcap: Fix packet time calculation
The packet time calculation used the time(NULL) call to get the time
in seconds and than divided by 1000 to get micro seconds. This results
in correct seconds but some random micro seconds values.

Now get the time in microseconds and divide by 1000000 to get the
seconds and use the remainder for the micro seconds part.

Change-Id: I31f90960e27b0089c20936f69c7dc30f1efd50d9
Signed-off-by: Erwin Rol <erwin@erwinrol.com>
Reviewed-on: https://code.wireshark.org/review/36067
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-10 07:45:33 +00:00