Commit Graph

7682 Commits

Author SHA1 Message Date
Gerald Combs 3bde296404 [Automatic update for 2023-01-15]
Update manuf, services enterprise numbers, translations, and other items.
2023-01-15 23:10:01 +00:00
John Thacker acf0ee420f Proto hierarchy stats: obtain capture file read lock
Obtain the capture file read lock when computing protocol hierarchy
stats to prevent segfaulting if the file is closed.

The protocol hierarchy stats are always computed on all the packets
of the current file that pass the current filter, so don't let it run
until a read or rescan is complete.

Since the protocol hierarchy stats use the common progress bar,
these two changes keep it from hijacking the progress bar when a
rescan is in progress, which led to anomolies with the stop button
behavior and clearing the progress bar when the stats were done
(but not the temporarily paused rescan.)

Make the stop button actually stop the protocol hierarchy stats.

In the future, the protocol hierarchy stats could perhaps use
process_specified_records from file.c

Fix #18787. Fix #18788.
2023-01-15 16:09:17 +00:00
John Thacker 0c3c3e9342 Qt: ElidedLabel escapes HTML
ElidedLabel escapes HTML after !9261, so use its own methods to make text
small and italicized instead of passing in rich text.

IOGraphDialog used to make an error message, if it existed, bold.
Perhaps ElidedLabel should have a way to have prepended bold
text for such usage.
2023-01-14 13:20:00 -05:00
John Thacker a25bcce10a Qt: Only autoset display filter when dialog is opened
Autoset "Limit to display filter" if a display filter is
present when the dialog is open, but do not re-enable it each
time the widget is updated, if the user has unchecked it.

[skip ci]

Fix #18461
2023-01-14 13:17:02 -05:00
John Thacker 4484736366 Qt: Set small text for ExpertInfoDialog filter
ElidedLabel has its own method to set small text and italicize.
After !9261, any HTML that is passed into it appears escaped,
which we don't want.
2023-01-14 12:19:45 -05:00
João Valverde a23bab971e MinGW: Disable -Wcast-function-type warnings 2023-01-14 14:52:53 +00:00
Gerald Combs ad3205000b Qt: Add a donation link to the welcome page 2023-01-14 02:09:55 +00:00
John Thacker a59a663618 Qt: Sort strings, like GeoIP country or city, in Endpoints
QVariant canConvert<double>() does not test that a particular QVariant
value can be converted to a double, but only that at least some values
of that type can convert. (Just checking the type is much faster than
actually trying the conversion; this is why convert() has a boolean
output parameter as well.) It thus always returns TRUE for strings even
for strings that fail to convert, and is not by itself a useful test
when trying to sort unknown types.

Luckily, we don't need to test this anyway. Set the default data role used
for sorting to UNFORMATTED_DISPLAYDATA, so the parent QSortFilterProxyModel
will handle QVariants that are numbers appropriately. In particular,
this makes the GeoIP city and country column strings in the Endpoints
table sort correctly.

Fix #18749
2023-01-13 19:13:02 -05:00
John Thacker 4307d13195 Qt: Fix selection of filter column in Conversation table
When converting from our columns as displayed to the canonical
list of columns, add 1 for the missing conversation ID if it
is not present (as opposed to if it is present.) Also change the
test for the total packets to account for the new conversation ID
column.

Related to #18738
2023-01-13 18:07:07 -05:00
João Valverde f3152af8a0 MinGW: Fix -Wsign-compare 2023-01-13 22:41:04 +00:00
João Valverde 215a2d7477 MinGW: Fix -Wformat-zero-length 2023-01-13 22:41:04 +00:00
João Valverde b94e7f953f MinGW: Fix -Wreturn-type
main.cpp:1087:1: error: no return statement in function returning non-void [-Werror=return-type]
 1087 | }
      | ^
2023-01-13 22:41:04 +00:00
João Valverde 6801490aea Qt: Fix AA_EnableHighDpiScaling Qt6 deprecation 2023-01-13 22:41:04 +00:00
João Valverde 5b54223ce5 version info: Fix extra space after "(" 2023-01-13 16:09:17 +00:00
John Thacker bf8f30eba4 Qt: Fix test for appending rows to UAT tables
We want to return with failure when the number of entries in
the row we're trying to append is greater than the number of
columns, not less than the number of rows in the table.

The IO Graph is the only place that uses appendEntry, and this
allows adding IO Graphs past the tenth graph.

Fix #18762
2023-01-13 09:02:47 +00:00
João Valverde d00bd20fea MSYS2: Fix system installation
Make the "ninja install" target in the MINGW64 shell work and
allow Wireshark to run from the msys2 installation, besides
the build directory.

To clarify the names used here MSYSTEM is the distribution with a
Linux-like environment for Windows. MINGW is the toolchain.

It is possible to use MinGW without MSYS2 and we generally select
the CMake variables WIN32/MSVC/MINGW/USE_MSYSTEM taking that into
consideration but that WIN32+MINGW platform is not supported at the
moment and it's unlikely to be supported in the near future.
2023-01-12 14:30:41 +00:00
João Valverde 4c9b0d846c CMake: Reverse debug macros
Originally WS_DISABLE_DEBUG was chosen to be
similar to G_DISABLE_ASSERT and NDEBUG.

However generator expressions are essential for modern CMake
but the syntax is weird and having to use negations makes it
ten-fold worse.

Remove the negation. Instead of changing the CMake variable
reverse the macro definition for WS_DISABLE_DEBUG.

The $<CONFIG:cgs> generator expression with multiple config arguments
requires CMake >= 3.19 so we can't use that yet for a further
syntactical simplification.
2023-01-12 00:59:15 +00:00
João Valverde 25d4a099f7 Remove WS_DISABLE_ASSERT
Assertions can be enabled/disabled using WS_DISABLE_DEBUG. The extra
granularity afforded by WS_DISABLE_ASSERT seems unnecessary.
2023-01-12 00:59:15 +00:00
John Thacker 06ba704058 Qt: Accept ColoringRulesDialog after writing colors
Instead of connecting ColoringRulesDialog's buttonBox accepted()
signal to two different slots (once in the .ui file, and one
automatically from a name), accept the dialog only after writing
the colors.

This prevents starting to recolor the PacketList before the new color
list has been been written.

Fix #12475. Fix #15471.
2023-01-11 17:11:49 -05:00
Martin Mathieson fc013d9bd6 Set unique exit codes for processes 2023-01-11 09:56:26 +00:00
Gerald Combs 0f824b8b34 [Automatic update for 2023-01-08]
Update manuf, services enterprise numbers, translations, and other items.

services failed.
2023-01-09 03:16:38 +00:00
John Thacker 0c24b0ae72 Qt: Remove duplicate column reset and cache invalidation
The filterPackets method calls file.c/cf_filter_packets,
which calls rescan_packets, which sends signals when done that
eventually calls the PacketList::captureFileReadFinished

PacketList::captureFileReadFinished invalidates all the column
strings after the rescan may have updated their information
(e.g., delta time to previous displayed packet), so it is not
necessary to reset the column strings a second time explicitly
in filterPackets.

Commit 38cde83a5c added the reset
to filterPackets, but commit bbe5fc1028
added the invalidateAllColumnStrings to captureFileReadFinished
that made the prior commit unnecessary.
2023-01-07 09:05:17 -05:00
John Thacker da3a48f820 Qt: Add a pref for column text caching, and have it affect sorting
Introduce a preference for the number of rows whose column text can
be cached, and allow sorting of the packet list only when the
number of displayed rows can fit in the cache. This preference only has
an effect for sorting based on columns that require dissection and
caching the column text. This reduces the number of dissections from
O(N log N) to N. Subsequent sorts are even faster.

Columns based on frame data are unaffected, as they sort much faster
as dissection is not required.

Set the size of the QCache introduced in 8c6854fb65 based
on this preference.

Send a temporary status message to the status bar if we try to sort
but there are too many rows, explaining why sorting did not happen and
that the layout preferences can be changed.

Ping #18741
2023-01-07 13:20:24 +00:00
João Valverde df30299aff dftest: Add -h and improve output format
Experiment with removing the type from the instruction output.

This information is also available with the -s option flag.

Rename -t to -s.
2023-01-06 01:43:42 +00:00
John Thacker 0e93070745 follow: Add function for sub stream id to registration
When dissectors register for Follow Stream, have them register a
function for finding the next valid sub stream id for a given
stream and substream id pair. This function is NULL if the dissector
does not use sub stream IDs.

Use this function in follow_stream_dialog to update the sub stream
id widget (and use the absence of the function to disable and hide
the widget.) Use this function in the CLI tap-follow to determine
whether to parse a sub stream id from the command line options.

This removes the dependencies on epan/dissectors from the Qt
follow_stream_dialog, and gets us closer to having dissectors
being able to register for Follow Stream without having to update
anything in the common source code.
2023-01-05 05:04:33 +00:00
Developer Alexander 39191ca8d0 IO Graph: Allow changing order of graphs
Allow changing the order of graphs in IO Graph.
This improves usability when working with many graphs.
2023-01-04 09:25:49 +00:00
Tomasz Moń 8c6854fb65 Qt: Cache only recently accessed columns text
Remove MINIMIZE_STRING_COPYING define because the code does not even
compile anymore. Do not cache strings when ensuring rows are colorized
to avoid thrashing cache. Store column data only for last 500 accessed
records to ensure there is upper bound for the cache size.

Fixes #18741
2023-01-02 12:22:34 +00:00
Gerald Combs d9adb6f712 Qt: Escape HTML when setting ElidedLabel text
ElidedLabels use Qt's rich text internally, but we need to make sure the
text we're passed via setText() is plain.

Fixes #18774
2023-01-02 12:16:35 +00:00
Gerald Combs 1c24e49c67 Qt: ElidedLabel cleanup
Add Doxygen documentaiton and fix a clazy-qstring-arg warning.
2023-01-02 12:16:35 +00:00
Stig Bjørlykke 67a788b29c Happy New Year 2023 2023-01-01 10:22:36 +01:00
Alexander Clouter ee7d3507eb qt: Ignore gcc 12.1 optimization bug with Qt (more e1a6913a) 2022-12-31 20:45:15 +00:00
João Valverde 1400d92724 dfilter: Add compilation warning for ambiguous syntax
$ dfilter 'frame contains fc'
    Filter: frame contains fc

    Warning: Interpreting "fc" as "Fibre Channel". Consider writing :fc or .fc.
    (...)
2022-12-29 23:48:56 +00:00
Gerald Combs e93989c56a Qt: Fix an IAX2 Analysis dialog memory leak.
Fix

*** CID 1517838:  Resource leaks  (RESOURCE_LEAK)
/builds/wireshark/wireshark/ui/qt/iax2_analysis_dialog.cpp: 311 in Iax2AnalysisDialog::Iax2AnalysisDialog(QWidget &, CaptureFile &)()
305         }
306
307         if (!cap_file_.capFile() || !cap_file_.capFile()->current_frame) {
308             err_str_ = tr("Please select an IAX2 packet.");
309             save_payload_error_ = TAP_IAX2_NO_PACKET_SELECTED;
310             updateWidgets();
>>>     CID 1517838:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "sfcode" going out of scope leaks the storage it points to.
311             return;
312         }
313
314         if (!cf_read_current_record(cap_file_.capFile())) close();
315
316         frame_data *fdata = cap_file_.capFile()->current_frame;
2022-12-27 22:58:05 +00:00
John Thacker f0f72927b4 epan: Allow FT_IPv4, FT_IPv6 custom columns to be resolved or not.
Similar to commit dbb9fe2a37, proto_item_fill_display_label
now uses address_to_display for FT_IPv4, FT_IPv6, and FT_FCWWN,
the other three address types that double as field types and which
have optional name resolution.

Add these to the list of types that, if present in a custom column,
has the GUI enable the checkbox to switch between "resolved" (names)
and not (values).

This allows adding custom columns with these field types with both
resolved and non resolved text. Note that the appropriate Name
Resolution preference settings must be enabled for the type as well.
2022-12-26 16:12:19 +00:00
Gerald Combs 274a6c9d64 [Automatic update for 2022-12-25]
Update manuf, services enterprise numbers, translations, and other items.

services failed.
2022-12-25 16:46:13 +00:00
Guy Harris 63bd8fde63 Fix display of help file path name in error dialog.
Display it as a pathname in the native format (e.g., C:\this\is\wrong),
not as the path component of the URL supplied (e.g., /C/this/is/wrong).

Fixes some confusion that appeared in a comment in #15592 (but not the
underlying bug - fixing that bug should prevent that dialog from popping
up in the first place).
2022-12-22 18:28:04 -08:00
Chuck Craft c654566fc6 UAT: comment out FIX reminder 2022-12-20 17:45:17 -06:00
Gerald Combs 6459b5f6d1 Qt: Improve our font preference compatibility.
Qt5 font strings can have 10 or 11 fields.
2022-12-19 19:53:50 +00:00
John Thacker dbb9fe2a37 epan: Allow FT_ETHER custom columns to be resolved or not
Have proto_item_fill_display_label (which is used for custom
columns resolved type and packet diagrams) use address_to_display
for FT_ETHER. This is resolved when name resolution for MAC
Addresses is enabled.

Add FT_ETHER to the list of types that, if present in a custom
column, has the GUI enable the checkbox to switch between "resolved"
and "unresolved" text.

This allows FT_ETHER custom columns to be displayed as either
resolved addresses or unresolved. (Note that to be displayed
as resolved, the column resolved option must be checked and
the name resolution preference enabled.)

Fix #18665
2022-12-17 20:07:45 +00:00
João Valverde ae14849864 Windows: Use SpeexDSP binary package
Remove bundled code and use vcpkg binary library instead.
2022-12-16 11:11:28 +00:00
Roland Knall 18c2f29610 Qt: Limit copy of TrafficDialog to visible items
The traffic dialogs did not respect the filtered elements, when copying
data as CSV, Yaml or JSON

Fixes #18530
Fixes #18637
2022-12-15 16:39:54 +00:00
Roland Knall c1169d587c Qt: Fix Packet Comments shortcut
The shortcut for adding a new packet comment is not available
until the menu has first been shown, or a packet has been selected.

This is a bug, as it is not clear to the user, why the shortcut should
exist in one instance and not in the other. Therefore the shortcut is
always added.

It is not added in the .ui files, as this would trigger a new set of
translations.

Fixes #18673
2022-12-15 15:46:53 +00:00
Philipp Dittmann bca2b4dd9e Qt: Fix Qt 6.4 QMouseEvent deprecation
QMouseEvent constructor is deprecated in Qt 6.4. Changed to another
6.0 constructor.
2022-12-15 14:12:54 +00:00
Tomasz Moń c6ee65db6b
Qt: Display extcap uncheckable multicheck items as labels
Commit e1a8f0119e ("Extcap prefs: Editor remembers empty values")
inadvertently made the immutable checkbox visible next to uncheckable
multicheck items. Restore former behavior, that is display only labels
for uncheckable multicheck items, by setting unchecked state only for
checkable items.

Uncheckable items, since its introduction in commit 9c1225f735
("Modify multicheck to accept parent parameter."), were used to display
additional labels in USBPcap configuration options to aid user in
determining which individual device to filter on. Without the additional
information determining for example which "USB composite device" is of
interest to the user is really problematic.
2022-12-15 06:50:49 +01:00
João Valverde 2d3de008f5 CMake: Disable UTF-8 debug checks for release builds
Disable UTF-8 debug checks for release builds for optimization
purposes.

Also remove unused macro that currently lacks a proper use case.

Change version info to be more complete about the build type without
being too verbose.
2022-12-15 01:57:39 +00:00
Chuck Craft 2aa40d4488 Qt: crash on negative row in Conversations 2022-12-14 18:10:58 +00:00
Developer Alexander edf48633bb IO Graph: 3 new styles 2022-12-14 15:02:54 +00:00
Moshe Kaplan f413260df9 WSLUA: Add new lua function register_packet_menu()
This adds support to Wireshark for custom context menus for packets, so
that when a packet's context menu is opened (e.g., by right-clicking),
Wireshark can support doing things like "run a program" or
"open a URL" with a field from the packet as a parameter. Note that
this is similar to ArcSight's integration commands feature.

For example, it could be used like the following:

```
ROBTEX_URL = "https://www.robtex.com/dns-lookup/"
local function search_robtex(...)
    local fields = {...};

    for i, field in ipairs( fields ) do
        if (field.name == 'http.host') then
            browser_open_url(ROBTEX_URL .. field.value)
            break
        end
    end
end
register_packet_menu("Search host in Robtex", search_robtex, "http.host");
```

Fixes issue #14998
2022-12-07 18:47:14 +00:00
Gerald Combs 932f4ff893 Qt: Don't use QString::toLocal8Bit().
As the QString::toLocal8Bit() documentation says,

"On Unix systems this is equivalen to toUtf8(), on Windows the systems
current code page is being used."

This is problematic for the Packet Comments dialog, since the comments
need to be UTF-8 as per the pcapng specification. Use toUtf8() instead
there and in the Import Text dialog.

Remove the toLocal8Bit() calls from the Extcap Options dialog since they
weren'nt needed.

Blind attempt at fixing #18698.
2022-12-06 17:19:07 +00:00
Gerald Combs cb85a4b1a4 Qt: Convert our widgets and models to new-style signals & slots
Convert our remaining widget and model code to new-style signals and
slots.
2022-12-05 19:53:34 +00:00
Gerald Combs 0c1a10b02b Qt: Update an action name.
647978b8be renamed actionAnalyzeCreateAColumn to
actionAnalyzeApplyAsColumn. Update the packet list accordingly.
2022-12-05 10:03:18 -08:00
Gerald Combs 647978b8be Qt: Manually connect our "Analyze" menu actions. 2022-12-04 22:54:01 +00:00
Gerald Combs 5eb2a7f7b7 Qt: Miscellaneous ByteViewText fixes.
Don't use isEmpty() internally. Name a variable "em_width_" to match the
convention we use elsewhere. Use our viewport's font metrics.
2022-12-03 18:47:36 +00:00
João Valverde 967a3c3df9 Qt: Check field autocomplete for syntactical validity
Currently the autocompletion engine always suggests a protocol
field completion, even in places where it isn't syntactically
valid.

Fix that by compiling the preamble to the token under the cursor
and checking the returned error. If it is DF_ERROR_UNEXPECTED_END
that indicates a field or literal value was expected. Otherwise
a field replacement is not valid in this position.

Fixes #12811.
2022-12-01 22:50:09 +00:00
João Valverde a0d77e9329 dfilter: Return an error object instead of string
Return an struct containing error information. This simplifies
the interface to more easily provide richer diagnostics in the future.

Add an error code besides a human-readable error string to allow
checking programmatically for errors in a robust manner. Currently
there is only a generic error code, it is expected to increase
in the future.

Move error location information to the struct. Change callers and
implementation to use the new interface.
2022-11-28 15:46:44 +00:00
j.novak@netsystem.cz e67c71faba RTP Player: Fix: Playback marker do not move after resume with Qt6 2022-11-24 15:32:36 +00:00
John Thacker 5af4587255 QCustomPlot: Fix some warnings in upstream code
QPainter::HighQualityAntialiasing is obsolete and ignored
(https://doc.qt.io/qt-5/qpainter.html#RenderHint-enum) since
at least 5.6, so use Antialiasing instead, as indicated by the docs.
(https://doc.qt.io/archives/qt-5.6/qpainter.html#RenderHint-enum)

(ported from commit d0088585b3)
2022-11-23 01:02:25 +00:00
Alexis La Goutte 6959280581 QCustomPlot: Fix Clang Warnings
qcustomplot.cpp:34001:37: warning: The left operand of '-' is a garbage value [core.UndefinedBinaryOperatorResult]
qcustomplot.cpp:34001:37: warning: The right operand of '-' is a garbage value [core.UndefinedBinaryOperatorResult]

(ported from commit a0328bdb03)

qcustomplot.cpp:26643:9: warning: 1st function call argument is an uninitialized value [core.CallAndMessage]
qcustomplot.cpp:27752:11: warning: 1st function call argument is an uninitialized value [core.CallAndMessage]
qcustomplot.cpp:27779:11: warning: 1st function call argument is an uninitialized value [core.CallAndMessage]
qcustomplot.cpp:34087:7: warning: 2nd function call argument is an uninitialized value [core.CallAndMessage]

(ported from commit 075ee9138a)

qcustomplot.cpp:22400:17: warning: The left operand of '>' is a garbage value [core.UndefinedBinaryOperatorResult]
qcustomplot.cpp:22400:17: warning: The right operand of '>' is a garbage value [core.UndefinedBinaryOperatorResult]
qcustomplot.cpp:35170:17: warning: The left operand of '>' is a garbage value [core.UndefinedBinaryOperatorResult]
qcustomplot.cpp:35170:17: warning: The right operand of '>' is a garbage value [core.UndefinedBinaryOperatorResult]

(ported from commit 6fd4188804)
2022-11-23 01:02:25 +00:00
João Valverde ea7bec688a QCustomPlot: Try to fix -Wdocumentation-html warnings
Warning triggered using AppleClang 11.0.0.

/Users/buildslave/builds/UfJL1hoT/0/wireshark/wireshark/ui/qt/widgets/qcustomplot.cpp:16020:17: error: HTML tag 'tt' requires an end tag [-Werror,-Wdocumentation-html]
  parameter as <tt>QVariant(\ref QCPDataSelection)</tt>. All plottables that weren't touched by \a
               ~^~~
1 error generated.

(ported from commit 6d2aea45e4)
(ported from commit 3903740534)
2022-11-23 01:02:25 +00:00
John Thacker b262dd3d29 QCustomPlot: Fix clang warning on Qt5
Fix a shortening warning from qint64 to int on Qt5.
2022-11-23 01:02:25 +00:00
John Thacker 117fa55c04 QCustomPlot: Fix some clang code analysis warnings
Two dead stores and a possible call of memcpy with a null
destination.

(cherry picked from commit 67301b471a)
2022-11-23 01:02:25 +00:00
John Thacker f60e35e481 QCustomPlot: Fix spelling 2022-11-23 01:02:25 +00:00
Kevin Hogan c90ba8c1b1 QCustomPlot: Fix adaptive sampling performance on scatterplots
QCustomPlot's adaptive sampling decimates the data to be plotted based
on the screen resolution.  Specifically, if many data points fit within
the same pixel on the X (key) axis, then QCustomPlot attempts to plot
only the min value, the max value, and a few values in-between to
maintain a good "density" on the Y (value) axis.

The density QCustomPlot wants is about one datapoint for every 4 pixels
covered by the value range of a single X (key) pixel.  Unfortunately,
this calculation is flawed if all values also fit within a single pixel
on the Y (value) axis - so this change fixes that bug.

(cherry picked from commit 92e652ebfa)
2022-11-23 01:02:25 +00:00
João Valverde cb9a1479cd QCustomPlot: Fix clang -Wmisleading-indentation
(ported from commit e5cb4ddd87)
2022-11-23 01:02:25 +00:00
John Thacker e5dc339c18 QCustomplot: Fix clang -Wdocumentation 2022-11-23 01:02:25 +00:00
Gerald Combs b9b16e2f64 QCustomPlot: Fix qsizetype warnings
Starting with Qt 5.10 (our earliest supported version),
Qt has a qsizetype (alias of ssize_t) that functions
like size() and indexOf() return. On clang that does not
have the same size as an int, so cast it away in a number
of places.
2022-11-23 01:02:25 +00:00
John Thacker 498dc04278 Qt: Update QCustomPlot to 2.1.1
Remove a bunch of line ending whitespace from upstream to
get it to compile.

Fix #18654
2022-11-23 01:02:25 +00:00
John Thacker 646df7fe14 Qt: Fix crash when clicking on expanded entry in Expert Info Dialog
The root node has a NULL associated field_info struct, so check
for that.

Fix #18662
2022-11-21 20:36:41 -05:00
João Valverde 2128053e7c Qt: Improve log handler output
Use LOG_LEVEL_ECHO instead of LOG_LEVEL_WARNING for debug
output that is always displayed.

Add file/line/function information.
2022-11-21 12:23:50 +00:00
Gerald Combs f9e0e555e0 [Automatic update for 2022-11-20]
Update manuf, services enterprise numbers, translations, and other items.

services failed.
2022-11-20 16:46:55 +00:00
João Valverde 79c3a77752 Add macros to control lemon diagnostics
Rename flex macros using parenthesis (mostly a style issue):

DIAG_OFF_FLEX -> DIAG_OFF_FLEX()
DIAG_ON_FLEX  -> DIAG_ON_FLEX()

Use the same kind of construct with lemon generated code using
DIAG_OFF_LEMON() and DIAG_ON_LEMON(). Use %include and %code
directives to enforce the desired order with generated code
in the middle in between pragmas.

Fix a clang-specific pragma to use DIAG_OFF_CLANG().

DIAG_OFF(unreachable-code) -> DIAG_OFF_CLANG(unreachable-code).

Apparently GCC is ignoring the -Wunreachable flag, that's why
it did not trigger an unknown pragma warning. From [1}:

  The -Wunreachable-code has been removed, because it was unstable: it
  relied on the optimizer, and so different versions of gcc would warn
  about different code.  The compiler still accepts and ignores the
  command line option so that existing Makefiles are not broken.  In some
  future release the option will be removed entirely. - Ian

[1] https://gcc.gnu.org/legacy-ml/gcc-help/2011-05/msg00360.html
2022-11-20 10:11:27 +00:00
João Valverde 3903740534 Try to fix more -Wdocumentation-html warnings
/Users/buildslave/builds/UfJL1hoT/0/wireshark/wireshark/ui/qt/widgets/qcustomplot.cpp:16020:17: error: HTML tag 'tt' requires an end tag [-Werror,-Wdocumentation-html]
  parameter as <tt>QVariant(\ref QCPDataSelection)</tt>. All plottables that weren't touched by \a
               ~^~~
1 error generated.
2022-11-17 13:34:21 +00:00
João Valverde 6d2aea45e4 Try to fix an -Wdocumentation-html warnings
Warning triggered using AppleClang 11.0.0.
2022-11-17 12:34:42 +00:00
João Valverde cfbe898dcc CMake: Disable -Werror for flex generated files 2022-11-17 10:23:12 +00:00
João Valverde 09718fb9b3 CMake: Move clang warnings
Move clang warnings to normal set. Let the CMake compatibility
check control the warning.

Fix or work-around -Wunreachable warnings in the code.
2022-11-17 01:35:16 +00:00
John Thacker 5362cc9b3e Fix build on OpenSUSE 15.3
On older Qt versions (5.12?) QVector needs to be included,
not just QObject. (It isn't needed on 5.15, possibly because
QVector is an alias for QList in newer Qt versions.)
2022-11-16 08:21:13 +00:00
John Thacker 6e041d9afa Qt: Fix typo in proto_tree_model
Don't take the address of a pointer in the foreach function.
Fixes the main status bar not updating properly because of
inability to find a field.
2022-11-14 11:36:43 -05:00
John Thacker b7ed46288a Qt: Speed up ProtoTreeModel with lots of items
When creating a ProtoNode, count the (non-hidden) children and put
them in a QVector. This saves time having to iterate through all
of a node's children (or the parent's children) each time the
model or view wants to get the row or index number. Create and
delete the needed ProtoNodes when the root node is changed, instead
of recreating them on demand from the proto_nodes (since they're no
longer a thin wrapper.)

Fix #18625
2022-11-14 06:28:16 -05:00
Gerald Combs 0bfdd0d954 [Automatic update for 2022-11-13]
Update manuf, services enterprise numbers, translations, and other items.
2022-11-13 18:12:27 +00:00
John Thacker 91279eb90e Qt: Add GeoIP latitude and longitude to Endpoints table
Fix #17049
2022-11-10 17:48:29 +00:00
Gerald Combs 85357ae721 Fix more unused variables and enable unused-but-set-variable errors.
Add -Werror=unused-but-set-variable to our default compiler flags and fix

```
epan/dissectors/packet-dcerpc-frsrpc.c:709:10: error: variable 'nb_chunk' set but not used [-Werror,-Wunused-but-set-variable]
        guint32 nb_chunk = 0;
                ^
```

```
epan/dissectors/packet-dcom-oxid.c:175:13: error: variable 'u32ItemIdx' set but not used [-Werror,-Wunused-but-set-variable]
    guint32 u32ItemIdx;
            ^
```

```
epan/dissectors/packet-l2tp.c:1775:104: error: parameter 'ccid' set but not used [-Werror,-Wunused-but-set-parameter]
static int dissect_l2tp_ericsson_avps(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint32 ccid)
                                                                                                       ^
```

```
epan/dissectors/packet-ldp.c:1922:19: error: variable 'ix' set but not used [-Werror,-Wunused-but-set-variable]
    guint8        ix;
                  ^
```

```
epan/dissectors/packet-nas_5gs.c:4757:14: error: variable 'curr_len' set but not used [-Werror,-Wunused-but-set-variable]
    guint i, curr_len;
             ^
```

```
epan/dissectors/packet-per.c:1769:6: error: variable 'extension_addition_entries' set but not used [-Werror,-Wunused-but-set-variable]
        int extension_addition_entries;
            ^
```

```
epan/dissectors/packet-rtitcp.c:618:11: error: variable 'messages_count' set but not used [-Werror,-Wunused-but-set-variable]
    guint messages_count, offset;
          ^
```

```
epan/dissectors/packet-tcp.c:2130:9: error: variable 'ackcount' set but not used [-Werror,-Wunused-but-set-variable]
    int ackcount;
        ^
epan/dissectors/packet-tcp.c:3317:12: error: variable 'nbOptionsChanged' set but not used [-Werror,-Wunused-but-set-variable]
    guint8 nbOptionsChanged = 0;
           ^
```

```
epan/dissectors/packet-zbee-zcl-se.c:11802:15: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
    for (gint i = 0; tvb_reported_length_remaining(tvb, *offset) >= 5; i++) {
              ^
```

```
ui/iface_lists.c:142:23: error: variable 'linktype_count' set but not used [-Werror,-Wunused-but-set-variable]
    gint              linktype_count;
                      ^
```

```
ui/voip_calls.c:456:15: error: variable 'item_num' set but not used [-Werror,-Wunused-but-set-variable]
    guint     item_num;
              ^
```

```
file.c:572:17: error: variable 'count' set but not used [-Werror,-Wunused-but-set-variable]
        guint32 count             = 0;
                ^
```

```
file.c:3667:24: warning: cast from 'const unsigned char *' to 'unsigned char *' drops const qualifier [-Wcast-qual]
        pd = (guint8 *)ws_mempbrk_exec(pd, buf_end - pd, pattern, &c_char);
                       ^
```

```
ui/qt/io_graph_dialog.cpp:1932:60: error: variable 'mavg_right' set but not used [-Werror,-Wunused-but-set-variable]
    unsigned int mavg_in_average_count = 0, mavg_left = 0, mavg_right = 0;
                                                           ^
```

```
ui/qt/stats_tree_dialog.cpp:166:9: error: variable 'node_count' set but not used [-Werror,-Wunused-but-set-variable]
    int node_count = 0;
        ^
```

```
ui/qt/models/profile_model.cpp:1142:13: error: variable 'entryCount' set but not used [-Werror,-Wunused-but-set-variable]
        int entryCount = 0;
            ^
```
2022-11-08 13:49:44 -08:00
Stig Bjørlykke 16afad10fb Qt: Fix a deprecated warning
warning: 'parentWidget' is deprecated: Use parent() with qobject_cast()
instead [-Wdeprecated-declarations]
2022-11-06 22:33:25 +00:00
Gerald Combs 0bfe5bed72 [Automatic update for 2022-11-06]
Update manuf, services enterprise numbers, translations, and other items.
2022-11-06 17:57:36 +00:00
Martin Mathieson b860351e7f Packet List: preserve horizontal scroll extent for PgUp/PgDn 2022-11-05 21:56:19 +00:00
John Thacker e449b560c0 epan: Properly generate filter expressions for custom columns
Properly generate filter expressions for custom columns by
using proto_construct_match_selected_string on each value and
then joining them together later instead of trying to split
the column expression value.

This ensures that escaping is done properly for display filter
strings, that commas internal to field values are not confused
with commas between occurrences, that for multifield columns
we can distinguish which field each value matches, etc.

It's not entirely clear whether AND or OR logic is appropriate
for multiple occurrences; currently OR is used.

Bump glib requirement to 2.54 for g_ptr_array_find_with_equal_func
(this doesn't drop support for any major distribution that already
meets our other library requirements, like Qt.)

Fix #18001.
2022-11-02 19:46:11 +00:00
Roland Knall fd7716542c Qt: Move generic methods to utils
Move the utils for checking for the last used directory and storing
it out of ProfileDialog, as they are not Profiles specific
2022-11-01 18:12:07 +00:00
Chuck Craft 91c0669fb7 Qt: KeyboardInputInterval - allow more relaxed typing for keyboardSearch
Gtk popped up a search box when typing in the tree view.
Most places in Qt, a Search: field was added to the dialog.
Looks possible to buffer keystrokes and do a string search in Qt.

Default value is 400ms (even on Windows). Average typing speed of
200 cpm = 300ms per character = too close to 400ms when searching
the protocol name in Preferences -> Protocols.
2022-11-01 17:39:16 +00:00
David Perry c18809a861 Change some `wmem_packet_scope()` to `pinfo->pool` 2022-11-01 14:03:44 +00:00
Eugène Adell 6759377b93 TCP: Overriding of the automatic SEQ Analysis 2022-11-01 10:01:35 +00:00
Roland Knall 5f46ce935e Profiles: Fix export crashing for single profile
When the classic profile has been cloned, and it contains
coloring rules, that are no longer valid or their syntax is
wrong, the export of single profiles will fail.

The reason for that is still being investigated. It seems
there might be an issue with selecting the right coloringfilter
to be selected.

This change only fixes the coloringrules file and the
index is selected from the base model instead
2022-10-31 18:53:50 +00:00
Nils Hanke 34a66401e8 UI: Only sort visible packets instead of all packets
Previously, Wireshark was sorting all packets in a capture,
regardless whether they were actually visible or not. If you
are working with large PCAPs & filters, this is a MASSIVE
performance drag. Therefore, this commit changes this
by only sorting the visible packets which boosts the
sorting performance in filtered views massively.
2022-10-31 16:50:11 +00:00
John Thacker 2ad4b5bb3c Qt: Generate filter expressions for columns with multiple occurrences
Generate filter expressions for columns with multiple occurrences
by using the membership operator (which is semantically OR).
It's not clear if this approach makes more sense than AND;
there's use cases for both.

Don't do this for multifield custom columns, since we don't know
which values were found by which field. That takes changing
the column logic in several places.

Ping #18001
2022-10-31 16:03:24 +00:00
j.novak@netsystem.cz 3aafecb7b9 Main dialog: Wireshark stops extcap on exit if no packets received yet 2022-10-31 16:01:58 +00:00
Jaap Keuter 69daf2e339 QT: When opening files, filter on All Capture Files immediately 2022-10-31 14:35:49 +00:00
Jim Young 11990f258d Qt: Add ProgressFrame to the Expert Information dialog 2022-10-31 14:15:18 +00:00
Chuck Craft 81bd7b1415 Qt: filter_dialog - make Cancel button functional
Works properly when called from Capture/Display filter bookmark.
This change duplicates that code.
2022-10-31 14:14:00 +00:00
j.novak@netsystem.cz dd5f86c674 Capture options dialog: Fix start of capture by double click 2022-10-31 14:07:49 +00:00
Roland Knall c59804f25f Qt: Prevent dangling object for profile dialog
When running the profiles dialog from the main status bar,
some objects appear to be not cleaned up properly with Qt 6.
This will circumvent this, by creating an object for the
dialog and cleaning it on closing.

Fixes #18525
2022-10-31 10:10:42 +00:00
Gerald Combs a42d245c2b [Automatic update for 2022-10-30]
Update manuf, services enterprise numbers, translations, and other items.
2022-10-31 10:05:45 +00:00
Roland Knall ea41d58d47 Qt: TrafficTree - Add headers to CSV/YAML export
Exporting did not include the header information if exported via
CSV or YAML in the new dialogs. Adding those back
2022-10-30 17:13:44 +00:00