From d0865fd619454a9ac06b1c7d287dc438aff50bb0 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 4 Jun 2017 18:58:40 -0700 Subject: 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 Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- ui/capture_ui_utils.c | 4 ++-- ui/commandline.c | 6 +++++- ui/gtk/capture_dlg.c | 14 +++++++------- ui/gtk/file_import_dlg.c | 4 ++-- ui/gtk/gsm_map_summary.c | 2 +- ui/gtk/mtp3_summary.c | 2 +- ui/gtk/prefs_capture.c | 14 +++++++------- ui/gtk/summary_dlg.c | 4 ++-- ui/qt/capture_file_properties_dialog.cpp | 2 +- ui/qt/capture_interfaces_dialog.cpp | 16 ++++++++-------- ui/qt/compiled_filter_output.cpp | 2 +- ui/qt/gsm_map_summary_dialog.cpp | 2 +- ui/qt/interface_tree_cache_model.cpp | 6 +++--- ui/qt/mtp3_summary_dialog.cpp | 2 +- ui/tap_export_pdu.c | 4 ++-- ui/text_import.h | 2 +- 16 files changed, 45 insertions(+), 41 deletions(-) (limited to 'ui') diff --git a/ui/capture_ui_utils.c b/ui/capture_ui_utils.c index 36e75b37e9..5655632d91 100644 --- a/ui/capture_ui_utils.c +++ b/ui/capture_ui_utils.c @@ -202,10 +202,10 @@ capture_dev_user_snaplen_find(const gchar *if_name, gboolean *hassnap, int *snap if (strcmp(if_tokens[i], if_name) == 0) { /* OK, this matches. */ if (*(colonp + 1) == '0') { - /* {hassnap} is false, so just set the snaplen to WTAP_MAX_PACKET_SIZE. */ + /* {hassnap} is false, so just set the snaplen to WTAP_MAX_PACKET_SIZE_STANDARD. */ found = TRUE; *hassnap = FALSE; - *snaplen = WTAP_MAX_PACKET_SIZE; + *snaplen = WTAP_MAX_PACKET_SIZE_STANDARD; } else if (*(colonp + 1) == '1') { /* {hassnap} is true, so extract {snaplen} */ if (*(colonp + 2) != '(') { diff --git a/ui/commandline.c b/ui/commandline.c index fc4be16010..b7c1ef7db4 100644 --- a/ui/commandline.c +++ b/ui/commandline.c @@ -93,7 +93,11 @@ commandline_print_usage(gboolean for_help_option) { fprintf(output, "Capture interface:\n"); fprintf(output, " -i name or idx of interface (def: first non-loopback)\n"); fprintf(output, " -f packet filter in libpcap filter syntax\n"); - fprintf(output, " -s packet snapshot length (def: %u)\n", WTAP_MAX_PACKET_SIZE); +#ifdef HAVE_PCAP_CREATE + fprintf(output, " -s packet snapshot length (def: appropriate maximum)\n"); +#else + fprintf(output, " -s packet snapshot length (def: %u)\n", WTAP_MAX_PACKET_SIZE_STANDARD); +#endif fprintf(output, " -p don't capture in promiscuous mode\n"); fprintf(output, " -k start capturing immediately (def: do nothing)\n"); fprintf(output, " -S update packet display when new packets are captured\n"); 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); diff --git a/ui/qt/capture_file_properties_dialog.cpp b/ui/qt/capture_file_properties_dialog.cpp index 0cf0404fd0..dd53edfd32 100644 --- a/ui/qt/capture_file_properties_dialog.cpp +++ b/ui/qt/capture_file_properties_dialog.cpp @@ -192,7 +192,7 @@ QString CaptureFilePropertiesDialog::summaryToHtml() << table_data_tmpl.arg(encaps_str) << table_row_end; - if (summary.has_snap) { + if (summary.snap != 0) { out << table_row_begin << table_vheader_tmpl.arg(tr("Snapshot length")) << table_data_tmpl.arg(summary.snap) diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp index 3148e4fccc..d2969c0df7 100644 --- a/ui/qt/capture_interfaces_dialog.cpp +++ b/ui/qt/capture_interfaces_dialog.cpp @@ -704,10 +704,10 @@ void CaptureInterfacesDialog::updateInterfaces() if (capture_dev_user_snaplen_find(device->name, &hassnap, &snaplen)) { /* Default snap length set in preferences */ device->snaplen = snaplen; - device->has_snaplen = snaplen == WTAP_MAX_PACKET_SIZE ? FALSE : hassnap; + device->has_snaplen = snaplen == WTAP_MAX_PACKET_SIZE_STANDARD ? FALSE : 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; } @@ -1009,7 +1009,7 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences() snaplen_list << QString("%1:%2(%3)") .arg(device->name) .arg(device->has_snaplen) - .arg(device->has_snaplen ? device->snaplen : WTAP_MAX_PACKET_SIZE); + .arg(device->has_snaplen ? device->snaplen : WTAP_MAX_PACKET_SIZE_STANDARD); } g_free(prefs.capture_devices_snaplen); prefs.capture_devices_snaplen = qstring_strdup(snaplen_list.join(",")); @@ -1197,7 +1197,7 @@ QWidget* InterfaceTreeDelegate::createEditor(QWidget *parent, const QStyleOption #ifdef SHOW_BUFFER_COLUMN gint buffer = DEFAULT_CAPTURE_BUFFER_SIZE; #endif - guint snap = WTAP_MAX_PACKET_SIZE; + guint snap = WTAP_MAX_PACKET_SIZE_STANDARD; GList *links = NULL; if (idx.column() > 1 && idx.data().toString().compare(UTF8_EM_DASH)) { @@ -1247,7 +1247,7 @@ QWidget* InterfaceTreeDelegate::createEditor(QWidget *parent, const QStyleOption case col_snaplen_: { QSpinBox *sb = new QSpinBox(parent); - sb->setRange(1, WTAP_MAX_PACKET_SIZE); + sb->setRange(1, WTAP_MAX_PACKET_SIZE_STANDARD); sb->setValue(snap); sb->setWrapping(true); connect(sb, SIGNAL(valueChanged(int)), this, SLOT(snapshotLengthChanged(int))); @@ -1258,7 +1258,7 @@ QWidget* InterfaceTreeDelegate::createEditor(QWidget *parent, const QStyleOption case col_buffer_: { QSpinBox *sb = new QSpinBox(parent); - sb->setRange(1, WTAP_MAX_PACKET_SIZE); + sb->setRange(1, WTAP_MAX_PACKET_SIZE_STANDARD); sb->setValue(buffer); sb->setWrapping(true); connect(sb, SIGNAL(valueChanged(int)), this, SLOT(bufferSizeChanged(int))); @@ -1332,12 +1332,12 @@ void InterfaceTreeDelegate::snapshotLengthChanged(int value) if (!device) { return; } - if (value != WTAP_MAX_PACKET_SIZE) { + if (value != WTAP_MAX_PACKET_SIZE_STANDARD) { device->has_snaplen = true; device->snaplen = value; } else { device->has_snaplen = false; - device->snaplen = WTAP_MAX_PACKET_SIZE; + device->snaplen = WTAP_MAX_PACKET_SIZE_STANDARD; } } diff --git a/ui/qt/compiled_filter_output.cpp b/ui/qt/compiled_filter_output.cpp index ca718259a4..fda2332a33 100644 --- a/ui/qt/compiled_filter_output.cpp +++ b/ui/qt/compiled_filter_output.cpp @@ -88,7 +88,7 @@ void CompiledFilterOutput::compileFilter() if (interfaces.compare(device.display_name)) { continue; } else { - pcap_t *pd = pcap_open_dead(device.active_dlt, WTAP_MAX_PACKET_SIZE); + pcap_t *pd = pcap_open_dead(device.active_dlt, WTAP_MAX_PACKET_SIZE_STANDARD); if (pd == NULL) break; g_mutex_lock(pcap_compile_mtx); diff --git a/ui/qt/gsm_map_summary_dialog.cpp b/ui/qt/gsm_map_summary_dialog.cpp index 4b8c50747d..a13b116047 100644 --- a/ui/qt/gsm_map_summary_dialog.cpp +++ b/ui/qt/gsm_map_summary_dialog.cpp @@ -128,7 +128,7 @@ QString GsmMapSummaryDialog::summaryToHtml() << table_data_tmpl.arg(format_str) << table_row_end; - if (summary.has_snap) { + if (summary.snap != 0) { out << table_row_begin << table_vheader_tmpl.arg(tr("Snapshot length")) << table_data_tmpl.arg(summary.snap) diff --git a/ui/qt/interface_tree_cache_model.cpp b/ui/qt/interface_tree_cache_model.cpp index e89e266868..5447f80332 100644 --- a/ui/qt/interface_tree_cache_model.cpp +++ b/ui/qt/interface_tree_cache_model.cpp @@ -210,7 +210,7 @@ void InterfaceTreeCacheModel::save() else if ( col == IFTREE_COL_SNAPLEN ) { int iVal = saveValue.toInt(); - if ( iVal != WTAP_MAX_PACKET_SIZE ) + if ( iVal != WTAP_MAX_PACKET_SIZE_STANDARD ) { device.has_snaplen = true; device.snaplen = iVal; @@ -218,7 +218,7 @@ void InterfaceTreeCacheModel::save() else { device.has_snaplen = false; - device.snaplen = WTAP_MAX_PACKET_SIZE; + device.snaplen = WTAP_MAX_PACKET_SIZE_STANDARD; } } #ifdef CAN_SET_CAPTURE_BUFFER_SIZE @@ -270,7 +270,7 @@ void InterfaceTreeCacheModel::save() prefStorage[&prefs.capture_devices_snaplen] << QString("%1:%2(%3)").arg(device.name). arg(device.has_snaplen ? 1 : 0). - arg(device.has_snaplen ? value : WTAP_MAX_PACKET_SIZE); + arg(device.has_snaplen ? value : WTAP_MAX_PACKET_SIZE_STANDARD); } #ifdef CAN_SET_CAPTURE_BUFFER_SIZE diff --git a/ui/qt/mtp3_summary_dialog.cpp b/ui/qt/mtp3_summary_dialog.cpp index 62fcc7107c..3affcc94b2 100644 --- a/ui/qt/mtp3_summary_dialog.cpp +++ b/ui/qt/mtp3_summary_dialog.cpp @@ -133,7 +133,7 @@ QString Mtp3SummaryDialog::summaryToHtml() << table_data_tmpl.arg(format_str) << table_row_end; - if (summary.has_snap) { + if (summary.snap != 0) { out << table_row_begin << table_vheader_tmpl.arg(tr("Snapshot length")) << table_data_tmpl.arg(summary.snap) diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c index 76e4326ab3..3624e88c42 100644 --- a/ui/tap_export_pdu.c +++ b/ui/tap_export_pdu.c @@ -146,7 +146,7 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment) int_data_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(int_data); int_data_mand->wtap_encap = WTAP_ENCAP_WIRESHARK_UPPER_PDU; int_data_mand->time_units_per_second = 1000000000; /* default nanosecond 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, PDU->Export", strlen("Fake IF, PDU->Export")); wtap_block_add_uint8_option(int_data, OPT_IDB_TSRESOL, 9); @@ -156,7 +156,7 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment) g_array_append_val(shb_hdrs, shb_hdr); /* Use a random name for the temporary import buffer */ - exp_pdu_tap_data->wdh = wtap_dump_fdopen_ng(fd, WTAP_FILE_TYPE_SUBTYPE_PCAPNG, WTAP_ENCAP_WIRESHARK_UPPER_PDU, WTAP_MAX_PACKET_SIZE, FALSE, + exp_pdu_tap_data->wdh = wtap_dump_fdopen_ng(fd, WTAP_FILE_TYPE_SUBTYPE_PCAPNG, WTAP_ENCAP_WIRESHARK_UPPER_PDU, WTAP_MAX_PACKET_SIZE_STANDARD, FALSE, shb_hdrs, idb_inf, NULL, &err); if (exp_pdu_tap_data->wdh == NULL) { g_assert(err != 0); diff --git a/ui/text_import.h b/ui/text_import.h index 46f619421c..71ee2a2948 100644 --- a/ui/text_import.h +++ b/ui/text_import.h @@ -37,7 +37,7 @@ extern "C" { #endif /* __cplusplus */ -#define IMPORT_MAX_PACKET WTAP_MAX_PACKET_SIZE +#define IMPORT_MAX_PACKET WTAP_MAX_PACKET_SIZE_STANDARD /* The parameter interface */ -- cgit v1.2.1