diff options
author | Ahmad Fatoum <ahmad.fatoum@siemens.com> | 2017-08-07 16:38:52 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-08-22 07:55:26 +0000 |
commit | aca55a29f7b982e7a0bd9911d1d176561c8d7a84 (patch) | |
tree | 35b4f2b92ba79f49d26ebb06ae805e9eb6f4e4ac /wireshark-qt.cpp | |
parent | 2845f6be8db0b1720e23db0877ec837f00967bdc (diff) |
Add hardware timestamping support
pcap provides a pcap_set_tstamp_type function, which can be used to request
hardware timestamps from a supporting kernel.
This patch adds support for aforementioned function as well as two new
command line options to dumpcap, wireshark and tshark:
--list-time-stamp-types
List time stamp types supported for the interface
--time-stamp-type <type>
Change the interface's timestamp method
Name choice mimics those used by tcpdump(1), which already supports this
feature. However, unlike tcpdump, we provide both options unconditionally.
If Wireshark was configured without pcap_set_tstamp_type being available,
--list-time-stamp-types reports an empty list.
Change-Id: I418a4b2b84cb01949cd262aad0ad8427f5ac0652
Signed-off-by: Ahmad Fatoum <ahmad.fatoum@siemens.com>
Reviewed-on: https://code.wireshark.org/review/23113
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wireshark-qt.cpp')
-rw-r--r-- | wireshark-qt.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp index ab7b99c666..4a704e46cb 100644 --- a/wireshark-qt.cpp +++ b/wireshark-qt.cpp @@ -366,6 +366,7 @@ int main(int argc, char *qt_argv[]) GString *runtime_info_str = NULL; QString dfilter, read_filter; + int caps_queries = 0; /* Start time in microseconds*/ guint64 start_time = g_get_monotonic_time(); #ifdef DEBUG_STARTUP_TIME @@ -714,8 +715,13 @@ int main(int argc, char *qt_argv[]) fill_in_local_interfaces(main_window_update); - if (global_commandline_info.start_capture || global_commandline_info.list_link_layer_types) { - /* We're supposed to do a live capture or get a list of link-layer + if (global_commandline_info.list_link_layer_types) + caps_queries |= CAPS_QUERY_LINK_TYPES; + if (global_commandline_info.list_timestamp_types) + caps_queries |= CAPS_QUERY_TIMESTAMP_TYPES; + + if (global_commandline_info.start_capture || caps_queries) { + /* We're supposed to do a live capture or get a list of link-layer/timestamp types for a live capture device; if the user didn't specify an interface to use, pick a default. */ ret_val = capture_opts_default_iface_if_necessary(&global_capture_opts, @@ -725,13 +731,13 @@ int main(int argc, char *qt_argv[]) } } - if (global_commandline_info.list_link_layer_types) { + if (caps_queries) { /* Get the list of link-layer types for the capture devices. */ if_capabilities_t *caps; guint i; interface_t device; for (i = 0; i < global_capture_opts.all_ifaces->len; i++) { - + int if_caps_queries = caps_queries; device = g_array_index(global_capture_opts.all_ifaces, interface_t, i); if (device.selected) { #if defined(HAVE_PCAP_CREATE) @@ -754,10 +760,10 @@ int main(int argc, char *qt_argv[]) create_console(); #endif /* _WIN32 */ #if defined(HAVE_PCAP_CREATE) - capture_opts_print_if_capabilities(caps, device.name, device.monitor_mode_supported); -#else - capture_opts_print_if_capabilities(caps, device.name, FALSE); + if (device.monitor_mode_supported) + if_caps_queries |= CAPS_MONITOR_MODE; #endif + capture_opts_print_if_capabilities(caps, device.name, if_caps_queries); #ifdef _WIN32 destroy_console(); #endif /* _WIN32 */ |