Commit Graph

7699 Commits

Author SHA1 Message Date
Preben Guldberg b50ed1dc80 GUI: Colorize with filter could use an old filter
When right-clicking an item in the packet details and using "Colorize
with Filter", the colour may be applied using the wrong filter.

The code currently only updates the filter used for "Colorize with
Filter" if the packet details are visible and has focus. This is not
the case when you switch from one packet to another (at least by
clicking the other frame in the packet list).

The patch moves the emit of fieldFilterChanged() up to where the
filed_filter is identified. This seems the least intrusive.
2023-03-09 22:40:35 +00:00
Jaap Keuter cc04dad6d0 Qt: Put p->show() before p->setVisible to allow later to take effect
Closes #18882
2023-03-09 13:35:34 +00:00
Michal Ruprich 34d3f122d3 Converting QByteArray to const char * 2023-03-07 19:31:50 +00:00
John Thacker a93c775849 Qt: Fix copying from System Default profile
Set the "profile_filename" property on the special System Default
QAction in the CopyFromProfileButton so that the action will actually
do something when triggered.

Fix #13373
2023-03-07 01:22:10 +00:00
John Thacker 53914b0447 colors: Improve handling of errors
Pop up a dialog about bad coloring rules when reading the file
(e.g., when first starting Wireshark), rather than waiting until
you try to edit them.

Have that dialog have details of the problem with the filter
instead of a generic message. The report_warning code will
consolidate multiple warnings into one if more than one filter
has an error, rather than have lots of pop-ups.

Since the dialog (or console message, in the unlikely event that
somehow the colorfilters are read in a CLI tool) is called from
the color filters code, get rid of the separate non-specific
pop-up in ColoringRulesDialog and the special preference for
having a bogus filter.

Now, if the user has a bogus filter in the current profile's
colorfilter, they'll get a useful pop-up warning at startup,
when that filter is disabled. For filters imported / copied from
other profiles through the coloring rules dialog, they'll get the
same useful pop-up.

For trying to enable a disabled coloring rules with an error, or
inserting a *new* coloring rule with invalid filter expression (despite
the editor's Red background warning about an invalid expression),
there's already both the hint at the bottom of the screen and the
OK button becomes disabled. (Maybe the hint could be larger or
bold or something when there's an error.)

Fix #14906. Fix #15034
2023-03-06 12:17:02 +00:00
John Thacker 224d8dba97 Qt: Sequence diagram comments are not numbers
The comments in the flow diagrams are conceptually an extra y Axis
ticker label on the right. Tell QCustomPlot that we don't want to
render things that look like sufficiently large numbers in scientific
notation.

Fix #18879
2023-03-02 17:40:17 +00:00
John Thacker 36395517d3 Qt: Don't double escape sequence diagram comments
In the flow diagram, the hint is an ElidedLabel, which now
escapes HTML: d9adb6f712

So don't escape the comment before passing it to ElidedLabel, or
the double-escaping will cause quotes, angle brackets, etc. to
look like HTML entities.
2023-03-02 14:48:23 +00:00
John Thacker 0b6e641d3c help: WLANTraffic section moved WSUG chapters
The documentation for WLAN Traffic menu item in the Wireless menu
was moved from the Statistics Chapter to the Wireless Chapter of
the WSUG. Update the URL in its help button accordingly.

Part of #17982
2023-03-02 14:43:07 +00:00
John Thacker c6c9aae152 Qt: rtpstream_id memleak
Free fwd_id and rev_id, not just their members, if they aren't used.
Coverity CID 1512428
2023-03-02 08:55:28 -05:00
John Thacker 0d23b6692f Qt: RtpStreamDialog leak
In tapReset, the select rtpstread_id is copied member by member
by QList append(), so don't allocate pointers on the heap that
will be leaked. (Coverity 1477952)
2023-03-01 21:10:42 -05:00
John Thacker 44a38f0ad4 Qt: RTP Analysis Dialog leaks
Delete the tab name. Free the rtpstream_info_calc data after use.
2023-03-01 07:25:24 -05:00
John Thacker c9fee454e9 Qt: More RTP Leaks
Parent RtpAudioGraph with its QCustomPlot
2023-03-01 07:15:36 -05:00
John Thacker e51fea444a RTP: Fix some memleaks
In the tap, the stream ID allocated on the stack just needs a shallow
copy of the addresses. It only needs a deep copy when being added as a
new entry to the list.

Restore the memleak fix from e76ca2d3cb
that was accidentally removed by 1b4b5e59e9
2023-02-28 20:22:11 -05:00
Gerald Combs eb03246c6b [Automatic update for 2023-02-26]
Update manuf, services enterprise numbers, translations, and other items.
2023-02-27 17:07:14 +00:00
John Thacker 4fa5e0f3c9 Qt: Fix some leaks in RTP Analysis windows
Parent the QActions that are created for Analyze and Play
buttons for each RTP window, so that they are deleted when
the button is deleted.
2023-02-27 01:56:30 +00:00
John Thacker e7ed03d74f Qt: Remove unused member
This _GStringChunk is not initialized or used anywhere in
PacketListModel (and has not been for quite some time, since
62ca0a609b)
2023-02-26 08:39:16 -05:00
John Thacker 641434ff81 Qt: Fix leak in Coloring Rules Dialog
We don't need the cloned color_filter_t after the ColoringRuleItem
has been created (the char* strings are copied into QStrings), so
free it.
2023-02-25 18:50:56 +00:00
John Thacker ef0e96e447 Qt: Revert to our function for displaying bit speed with units
The Qt formattedDataSize() locale aware function only handles
sizes in bytes, not other units. Revert to using our format_size()
function from wsutil for the bits per second display string in
the Conversation window.

Fix #18211
2023-02-25 01:45:35 +00:00
John Thacker 5948274adb Qt: Show date for abs time for long captures in Conversations
Display the date with the absolute time if a conversation in the
conversation table is over 24 hours long. Parse user entered filter
strings for date times as both date times and dates.

Fix #16092
2023-02-23 12:59:50 +00:00
John Thacker 0bd4d9b132 Qt: Mapping between filter proxy column and displayed column
We need to convert between the column selected for filtering
by the user (which is based on what is currently displayed in the
tab) and the column in the model.

The default mapToSource requires a QModelIndex and needs a row,
and thus doesn't work when all rows are filtered out by the current
filter (that is being replaced.) However, since our filterAcceptsColumn
does not depend on the row, we can determine the mapping just based
on the column number.

We want to convert the filter column to the column used in the model
when it is first selected, so that hiding columns later doesn't
accidentally change what column is used for filtering.

Improved fix #18738
2023-02-23 11:23:41 +00:00
John Thacker 33493cb602 Qt: Fix conversation dialog timeline graph columns
Remove the separate copy of the conversation column type
enum in ConversationDialog. It doesn't correspond to the
enum in ATapDataModel, because it doesn't include the
Conversation ID and Total columns.

Delegates set to the Traffic Tree (a QTreeView) apply to
the displayed column number, not the what is displayed
in the column. That is, when columns are hidden (filtered),
the delegates stay with the old column number and end up
being displayed on new content. That's not what we want;
we want to always have the timeline graph on the Start and
Duration columns. Moving around the Delegate depending on
which columns are filtered is complicated; just set the
TimeLine delegate to the entire TrafficTree, and use the
default paint if we're on any column other than Start or
Duration. This does mean that we don't need to store a
map of Delegates.

Use a slightly different way to get TimelineDelegate to
paint the rect with no text using the current style, so
we can use the default paint with text for other columns.

The timeline graph needs to get the value of the Start and
Duration columns as filtered by the proxy column, so have
the model pass in indices so that they can be mapped to
the current displayed column.

Have the timeline graph apply to just the Start or just the
Duration column if only one is visible.

Together these compute the proper pixel values to apply
the timeline graph to the Start and Duration columns regardless
of which columns are displayed and which are filtered, in any
tab, regardless of what optional columns appear in that tab.

Fix #18860
2023-02-22 02:38:12 +00:00
Dr. Lars Völker e73ad66d70 UI: Fix typo in tooltip of Time Display Format
Fixes typo in tooltip for "Seconds Since First Captured Packet in
"Time Display Format".
2023-02-21 21:24:25 +00:00
Nicolás Alvarez 180e6cd48e Fix build of PacketListModel with Qt5
a9a7dcec21 broke the build by using std::as_const (new in C++17, we require
C++11). 189d93b4b8 switched to using a for loop with indices, but that
still fails on Qt5, because Qt5 uses int instead of qsizetype.

Switch back to the foreach-style loop, but using C++11 range-for instead of
Qt's foreach (which is semi-deprecated). Also, use qAsConst, which works in
C++11, instead of std::as_const.
2023-02-20 21:34:56 -03:00
John Thacker 189d93b4b8 Qt: Substitute for C++17 ism
Replace C++17 ism from !9822 with code with the same effect
that is valid earlier

(cherry picked from commit 50f71efbe0955b32dfb99bb4933f6ff310b39283)
2023-02-19 14:57:04 -05:00
John Thacker f6e6853dc4 Qt: Plug leaks in Conversations/Endpoints windows
Set some models to have the Traffic Tab or Traffic Type List
that creates them as parent, so that they will be deleted
properly. Setting a model does not cause it to be deleted
unless it is parented, because models can be shared among
multiple views. Since these models are only used by the
one view, parenting them is fine.
2023-02-19 12:10:44 +00:00
John Thacker a9a7dcec21 Qt: Ensure that add frame comments trigger recoloring, count updates
Add functions to PacketListRecord to invalidate a single record's
colorization and column strings, used for a record is modified in a
way that needs to trigger redrawing, but we don't need to redraw
all packets.

Move the functionality for adding, deleting, and setting frame comments
into PacketListModel, operating on QModelIndexes (or on all physical
rows in the case of deleting all comments from a file.) Trigger
recolorization of any record with an updated comment.

Only set a block as modified when deleting comments if we actually
deleted comments. This avoids marking a file as modified if we
delete all comments from all frames, or all comments from selected
frames, when those comments do not actually have frames.

If cf_set_modified_block is used to modify a block that is already
modified, it can't update the comment count. In that case, return
false and have the callers update the comment count. (It already
has a return value, which is always true.) This avoids having the
GUI warning about saving into a format that doesn't support comments
when comments have been added and then removed.

Note that, unlike with time references and time shifts, there
are no fields (and hence no columns nor color filters) that depend
on whether other fields have comments. If for some reason some
were added, then the model data for all frames would have to be
updated instead. Since there aren't, we don't need to
redrawVisiblePackets, but we do need to drawCurrentPacket to ensure
the packet details are redissected.

Fix #12519
2023-02-17 20:49:11 -05:00
John Thacker a49c022773 Qt: Fix scrollbar vanishing when adding columns
Don't call resize in applyRecentColumnWidths(). It doesn't seem
to be necessary in Qt5 or Qt6 to stretch the packet list last column
when the main window is wider than the total columns, and it doesn't
seem to be necessary to get the horizontal scroll bar to appear if
the columns are wider than the window frame either.
(When adding and removing columns, resizing the main window, etc.,
the columns all behave as expected, including if the wide Info
column is removed).

Resizing the packet list makes the scrollbar (and minimap) disappear.
It reappears when selecting another packet, but since it's not
necessary to resize, don't.

Fix #13597
2023-02-15 13:22:42 +00:00
Gerald Combs 877498ad0b [Automatic update for 2023-02-12]
Update manuf, services enterprise numbers, translations, and other items.
2023-02-12 16:46:06 +00:00
John Thacker 994669e5b3 UAT: Have a combobox for Dissectors
Add a drop-down combobox for UATs, including User DLTs, that
have a choice of dissectors. Make the combobox editable, which
will provide suggestions, and pass things through to the existing
UAT validation for dissectors. (It's a very long list, especially
with 1717 entries, including 530 just from various BT GATT UUIDs,
so being able to still type it in seems useful.)

Dissectors are not protocols. Rename the UAT field from PROTO to
DISSECTOR where used. Update the column names and long descriptions
to use dissector instead of protocol in dissectors that used this.
There may at some point be UATs that want protocols instead of
dissectors, but that's not what the current behavior does and
none of the current dissectors that use the existing types want.

Update the documentation to use "dissector" instead of "protocol."
Put the names of the actual current three Ethernet dissectors.
Clarify that the "ip" dissector actually tries IPv4 and IPv6,
instead of just IPv4.

UAT entries are backwards and forwards compatible with versions
without this change.

Fix #18836.
2023-02-11 16:40:13 +00:00
João Valverde 7fd4e2e542 Move ui/filter_files.[ch] to wsutil 2023-02-10 20:59:22 +00:00
João Valverde cf8107eb2a Move ui/clopts_common.[ch] to wsutil 2023-02-10 20:59:22 +00:00
João Valverde 0cea64a632 Move ui/cmdarg_err.[ch] to wsutil 2023-02-10 20:59:22 +00:00
John Thacker 4221021ab6 Qt: Fix click to packet on OverlayScrollBar
Fix the calculation of the ratio for converting a packet number
to the scrollbar value by accounting for the length of the slider.
maximum() does not correpond to the last packet; it corresponds to
the first packet shown when the scrollbar is at maximum. The last
packet is maximum() + pageStep().
(See https://doc.qt.io/qt-6/qscrollbar.html#details)

The quarter of a page padding should be subtracted, not added,
from the calculated position.
(Fix up 422c0f45d4)

This correctly makes clicking on the a line in the minimap scroll
the packet list so that the corresponding packet is 25% of the
way down the visible window. (Excepting the cases of packets at
the very beginning or end of the entire packet list.)

Fix #13989
2023-02-10 01:56:20 +00:00
Moshe Kaplan 9e1905f88d Preferences: Support configuring debounce timers 2023-02-09 20:54:14 +00:00
John Thacker 66fc2d4ee3 Qt: Actually ensure that rows are colorized
PacketListRecords should only report themselves as colorized when
colorized with the latest version of the coloring rules. Otherwise,
ensureRowColorized will not recolorize rows when the rules have changed.

This makes the minimap/intelligent scrollbar correctly update
colors in the background when the rules have changed. (Rows that
were being displayed were being updated, because the columnStrings
were invalidated at the same time, and when fetching the columnStrings
the colors would be updated if the rules had changed.)

Fix #17621
2023-02-09 15:27:58 +00:00
John Thacker 4f14745fce Qt: Fencepost error in minimap/intelligent scrollbar
The location of the next line should be based off one row larger
than the current row.

This fixes an issue where all the lines drawn in the intelligent
scrollbar are off by one - the color intended to be drawn for
the first packet never appears, the first packet corresponds to
the line for the second packet, etc., and there is a line at
the bottom that can never be colored in.

Fix #18850
2023-02-08 14:47:32 +00:00
João Valverde 84f963dfa2 Move ui/version_info.[ch] to wsutil 2023-02-07 23:17:37 +00:00
João Valverde c62aa67d2c Move ui/exit_codes.h to include/ 2023-02-07 10:12:08 +00:00
John Thacker fd183cb40b Qt: Add ability to cancel sorting
Add the ability to cancel sorting. Since we now parse user inputs
during the sort, test and set the capture file read lock. Try to
sort in PacketList::captureFileReadFinished, since now sorting during
thawing won't happen if it's in the middle of a rescan.

Fix #17640
2023-02-07 00:03:24 +00:00
João Valverde 7c156d9ac4 Add a #define HAVE_MSYSTEM and use it
In certain situations using __MINGW64__ is not correct.
We want to have the condition apply using MinGW-w64 but also
using MSYS2, which the __MINGW64__ condition alone does not
capture.

Add a HAVE_MSYSTEM C define and use it where appropriate.
2023-02-06 19:39:33 +00:00
João Valverde d9353d1684 Fix MSYS2 build
Fix:

```
FAILED: run/extcap/randpktdump.exe
cmd.exe /C "cd . && D:\a\_temp\msys64\ucrt64\bin\gcc.exe -fvisibility=hidden  -Wall -Wextra -Wpointer-arith -Wformat-security -fno-strict-overflow -fexcess-precision=fast -Wvla -Wattributes -Wpragmas -Wredundant-decls -Wunreachable-code -Wlogical-op -Wno-error=stringop-overflow= -Wno-error=deprecated-declarations -Wframe-larger-than=32768 -Wno-format-truncation -fdiagnostics-color=always -Wshadow -Wold-style-definition -Wstrict-prototypes -Wno-pointer-sign -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fmacro-prefix-map=D:/a/wireshark/wireshark/build/src/wireshark/= -fmacro-prefix-map=D:/a/wireshark/wireshark/build/src/build-UCRT64/= -O3 -DNDEBUG -pipe     -Wl,--as-needed  -municode CMakeFiles/cli_main.dir/cli_main.c.obj extcap/CMakeFiles/extcap-base.dir/extcap-base.c.obj extcap/CMakeFiles/randpktdump.dir/randpktdump.c.obj extcap/CMakeFiles/randpktdump.dir/__/resources/randpktdump.rc.obj -o run\extcap\randpktdump.exe -Wl,--out-implib,run\librandpktdump.dll.a -Wl,--major-image-version,0,--minor-image-version,0  run/librandpkt_core.a  run/libwiretap.dll.a  -lws2_32  run/libui.a  run/libwsutil.dll.a  D:/a/_temp/msys64/ucrt64/lib/libglib-2.0.dll.a  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
D:/a/_temp/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: run/libui.a(failure_message.c.obj):failure_messag:(.text+0x129): undefined reference to `__imp_wtap_strerror'
```

After this change:

```
[2177/2600] Linking C executable run/dumpcap
Warning: Unused direct dependencies:
	/usr/lib/libnl-route-3.so.200
	/home/jpv/code/wireshark/devel/build/run/libwiretap.so.0
```
2023-02-06 19:35:43 +00:00
j.novak@netsystem.cz 0c0f731c92 extcap: Fix of handling default values 2023-02-06 18:29:25 +00:00
João Valverde 02238edf92 Do not require using wsgcrypt.h
The reason to use wsgcrypt.h was to wrap it around DIAG_OFF()
macros and that should no longer be necessary.
2023-02-06 15:52:10 +00:00
João Valverde 71cfbd81b3 Remove wspcap.h and use config.h instead
Forcing the use of a dedicated header to replace pcap.h is
unnecessary code and mental overhead in this case. We can
use config.h instead for the same purpose of defining a
macro symbol before including pcap.h.
2023-02-06 15:05:36 +00:00
João Valverde b07ab25a1c CMake: Cleanup unnecessary linking with shared libraries 2023-02-06 15:04:46 +00:00
Gerald Combs 754ec536e5 [Automatic update for 2023-02-05]
Update manuf, services enterprise numbers, translations, and other items.
2023-02-05 16:47:29 +00:00
John Thacker 4bb43d5986 RTP Stream Dialog: Actually sort on packet loss
The packet loss column has been sorting on a private variable
that is never set(?!) and also is unsigned whereas the actual
lost number is signed. Get the calculated packet loss number
and sort by that. (Should this be sorting by the total number or
the percentage, since the column displays both? Total number is
first so let's use that.)

This should probably be some kind of Model/View instead.

Fix #16785.
2023-02-04 22:15:25 -05:00
John Thacker 15dfa3aa20 Qt: Fix order of ShowAs enums
The ShowAs enum should stay in the same order as the Items
are added to the ShowAs combobox, because setCurrentIndex()
is used with the enum values, e.g. when setting the value to
"Show As Image" when the bytes are an image.
Fixup c9e08b7be3
2023-02-01 21:18:58 -05:00
Gerald Combs 9d9d72f47b Qt: Fix Logray compilation with Qt 6.4
Copy+paste afa2579124 to fix

wireshark/ui/logray/logray_main_window_slots.cpp:1564:40: error: attempt to use a deleted function
            stats_tree_action->setData(cfg->abbr);
                                       ^
Qt/6.4.2/macos/lib/QtCore.framework/Headers/qvariant.h:199:5: note: 'QVariant<char *, false>' has been explicitly marked deleted here
    QVariant(T) = delete;
    ^
2023-01-31 14:03:04 -08:00
Gerald Combs 620dc806db [Automatic update for 2023-01-29]
Update manuf, services enterprise numbers, translations, and other items.

services failed.
2023-01-29 18:53:10 +00:00