Commit Graph

7579 Commits

Author SHA1 Message Date
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
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
Roland Knall ea60fdcb31 TrafficTree: Fix wrong element choosen in context menu
The context menu falsely assigns the proxied index to the context menu
entries, therefore always selecting the wrong model index for the
resulting functions.

Fixes #18xxx
2022-10-30 10:07:13 +00:00
Gerald Combs 0ae3315f53 Qt: Make sure our font setting is backward compatible.
Qt5's QFont::fromString() isn't compatible with Qt6's QFont::toString().
If we were built with Qt5, don't try to process a font preference that
was created by Qt6.

Fixes #18553
2022-10-27 10:46:06 -07:00