diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-06-04 18:58:40 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-06-05 05:28:26 +0000 |
commit | d0865fd619454a9ac06b1c7d287dc438aff50bb0 (patch) | |
tree | 91efc24ec72d274b1529342041641b36939236f2 /ui/qt | |
parent | 17965f57f178aa7e4027f2d363658098e2f1abb3 (diff) | |
download | wireshark-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/qt')
-rw-r--r-- | ui/qt/capture_file_properties_dialog.cpp | 2 | ||||
-rw-r--r-- | ui/qt/capture_interfaces_dialog.cpp | 16 | ||||
-rw-r--r-- | ui/qt/compiled_filter_output.cpp | 2 | ||||
-rw-r--r-- | ui/qt/gsm_map_summary_dialog.cpp | 2 | ||||
-rw-r--r-- | ui/qt/interface_tree_cache_model.cpp | 6 | ||||
-rw-r--r-- | ui/qt/mtp3_summary_dialog.cpp | 2 |
6 files changed, 15 insertions, 15 deletions
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) |