aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/main.c
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad.fatoum@siemens.com>2017-08-07 16:38:52 +0200
committerAnders Broman <a.broman58@gmail.com>2017-08-22 07:55:26 +0000
commitaca55a29f7b982e7a0bd9911d1d176561c8d7a84 (patch)
tree35b4f2b92ba79f49d26ebb06ae805e9eb6f4e4ac /ui/gtk/main.c
parent2845f6be8db0b1720e23db0877ec837f00967bdc (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 'ui/gtk/main.c')
-rw-r--r--ui/gtk/main.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index b9b4292cc4..8214139455 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -1996,6 +1996,7 @@ main(int argc, char *argv[])
#endif
#endif
#endif
+ int caps_queries = 0;
gint pl_size = 280, tv_size = 95, bv_size = 75;
gchar *rc_file;
dfilter_t *rfcode = NULL;
@@ -2294,8 +2295,13 @@ main(int argc, char *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 = capture_opts_default_iface_if_necessary(&global_capture_opts,
@@ -2305,13 +2311,13 @@ main(int argc, char *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) {
gchar* auth_str = NULL;
@@ -2342,10 +2348,10 @@ main(int argc, char *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 */