Fix requesting hardware timestamps without -k
The interface_options struct passed to dumpcap is populated
differently when running Wireshark with and without -k.
Previously, only with -k was there a valid pointer in
interface_opts.timestamp_type
Fixes: aca55a2
("Add hardware timestamping support")
Signed-off-by: Ahmad Fatoum <ahmad.fatoum@siemens.com>
Change-Id: Ic7ecc5a1190c28197d6a7271f1b353f74d43ca61
Reviewed-on: https://code.wireshark.org/review/23160
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
a34445c1cf
commit
be69761c78
|
@ -810,9 +810,11 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
|
|||
|
||||
interface_opts = g_array_index(capture_opts->ifaces, interface_options, capture_opts->ifaces->len - 1);
|
||||
capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, capture_opts->ifaces->len - 1);
|
||||
g_free(interface_opts.timestamp_type);
|
||||
interface_opts.timestamp_type = g_strdup(optarg_str_p);
|
||||
g_array_append_val(capture_opts->ifaces, interface_opts);
|
||||
} else {
|
||||
g_free(capture_opts->default_options.timestamp_type);
|
||||
capture_opts->default_options.timestamp_type = g_strdup(optarg_str_p);
|
||||
}
|
||||
break;
|
||||
|
@ -1161,6 +1163,7 @@ capture_opts_del_iface(capture_options *capture_opts, guint if_index)
|
|||
if (interface_opts.console_display_name != NULL)
|
||||
g_free(interface_opts.console_display_name);
|
||||
g_free(interface_opts.cfilter);
|
||||
g_free(interface_opts.timestamp_type);
|
||||
#ifdef HAVE_EXTCAP
|
||||
g_free(interface_opts.extcap);
|
||||
g_free(interface_opts.extcap_fifo);
|
||||
|
@ -1209,6 +1212,7 @@ collect_ifaces(capture_options *capture_opts)
|
|||
interface_opts.console_display_name = g_strdup(device.name);
|
||||
interface_opts.linktype = device.active_dlt;
|
||||
interface_opts.cfilter = g_strdup(device.cfilter);
|
||||
interface_opts.timestamp_type = g_strdup(device.timestamp_type);
|
||||
interface_opts.snaplen = device.snaplen;
|
||||
interface_opts.has_snaplen = device.has_snaplen;
|
||||
interface_opts.promisc_mode = device.pmode;
|
||||
|
@ -1277,6 +1281,7 @@ capture_opts_free_interface_t(interface_t *device)
|
|||
g_free(device->friendly_name);
|
||||
g_free(device->addresses);
|
||||
g_free(device->cfilter);
|
||||
g_free(device->timestamp_type);
|
||||
g_list_foreach(device->links,
|
||||
capture_opts_free_interface_t_links, NULL);
|
||||
g_list_free(device->links);
|
||||
|
|
|
@ -201,6 +201,7 @@ typedef struct interface_tag {
|
|||
/* External capture cached data */
|
||||
GHashTable *external_cap_args_settings;
|
||||
#endif
|
||||
gchar *timestamp_type;
|
||||
} interface_t;
|
||||
|
||||
typedef struct link_row_tag {
|
||||
|
|
|
@ -1302,6 +1302,7 @@ insert_new_rows(GList *rlist)
|
|||
device.snaplen = global_capture_opts.default_options.snaplen;
|
||||
}
|
||||
device.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
|
||||
device.timestamp_type = g_strdup(global_capture_opts.default_options.timestamp_type);
|
||||
monitor_mode = prefs_capture_device_monitor_mode(if_string);
|
||||
if (roptions->remote_host_opts.auth_type == CAPTURE_AUTH_PWD) {
|
||||
auth_str = g_strdup_printf("%s:%s", roptions->remote_host_opts.auth_username,
|
||||
|
@ -2656,6 +2657,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
|
|||
device.has_snaplen = FALSE;
|
||||
device.snaplen = WTAP_MAX_PACKET_SIZE_STANDARD;
|
||||
device.cfilter = NULL;
|
||||
device.timestamp_type = NULL;
|
||||
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
|
||||
device.buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
|
||||
#endif
|
||||
|
@ -3507,6 +3509,7 @@ add_pipe_cb(gpointer w _U_)
|
|||
device.has_snaplen = global_capture_opts.default_options.has_snaplen;
|
||||
device.snaplen = global_capture_opts.default_options.snaplen;
|
||||
device.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
|
||||
device.timestamp_type = g_strdup(global_capture_opts.default_options.timestamp_type);
|
||||
device.addresses = NULL;
|
||||
device.no_addresses = 0;
|
||||
device.last_packets = 0;
|
||||
|
|
|
@ -80,6 +80,7 @@ fill_from_ifaces (interface_t *device)
|
|||
device->snaplen = interface_opts.snaplen;
|
||||
g_free(device->cfilter);
|
||||
device->cfilter = g_strdup(interface_opts.cfilter);
|
||||
device->timestamp_type = g_strdup(interface_opts.timestamp_type);
|
||||
if (interface_opts.linktype != -1) {
|
||||
device->active_dlt = interface_opts.linktype;
|
||||
}
|
||||
|
@ -304,6 +305,7 @@ scan_local_interfaces(void (*update_cb)(void))
|
|||
device.snaplen = global_capture_opts.default_options.snaplen;
|
||||
}
|
||||
device.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
|
||||
device.timestamp_type = g_strdup(global_capture_opts.default_options.timestamp_type);
|
||||
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
|
||||
if ((device.buffer = capture_dev_user_buffersize_find(if_info->name)) == -1) {
|
||||
device.buffer = global_capture_opts.default_options.buffer_size;
|
||||
|
@ -372,6 +374,7 @@ scan_local_interfaces(void (*update_cb)(void))
|
|||
device.has_snaplen = interface_opts.has_snaplen;
|
||||
device.snaplen = interface_opts.snaplen;
|
||||
device.cfilter = g_strdup(interface_opts.cfilter);
|
||||
device.timestamp_type = g_strdup(interface_opts.timestamp_type);
|
||||
device.active_dlt = interface_opts.linktype;
|
||||
device.addresses = NULL;
|
||||
device.no_addresses = 0;
|
||||
|
|
|
@ -234,6 +234,7 @@ void ManageInterfacesDialog::on_addPipe_clicked()
|
|||
device.has_snaplen = global_capture_opts.default_options.has_snaplen;
|
||||
device.snaplen = global_capture_opts.default_options.snaplen;
|
||||
device.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
|
||||
device.timestamp_type = g_strdup(global_capture_opts.default_options.timestamp_type);
|
||||
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
|
||||
device.buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
|
||||
#endif
|
||||
|
@ -350,6 +351,7 @@ void ManageInterfacesDialog::updateRemoteInterfaceList(GList* rlist, remote_opti
|
|||
device.snaplen = global_capture_opts.default_options.snaplen;
|
||||
}
|
||||
device.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
|
||||
device.timestamp_type = g_strdup(global_capture_opts.default_options.timestamp_type);
|
||||
monitor_mode = prefs_capture_device_monitor_mode(if_string);
|
||||
if (roptions->remote_host_opts.auth_type == CAPTURE_AUTH_PWD) {
|
||||
auth_str = g_strdup_printf("%s:%s", roptions->remote_host_opts.auth_username,
|
||||
|
|
Loading…
Reference in New Issue