summaryrefslogtreecommitdiff
path: root/ui/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-06-04 18:58:40 -0700
committerGuy Harris <guy@alum.mit.edu>2017-06-05 05:28:26 +0000
commitd0865fd619454a9ac06b1c7d287dc438aff50bb0 (patch)
tree91efc24ec72d274b1529342041641b36939236f2 /ui/gtk
parent17965f57f178aa7e4027f2d363658098e2f1abb3 (diff)
downloadwireshark-d0865fd619454a9ac06b1c7d287dc438aff50bb0.tar.gz
Allow bigger snapshot lengths for D-Bus captures.
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except for D-Bus captures. Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for them, because that's the largest possible D-Bus message size. See https://bugs.freedesktop.org/show_bug.cgi?id=100220 for an example of the problems caused by limiting the snapshot length to 256KB for D-Bus. Have a snapshot length of 0 in a capture_file structure mean "there is no snapshot length for the file"; we don't need the has_snap field in that case, a value of 0 mean "no, we don't have a snapshot length". In dumpcap, start out with a pipe buffer size of 2KB, and grow it as necessary. When checking for a too-big packet from a pipe, check against the appropriate maximum - 128MB for DLT_DBUS, 256KB for everything else. Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20 Reviewed-on: https://code.wireshark.org/review/21952 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/gtk')
-rw-r--r--ui/gtk/capture_dlg.c14
-rw-r--r--ui/gtk/file_import_dlg.c4
-rw-r--r--ui/gtk/gsm_map_summary.c2
-rw-r--r--ui/gtk/mtp3_summary.c2
-rw-r--r--ui/gtk/prefs_capture.c14
-rw-r--r--ui/gtk/summary_dlg.c4
6 files changed, 20 insertions, 20 deletions
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c
index 870d0e1623..719bcc81b9 100644
--- a/ui/gtk/capture_dlg.c
+++ b/ui/gtk/capture_dlg.c
@@ -2476,7 +2476,7 @@ save_options_cb(GtkWidget *win _U_, gpointer user_data _U_)
if (device.snaplen < MIN_PACKET_SIZE)
device.snaplen = MIN_PACKET_SIZE;
} else {
- device.snaplen = WTAP_MAX_PACKET_SIZE;
+ device.snaplen = WTAP_MAX_PACKET_SIZE_STANDARD;
}
filter_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(filter_cm));
if (device.cfilter)
@@ -2527,8 +2527,8 @@ adjust_snap_sensitivity(GtkWidget *tb _U_, gpointer parent_w _U_)
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(snap_cb)));
device.has_snaplen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(snap_cb));
if (!device.has_snaplen) {
- gtk_spin_button_set_value(GTK_SPIN_BUTTON (snap_sb), WTAP_MAX_PACKET_SIZE);
- device.snaplen = WTAP_MAX_PACKET_SIZE;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON (snap_sb), WTAP_MAX_PACKET_SIZE_STANDARD);
+ device.snaplen = WTAP_MAX_PACKET_SIZE_STANDARD;
}
g_array_insert_val(global_capture_opts.all_ifaces, marked_interface, device);
}
@@ -2654,7 +2654,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
device.monitor_mode_supported = FALSE;
#endif
device.has_snaplen = FALSE;
- device.snaplen = WTAP_MAX_PACKET_SIZE;
+ device.snaplen = WTAP_MAX_PACKET_SIZE_STANDARD;
device.cfilter = NULL;
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
device.buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
@@ -2897,7 +2897,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
gtk_box_pack_start(GTK_BOX(snap_hb), snap_cb, FALSE, FALSE, 0);
snap_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat) device.snaplen,
- MIN_PACKET_SIZE, WTAP_MAX_PACKET_SIZE, 1.0, 10.0, 0.0);
+ MIN_PACKET_SIZE, WTAP_MAX_PACKET_SIZE_STANDARD, 1.0, 10.0, 0.0);
snap_sb = gtk_spin_button_new (snap_adj, 0, 0);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (snap_sb), TRUE);
gtk_widget_set_size_request(snap_sb, 80, -1);
@@ -2979,7 +2979,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
gtk_box_pack_start (GTK_BOX(buffer_size_hb), buffer_size_lb, FALSE, FALSE, 0);
buffer_size_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat) device.buffer,
- 1, WTAP_MAX_PACKET_SIZE, 1.0, 10.0, 0.0);
+ 1, WTAP_MAX_PACKET_SIZE_STANDARD, 1.0, 10.0, 0.0);
buffer_size_sb = gtk_spin_button_new (buffer_size_adj, 0, 0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON (buffer_size_sb), (gfloat) device.buffer);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (buffer_size_sb), TRUE);
@@ -5752,7 +5752,7 @@ create_and_fill_model(GtkTreeView *view)
device.has_snaplen = hassnap;
} else {
/* No preferences set yet, use default values */
- device.snaplen = WTAP_MAX_PACKET_SIZE;
+ device.snaplen = WTAP_MAX_PACKET_SIZE_STANDARD;
device.has_snaplen = FALSE;
}
diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c
index 0076fe9bde..b5745a6d7e 100644
--- a/ui/gtk/file_import_dlg.c
+++ b/ui/gtk/file_import_dlg.c
@@ -501,7 +501,7 @@ file_import_open(text_import_info_t *info)
int_data_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(int_data);
int_data_mand->wtap_encap = info->encapsulation;
int_data_mand->time_units_per_second = 1000000; /* default microsecond resolution */
- int_data_mand->snap_len = WTAP_MAX_PACKET_SIZE;
+ int_data_mand->snap_len = WTAP_MAX_PACKET_SIZE_STANDARD;
wtap_block_add_string_option(int_data, OPT_IDB_NAME, "Fake IF File->Import", strlen("Fake IF File->Import"));
g_array_append_val(idb_inf->interface_data, int_data);
@@ -1155,7 +1155,7 @@ file_import_dlg_new(void)
framelen_te = gtk_entry_new();
maxsize_msg = g_strdup_printf("The maximum size of the frames to write to the import capture file (max %u)",
- WTAP_MAX_PACKET_SIZE);
+ WTAP_MAX_PACKET_SIZE_STANDARD);
gtk_widget_set_tooltip_text(framelen_te, maxsize_msg);
g_free(maxsize_msg);
gtk_box_pack_start(GTK_BOX(framelen_hb), framelen_te, FALSE, FALSE, 0);
diff --git a/ui/gtk/gsm_map_summary.c b/ui/gtk/gsm_map_summary.c
index 15fd6b9644..e3dcd57d7b 100644
--- a/ui/gtk/gsm_map_summary.c
+++ b/ui/gtk/gsm_map_summary.c
@@ -128,7 +128,7 @@ void gsm_map_stat_gtk_sum_cb(GtkAction *action _U_, gpointer user_data _U_)
g_snprintf(string_buff, SUM_STR_MAX, "Format: %s", wtap_file_type_subtype_string(summary.file_type));
add_string_to_box(string_buff, file_box);
- if (summary.has_snap) {
+ if (summary.snap != 0) {
/* snapshot length */
g_snprintf(string_buff, SUM_STR_MAX, "Snapshot length: %u", summary.snap);
add_string_to_box(string_buff, file_box);
diff --git a/ui/gtk/mtp3_summary.c b/ui/gtk/mtp3_summary.c
index 1917720449..7e2d4c93c3 100644
--- a/ui/gtk/mtp3_summary.c
+++ b/ui/gtk/mtp3_summary.c
@@ -339,7 +339,7 @@ mtp3_sum_gtk_sum_cb(GtkAction *action _U_, gpointer user_data _U_)
g_snprintf(string_buff, SUM_STR_MAX, "Format: %s", (file_type ? file_type : "N/A"));
add_string_to_box(string_buff, file_box);
- if (summary.has_snap) {
+ if (summary.snap != 0) {
/* snapshot length */
g_snprintf(string_buff, SUM_STR_MAX, "Snapshot length: %u", summary.snap);
add_string_to_box(string_buff, file_box);
diff --git a/ui/gtk/prefs_capture.c b/ui/gtk/prefs_capture.c
index d12499726c..ff716c083b 100644
--- a/ui/gtk/prefs_capture.c
+++ b/ui/gtk/prefs_capture.c
@@ -677,7 +677,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
renderer = gtk_cell_renderer_spin_new ();
- buffer_size_adj = (GtkAdjustment *) gtk_adjustment_new(DEFAULT_CAPTURE_BUFFER_SIZE, 1, WTAP_MAX_PACKET_SIZE, 1.0, 10.0, 0.0);
+ buffer_size_adj = (GtkAdjustment *) gtk_adjustment_new(DEFAULT_CAPTURE_BUFFER_SIZE, 1, WTAP_MAX_PACKET_SIZE_STANDARD, 1.0, 10.0, 0.0);
g_object_set(G_OBJECT(renderer), "adjustment", buffer_size_adj, NULL);
column = gtk_tree_view_column_new_with_attributes ("Default buffer size (MiB)", renderer,
"text", BUF_COLUMN,
@@ -695,7 +695,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
gtk_tree_view_column_set_resizable(column, FALSE);
/*gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);*/
renderer = gtk_cell_renderer_spin_new ();
- snaplen_adj = (GtkAdjustment *) gtk_adjustment_new(WTAP_MAX_PACKET_SIZE, 1, WTAP_MAX_PACKET_SIZE, 1.0, 10.0, 0.0);
+ snaplen_adj = (GtkAdjustment *) gtk_adjustment_new(WTAP_MAX_PACKET_SIZE_STANDARD, 1, WTAP_MAX_PACKET_SIZE_STANDARD, 1.0, 10.0, 0.0);
g_object_set(G_OBJECT(renderer), "adjustment", snaplen_adj, NULL);
column = gtk_tree_view_column_new_with_attributes ("Default snap length", renderer,
"text", SNAPLEN_COLUMN,
@@ -834,7 +834,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_buffersize_lb, 0, row, 1, 1);
gtk_misc_set_alignment(GTK_MISC(if_buffersize_lb), 1.0f, 0.5f);
gtk_widget_show(if_buffersize_lb);
- buffer_size_adj = (GtkAdjustment *) gtk_adjustment_new(DEFAULT_CAPTURE_BUFFER_SIZE, 1, WTAP_MAX_PACKET_SIZE, 1.0, 10.0, 0.0);
+ buffer_size_adj = (GtkAdjustment *) gtk_adjustment_new(DEFAULT_CAPTURE_BUFFER_SIZE, 1, WTAP_MAX_PACKET_SIZE_STANDARD, 1.0, 10.0, 0.0);
if_buffersize_cb = gtk_spin_button_new (buffer_size_adj, 0, 0);
g_signal_connect(if_buffersize_cb, "value-changed", G_CALLBACK(ifopts_edit_buffersize_changed_cb),
cur_list);
@@ -852,7 +852,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
cur_list);
ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_snaplen_tg, 2, row, 1, 1);
gtk_widget_show(if_snaplen_tg);
- snaplen_adj = (GtkAdjustment *) gtk_adjustment_new(WTAP_MAX_PACKET_SIZE, 1, WTAP_MAX_PACKET_SIZE, 1.0, 10.0, 0.0);
+ snaplen_adj = (GtkAdjustment *) gtk_adjustment_new(WTAP_MAX_PACKET_SIZE_STANDARD, 1, WTAP_MAX_PACKET_SIZE_STANDARD, 1.0, 10.0, 0.0);
if_snaplen_cb = gtk_spin_button_new (snaplen_adj, 0, 0);
g_signal_connect(if_snaplen_cb, "value-changed", G_CALLBACK(ifopts_edit_snaplen_changed_cb),
cur_list);
@@ -1449,7 +1449,7 @@ ifopts_edit_snaplen_changed_cb(GtkSpinButton *sb _U_, gpointer udata _U_)
/* get current description text and set value in list_store for currently selected interface */
snaplen = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sb));
- if (snaplen != WTAP_MAX_PACKET_SIZE) {
+ if (snaplen != WTAP_MAX_PACKET_SIZE_STANDARD) {
hassnap = TRUE;
} else {
hassnap = FALSE;
@@ -1656,7 +1656,7 @@ ifopts_options_add(GtkListStore *list_store, if_info_t *if_info)
#endif
if (!capture_dev_user_snaplen_find(if_info->name, &hassnap, &snaplen)) {
- snaplen = WTAP_MAX_PACKET_SIZE;
+ snaplen = WTAP_MAX_PACKET_SIZE_STANDARD;
hassnap = FALSE;
}
@@ -2007,7 +2007,7 @@ ifopts_write_new_snaplen(void)
* create/cat interface snap length to new string
* (leave space for parens, comma and terminator)
*/
- tmp_snaplen = g_strdup_printf("%s:%d(%d)", ifnm, hassnap, (hassnap?snaplen:WTAP_MAX_PACKET_SIZE));
+ tmp_snaplen = g_strdup_printf("%s:%d(%d)", ifnm, hassnap, (hassnap?snaplen:WTAP_MAX_PACKET_SIZE_STANDARD));
g_strlcat(new_snaplen, tmp_snaplen, MAX_VAL_LEN);
g_free(tmp_snaplen);
g_free(ifnm);
diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c
index 41946ca9ea..e219f6648f 100644
--- a/ui/gtk/summary_dlg.c
+++ b/ui/gtk/summary_dlg.c
@@ -268,7 +268,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
g_snprintf(string_buff, SUM_STR_MAX, "%s", wtap_encap_string(summary.file_encap_type));
add_string_to_grid(grid, &row, "Encapsulation:", string_buff);
}
- if (summary.has_snap) {
+ if (summary.snap != 0) {
/* snapshot length */
g_snprintf(string_buff, SUM_STR_MAX, "%u bytes", summary.snap);
add_string_to_grid(grid, &row, "Packet size limit:", string_buff);
@@ -708,7 +708,7 @@ summary_to_texbuff(GtkTextBuffer *buffer)
g_snprintf(string_buff, SUM_STR_MAX, INDENT "Encapsulation: %s\n", wtap_encap_string(summary.file_encap_type));
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
}
- if (summary.has_snap) {
+ if (summary.snap != 0) {
/* snapshot length */
g_snprintf(string_buff, SUM_STR_MAX, INDENT "Packet size limit: %u bytes\n", summary.snap);
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);