Commit Graph

369 Commits

Author SHA1 Message Date
Chuck Craft 2aa40d4488 Qt: crash on negative row in Conversations 2022-12-14 18:10:58 +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
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
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
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
Eugène Adell 6759377b93 TCP: Overriding of the automatic SEQ Analysis 2022-11-01 10:01:35 +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
Roland Knall b4a738e069 Qt: Fix unexpected bytes suffix
Packets obviously have not a "bytes" suffix, therefore
it should be removed.

Fixes #18229
2022-10-30 16:37:11 +00:00
Gerald Combs b2b76c2bae Qt: Add geolocation columns back to the Endpoints dialog.
Add geolocation columns back to the Endpoints dialog. Fix our
geolocation column alignments as well.

Fixes #18320.
2022-10-19 17:03:49 +00:00
Eugène Adell 9a6d496e64 Conversations dialog : rename the B to A packets column 2022-10-08 13:36:14 +00:00
João Valverde afa2579124 Qt: Fix compilation with Qt 6.4
error: conversion function from 'gchar *' (aka 'char *') to 'QVariant' invokes a deleted function
            return entry->hostname;
                   ^~~~~~~~~~~~~~~
/usr/include/qt6/QtCore/qvariant.h:199:5: note: 'QVariant<char *, false>' has been explicitly marked deleted here
    QVariant(T) = delete;
    ^
2022-10-01 21:53:11 +01:00
Chuck Craft c4c38defa5 Qt: enabled/disabled protocols filtered list enable/disabled
Follow up to !8151
Calls to setData are wrapped with beginResetModel/endResetModel
so don't call emit dataChanged() (per Qt suggestion)

Fixes "As the loop is worked, the size of the parents shrinks
 with each item processed."
2022-09-30 22:46:16 -05:00
Jaap Keuter d8983b54ba Qt: plug resource leak in error path (CID-1504598) 2022-09-29 11:35:39 +00:00
Chuck Craft 5dfbc40b4b Qt: Analyze->Enabled Protocols search in enabled/disabled
Rearrange some of the code from ddb943bf so that searches in
`Only enabled protocols` or `Only disabled protocols` return
filtered results.
2022-09-29 11:14:17 +00:00
Chuck Craft 2a189d0a08 Qt: if regex not valid don't attempt search
Search is tried as user enter regex string. Regex will be
 invalid as they type it (starts with "\" or fat fingered "*")
 If Wireshark is run from command line, error line is generated
 for every attempted match in the search list.
 ** (wireshark:8344) 00:29:15.353028 [GUI WARNING] --
 QString::contains: invalid QRegularExpression object
2022-09-22 12:47:08 -05:00
Chuck Craft c199b747aa Revert "Qt: only half of enabled/disabled protocols list is processed"
This reverts commit 248955d614.

It speeds up the loop when type_ is EveryWhere (see: enum SearchType)
but a hang or crash for other combinations of type_ and protocolType_.
2022-09-20 11:07:13 -05:00
Chuck Craft 248955d614 Qt: only half of enabled/disabled protocols list is processed
In Only enabled/disabled protocols lists, the rowCount decreases
as item state is changed in the parent. An equlibrium point is
reached at halfway when rows processed == remaining size of list.
Grab a static rowcount before entering the loop.
2022-09-18 14:58:47 +00:00
Chuck Craft 246e753d69 Qt6: add toInt() to QVariant == Qt::Checked
A change in Qt6 "==" comparison for QVariant for not defined types.

Closes #18336
2022-09-14 20:49:54 +00:00
John Thacker cbb2213021 Qt: Fix memory leak in Decode As
The correct place to delete the dissector_info_t pointers added
to the editor is when destroyEditor is called. Override the
virtual function and delete the pointers for the colProtocol
index before calling the inherited function.

Fix #17127
2022-09-14 12:43:55 +00:00
Guy Harris c9342873e5 Clarify dissector description, protocol short name, and protocol ong name.
Rename dissector_handle_get_long_name() and
dissector_handle_get_short_name() to
dissector_handle_get_protocol_long_name() and
dissector_handle_get_protocol_short_name(), to clarify that they fetch
names for the protocol that the dissector dissects, not for the
dissector *itself*.  Leave a deprecated
dissector_handle_get_short_name() wrapper, and export
dissector_handle_get_protocol_long_name(), as it's now used in some
dissectors.

Change some calls to dissector_handle_get_description() back to
dissector_handle_get_protocol_short_name(), as they appear to be made in
order to display a *protocol* name.

Rename some methods, variables, enums, and table column names to reflect
cases where the dissector description is being used.
2022-09-13 00:47:24 -07:00
Guy Harris d4394de669 Give dissectors a descriptive string.
It defaults to the short name of the protocol dissected by the
descriptor, but it's now possible to register a dissector with an
explicit description.

This is mainly for use in the Decode As UI.  It handles the case where
the same protocol might have different "Decode As..."-specifiable
dissectors for different situations.
2022-09-12 21:05:14 +00:00
John Thacker 2c37027762 Qt: Fix resolved addresses dialog sorting, filtering, Ethernet groups
Qt6 removed QComboBox:currentIndexChanged(QString), which had
previously been deprecated in favor of the version with an int.
Switch to using the supported function, so that the comboboxes
work.

The models used for the resolved addresses require that the
source models be set first before setting other properties,
so do that so that filtering works.

For some reason the portTypeModel has to indicate that the
port number column is numeric in order for the ports to
numerically sort instead of lexicographically, so do that too.

Add the Ethernet addresses in their specific groups (Addresses,
Manufacturers, Well-Known Hosts) instead of adding them all
to the Well-Known hosts groups, so that that filtering works.

Fix #18087
2022-09-09 01:03:36 +00:00
Guy Harris 8195bdd340 Rename a bunch of things with "conversation".
A conversation in Wireshark might have two endpoints or might have no
endpoints; few if any have one endpoint.  Distinguish between
conversations and endpoints.
2022-08-25 20:02:20 -07:00
John Thacker 66e19f9622 Qt: Silence warning
In the case that this is being called with an address type that
is neither IPv4 or IPv6, make sure that the char array used
to construct the QString is null terminated so that there's no
warning about using addr uninitialized or a possible strlen running
off the end.
2022-08-24 00:36:12 +00:00
Guy Harris d9e662bc54 Rename some functions and types for endpoint tables.
The "conversation table" mechanism supports two types of tables, one for
the "Conversations" menu item under "Statistics" and one for the
"Endpoints" menu item under "Statistics".  The first of them shows
statistics for conversations at various layers of the networking stack;
the second of them shows statistics for endpoints at various layers of
the networking stack.

The latter is *not* a table of hosts; an endpoint might be a host,
identified by an address at some network level (MAC, IP, etc.), or it
might be a port on a host, identified by an address/port pair.

Some data types, function names, etc. use "host" or "hostlist" or other
terms that imply that an endpoint is a host; change them to speak of
endpoints rather than hosts, using names similar to the corresponding
functions for conversations.

Provide wrapper functions and typedefs for backwards source and binary
compatibility; mark them as deprecated in favor of the new names.

Clean up some comment errors found in the process.
2022-08-23 09:55:14 +00:00
John Thacker 00bfdf46a7 Qt: Fix export objects memory leak
The export object entries were never getting freed, creating a
pretty serious memory leak.

=1307558==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2237664 byte(s) in 46618 object(s) allocated from:
    #0 0x55ac70d80457 in malloc (/home/johnthacker/wireshark-clang/run/wireshark+0x1a4a457) (BuildId: ad576854e9259fb05a7d0aacbff6e3e1f8e41157)
    #1 0x7fe8ff2f4278 in g_malloc (/lib64/libglib-2.0.so.0+0x5a278) (BuildId: 8a4c270219135729dff508e4bb3cc03099af40e8)
    #2 0x7fe910912ff4 in tap_push_tapped_queue /home/johnthacker/wireshark/epan/tap.c:366:15
    #3 0x7fe910711548 in epan_dissect_run_with_taps /home/johnthacker/wireshark/epan/epan.c:640:2
    #4 0x55ac7263288d in retap_packet /home/johnthacker/wireshark/file.c:2241:5
    #5 0x55ac7263201c in process_specified_records /home/johnthacker/wireshark/file.c:2207:14
    #6 0x55ac726315fc in cf_retap_packets /home/johnthacker/wireshark/file.c:2292:11
    #7 0x55ac712aed41 in ExportObjectDialog::show() /home/johnthacker/wireshark/ui/qt/export_object_dialog.cpp:173:15
...
Indirect leak of 1700955 byte(s) in 139854 object(s) allocated from:
    #0 0x55ac70d80457 in malloc (/home/johnthacker/wireshark-clang/run/wireshark+0x1a4a457) (BuildId: ad576854e9259fb05a7d0aacbff6e3e1f8e41157)
    #1 0x7fe8ff2f4278 in g_malloc (/lib64/libglib-2.0.so.0+0x5a278) (BuildId: 8a4c270219135729dff508e4bb3cc03099af40e8)
...
SUMMARY: AddressSanitizer: 3961187 byte(s) leaked in 186587 allocation(s).
2022-08-22 03:45:20 +00:00
John Thacker c7a136a5c0 epan: Rearrange column includes
Move all the declarations of routines that are internal and
not for use by dissectors from column-utils.h column-info.h
Move the column max length defines into column-utils.h because
dissectors might need that

Since packet.h already includes column-utils.h, dissectors don't
need to include column-utils.h anymore.
Remove or downgrade a few other column header includes that are
unnecessary.
2022-08-13 19:37:28 +00:00
John Thacker b5cea67768 Qt: Expert Info: Return TAP_PACKET_REDRAW if any ei is added
Any time an expert info is added to the Expert Info tap, the
Expert Info GUI tap listener needs to set TAP_PACKET_REDRAW.

draw_tap_listeners(FALSE) is called from MainApplication::updateTaps()
on a timer (controlled by a preference, defaulting to 3 seconds),
and that clears the Expert Info tap's need_redraw flag. The larger
a capture and the more expert infos, the more likely that the timer
can trigger while epan_dissect_run_with_taps() is still generating
more EI entries, but has already generated EIs of all severities
that are present in the capture. This prevents the expertInfoTreeView
from being redrawn at the end when the captureEvent is finished
retapping the packets.

Fix #18232. Fix #16591.
2022-08-13 10:55:32 +00:00
Chuck Craft a6813db329 Qt: traffic tables - tcp/udp port name resolution
Allow conversation/endpoint tabs that include IP address and
port number to resolve either or both. Currently IP address
(network) resolution is required to resolve tcp/udp ports.
2022-08-08 09:10:10 +00:00
Chuck Craft 077547d033 dccp: allow port resolution in conversation table 2022-08-05 00:52:56 +00:00
Roland Knall 06cd84a6e9 Qt: Recommend 5.12 and enforce 5.10
In order to phase out older versions, we recommed 5.12 as a
minimum Qt version going forward. Although build support for
5.10 and 5.11 is not being removed at this point, it might
be for 4.x at a later time.
2022-07-13 21:26:46 +00:00
John Thacker 8ac995578c epan: Respect custom column resolved/unresolved status everywhere
Add a function to get the column text of the nth column, taking
into account whether the column is resolved or unresolved. Use
this function in the GUI, as well as in tshark, when writing
PSML, exporting dissection to PSML, etc., instead of accessing
col_data directly.

This removes the direct accesses of col_data from outside
column.c and column-utils.c

Fix #18168.
2022-07-12 00:22:11 +00:00
Roland Knall 4742e0cade Qt: Filter column information for traffic dialogs
This enables the traffic dialogs to filter data based on the
context menu entries. For instance, one can only show rows,
where the number of packets is not greater than 10
2022-07-08 16:21:32 -05:00
Roland Knall c054501335 Qt: Fix compile issue for 5.9
Use the legacy method for when a Qt version below 5.10 is being used,
due to the fact, that QLocale::formattedDataSize had not been introduced
before
2022-07-04 19:22:17 +00:00
John Thacker 42567a59bc Qt: Support setting columns as un/resolved via Edit Preferences
Make it so that "Edit->Preferences->Columns" can also set the
resolved/unresolved status of custom columns. Hide the checkbox
when the fields don't support it (including any non custom
columns.) Also make the checkbox entries in the column list model
not editable.

Fix #15394
2022-07-01 11:22:59 +00:00
John Thacker a40e5f715a Qt: Check custom column syntax in Preferences properly
Not all display filters are valid for custom columns (see #15990).
Use the validation function for custom columns instead of the
display filter validation when adding or editing a custom column
through Edit->Preferences, as the Edit Column in the packet list
header already does.

Revisit this if we ever do expand the list of possible custom
columns.
2022-06-30 20:31:19 -04:00
Roland Knall 413b383224 Qt: Reduce PacketListHeader complexity
Propagating the capture_file was required for a single
function as was the cast for the model. Both are not
needed, as the functionality can be either moved to
PacketListModel or was already included in PacketList
2022-06-29 14:47:05 +02:00
Roland Knall 5fb2324692 Qt: Improve sort for packet list 2022-06-29 12:42:22 +02:00
Roland Knall 006d20db9e Qt: Only sort if there are actually lines to sort
Remove the sort for physical rows, if there are no rows to sort

Ping #18159
2022-06-26 15:59:41 +00:00
João Valverde 0dbd0a6903 Qt: Fix endianness for an IPv4 value
ws_in4_addr is in network byte order (big endian) so convert from
BE to host byte order, not the other way around.
2022-06-24 20:26:38 +00:00
Roland Knall 2e5b09f486 Qt: Fix compiler warning on macOS 2022-06-22 17:52:15 +02:00
Roland Knall 1424e28c7d Qt: Fix stream id display in context menu
It was displayed for every protocol, but should only be displayed
for TCP and UDP alone
2022-06-22 15:48:51 +02:00
Roland Knall 847795d381 Qt: Add stream number to conversations
Adding the stream id to UDP/TCP conversations and allowing
filtering on those values as well.

Fixes: #14184
2022-06-21 10:01:18 +02:00
Roland Knall e046877ad1 Qt: Fix column hiding for traffic model
Instead of letting the model do the filtering and having
a bunch of exceptions in cases where columns are hidden
in between other columns, the model will present all columns
all the time, and it is the job of a top-level proxy to
filter out columns not required for current display
2022-06-20 10:21:37 +02:00
Roland Knall f75f577579 Qt: Fix TrafficTree typo
And also fix some prototypes
2022-06-19 11:21:53 +02:00
Gerald Combs 79310ebbd2 Qt: Remove our idle dissection wait period.
Set our idle dissection single-shot timer to 0, i.e. whenever the Qt
event loop can fit us in. This fixes a performance issue here with
libsinsp and doesn't appear to cause any issues otherwise.
2022-06-17 10:18:19 -07:00
John Thacker 2efe338b2e Qt: Use a combobox for Decode As selectors if there are packet values
Don't require there to be at least two values in a packet for
a dissector table in order to have a combobox instead of a single
text box.

While perhaps having an editable combobox with only one drop down
option looks a bit funny, that is outweighed by the UI advantages
of being able to easily select the values that occur in the packet.

This makes it possible to change the dissector for the currently
selected packet's IP protocol or Ethertype when those are not the
last protocol layer without having to type it in manually, for
example.
2022-06-16 03:15:08 +00:00
Roland Knall 1272b62106 Docs: Update documentation for redesigned Traffic Tabs
Update the documentation to document the change of features
that happen during the redesign of the UI as well as fix some
wordings in the data model.
2022-06-14 21:33:26 +00:00