Commit Graph

506 Commits

Author SHA1 Message Date
Moshe Kaplan 9e1905f88d Preferences: Support configuring debounce timers 2023-02-09 20:54:14 +00: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
Chuck Craft 1d6cf2f513 prefs: report load error in gui popup
ws_warning logs to console which most users will never see.
https://ask.wireshark.org/question/30035/new-computer-setup-custom-columns/
2022-12-29 04:02:15 +00:00
Eugène Adell 6759377b93 TCP: Overriding of the automatic SEQ Analysis 2022-11-01 10:01:35 +00:00
João Valverde 16fad42ae4 wslog: rename console open preference enum 2022-10-11 18:11:35 +01:00
João Valverde f2fd5ab201 wslog: Fix console_open registry key name
Fix "OpenConsole" registry key to "ConsoleOpen".

Add a common macro for the key name.
2022-10-11 18:10:35 +01:00
João Valverde a19834b98c Windows: Store "gui.console_open" in the Windows registry
This removes the last dependency of the logging subsystem on the
preferences module. The latter is started much later than the former
and this is an issue.

The Windows-only preference "gui.console_open" is stored in the
registry as HKEY_LOCAL_USER\Software\Wireshark\ConsoleOpen. The semantics
are exactly the same. The preference is read by the logging subsystem
for initialization and then again by the preferences (read/write) so
the user can configure it as before.

The code to store the preference also in the preferences file was
kept, for backward compatibility and because it is not incompatible
with using the Registry concurrently.

The elimination of the prefs dependency also allows moving the Windows
console logic to wsutil and add the functionality to wslog directly,
thereby eliminating the superfluous Wireshark/Logray custom log handler.

To be able to read the ws_log_console_open global variable from
libwireshark it becomes necessary to add a new export macro
symbol called WSUTIL_EXPORT.
2022-10-11 14:25:04 +01:00
Michael Tuexen 9cea2c26a1 TCP: Use RFC 6994 for experimental options
Modernize the handling of experimental TCP options based on
RFC 6994. In particular use ExID instead of magic (which
in the context of RFC 6994 are the last two bytes of a
32-bit ExID) and add a desciption of ExID based on the
current state of the IANA registry.
2022-08-17 21:33:31 +00:00
John Thacker 203cd2cba9 prefs: More cleanup, auto prefs
Remove callback function from pref registrations for dissectors that
don't need a callback. In other dissectors, move registration that
only needs to be done once inside the check for initialization,
avoiding some console messages when preferences are changed
("Duplicate dissectors (anonymous) and (anonymous) for protocol...")
and the like.

Add a couple auto preferences for dissectors missed in previous waves.

Ping #14319
2022-08-09 06:21:05 +00:00
John Thacker 2347345eec prefs: More port prefs to auto prefs with ranges
Move the rest of the SCTP port preferences to auto prefs
with ranges. Ping #14319.
2022-08-06 18:51:07 -04:00
John Thacker 057436ff81 Prefs: Convert some SCTP port preferences to auto prefs
Convert SCTP port preferences in dissectors starting m-z.
Preferences that were already the name of the table can just
be removed from the dissector and they will migrate. Preferences
with a different name are added to deprecated_port_prefs in
epan/prefs.c (Since that function handles them there is no
need to mark them as obsolete.)

Also change a few TCP and UDP single ports reigstered with
preferences and callbacks that used the sample dissector as
a template.

Uses more auto preferences, makes more port preferences ranges,
and reduces the number of preference callbacks. Ping #14319
2022-08-06 00:17:14 -04:00
John Thacker 452b5e3e0f prefs: Remove prefs_register_decode_as_preference
All Decode As auto preferences are registered as ranges now,
so remove this internal function. Ping #14319.
2022-08-04 07:16:16 -04:00
John Thacker 5c15ebb9a2 prefs: Convert most RTP dissectors to use "auto" PT preferences
Similar to commit 2eb7b05b8c,
replace the RTP payload type preferences with automatic
dissectors.

This reduces the number of preference module callbacks.
2022-07-31 07:37:11 +00:00
John Thacker a2c5ae9a8b prefs: Fix deprecated_port_pref migration
prefs_find_module() looks up a module by module name, which is
the same as the protocol filter name, case-insensitively.
dissector_table_get_dissector_handle() looks up a dissector handle
in the table by the protocol short name (which is the module _title_)
deprecated_port_pref() used the same string for both lookups.

For some protocols this worked, because the short name is the same
as the filter name only with different capitalization. For others,
it either wouldn't find the module to add to the migrated preference,
or wouldn't find the dissector handle in order to set Decode As
properly.

Fix this, by using the module title for the second lookup, and
changing all the module_name values to be correct. For good
measure, change all the module names that happened to work because
they're differently-cased versions of the filter name in order
to avoid confusion when new entries are added.
2022-07-29 21:16:56 -04:00
John Thacker 7a6ff3e5fe prefs: Remove custom column expression limit
Custom column expressions do not need to be limited to COL_MAX_LEN.
The size of the expression does not have any necessary relationship
to the size of the column contents, especially in the common case of
many semantically equivalent different fields from different protocols,
only one of which appears in any given frame.

The only place that actually does limit the length of custom
custom expressions is in reading the preferences. Use a GString
instead of allocating a buffer to COL_MAX_LEN when constructing
the string. In normal cases, this should decrease temporary
memory usage. Fix #16905
2022-07-07 12:52:19 +00:00
Gerald Combs efe8dc051c Prefs: Change the default UI layout to type "2".
Make the default UI layout "packet list on top, packet detail and bytes
side by side". This is more space efficient on modern displays and is
the first thing I change when using the default profile.
2022-06-18 12:36:18 +00:00
Roland Knall 9d11321385 Qt: Disable Sorting for the packet List
Allows the sorting to be disabled to avoid painful recalculations if the
sorting has been clicked on by accident.

Fixes #16786
2022-03-17 16:52:53 +01:00
Roland Knall 835d5b3f97 Qt: Allow byteview to be hidden
Implements: #17887
2022-02-07 12:48:18 +00:00
j.novak@netsystem.cz 6c9cb8f3fa Prefs/Extcap: Added support for password which is never stored on the disk 2021-12-30 16:03:15 +00:00
João Valverde c5a19582e4 epan: Convert to use stdio.h from GLib
Replace:
    g_snprintf() -> snprintf()
    g_vsnprintf() -> vsnprintf()
    g_strdup_printf() -> ws_strdup_printf()
    g_strdup_vprintf() -> ws_strdup_vprintf()

This is more portable, user-friendly and faster on platforms
where GLib does not like the native I/O.

Adjust the format string to use macros from intypes.h.
2021-12-19 19:29:53 +00:00
João Valverde 53cded5062 wslog: Add backward compatibility with 'console.log.level'
This adds some custom logic to check if we were given
the obsolete 'console.log.level' setting from the CLI
arguments, that specified the log level using a bitmask
copied from GLib. If we find that map the bitmask to a
wslog log level.

In any case the option is not removed from the argv (unlike
other wslog arguments like --log-level, etc.).

Adds deprecation warning for 'console.log.level' printed to
the console.

Related to #17763.
2021-12-11 00:19:09 +00:00
João Valverde 1fc621e38d epan: Fix crash with upper-case protocol filter names
Registering a preference module for a protocol filter name with
upper case letters aborts the program. Relax this restriction to
conform with the rules for protocols. The recommendation is still
to use all lower-case letters.

Fixes 070aeddf76.
2021-11-04 16:29:34 +00:00
Developer Alexander 7866f43d82 IO Graph: Add checkbox to prevent automatic rescans
Adds a checkbox 'Automatic Update' to the IO Graph to enable or disable
rescans and recalculation of graph data temporarily. This is useful when
you want to modify settings of multiple graphs without triggering a rescan
with every change of a single setting. This becomes useful for large trace
files in particular.

Rescan or recalculation events are queued while 'Automatic Update' is not
active. Checking 'Automatic Update' triggers the queued updates.

The setting for 'Automatic Update' is stored in a preference.

A german translation for 'Automatic Update' is included.
2021-09-21 12:58:55 +00:00
João Valverde 133b0c583f Move epan/wmem/wmem_scopes.h to epan/
This header was installed incorrectly to epan/wmem_scopes.h.

Instead of creating additional installation rules for a single
header in a subfolder (kept for backward compatibility) just
rename the standard "epan/wmem/wmem.h" include to
"epan/wmem_scopes.h" and fix the documentation.

Now the header is installed *correctly* to epan/wmem_scopes.h.
2021-07-26 14:56:11 +00:00
João Valverde 0e50979b3f Replace g_assert() with ws_assert() 2021-06-19 01:23:31 +00:00
Uli Heilmeier d195847bb1 Prefs: Mark gui.packet_editor.enabled obsoleted
Preference has been removed with fca78f9f1f
without obsoleting it.
2021-06-18 20:11:31 +00:00
Uli Heilmeier fca78f9f1f Prefs: Remove packet_editor option
Since QT UI we have had no more packet editor feature. Therefore we can also
drop the preference to enable it.
2021-06-17 14:47:47 +00:00
João Valverde 39df3ae3c0 Replace g_log() calls with ws_log() 2021-06-16 12:50:27 +00:00
João Valverde dc7f0b88bb Refactor our logging and extend the wslog API
Experience has shown that:

  1. The current logging methods are not very reliable or practical.
A logging bitmask makes little sense as the user-facing interface (who
would want debug but not crtical messages for example?); it's
computer-friendly and user-unfriendly. More importantly the console
log level preference is initialized too late in the startup process
to be used for the logging subsystem and that fact raises a number
of annoying and hard-to-fix usability issues.

  2. Coding around G_MESSAGES_DEBUG to comply with our log level mask
and not clobber the user's settings or not create unexpected log misses
is unworkable and generally follows the principle of most surprise.
The fact that G_MESSAGES_DEBUG="all" can leak to other programs using
GLib is also annoying.

  3. The non-structured GLib logging API is very opinionated and lacks
configurability beyond replacing the log handler.

  4. Windows GUI has some special code to attach to a console,
but it would be nice to abstract away the rest under a single
interface.

  5. Using this logger seems to be noticeably faster.

Deprecate the console log level preference and extend our API to
implement a log handler in wsutil/wslog.h to provide easy-to-use,
flexible and dependable logging during all execution phases.

Log levels have a hierarchy, from most verbose to least verbose
(debug to error). When a given level is set everything above that
is also enabled.

The log level can be set with an environment variable or a command
line option (parsed as soon as possible but still later than the
environment). The default log level is "message".

Dissector logging is not included because it is not clear what log
domain they should use. An explosion to thousands of domains is
not desirable and putting everything in a single domain is probably
too coarse and noisy. For now I think it makes sense to let them do
their own thing using g_log_default_handler() and continue using the
G_MESSAGES_DEBUG mechanism with specific domains for each individual
dissector.

In the future a mechanism may be added to selectively enable these
domains at runtime while trying to avoid the problems introduced
by G_MESSAGES_DEBUG.
2021-06-11 09:40:28 +00:00
John Thacker 4371474cc3 ip: Reassemble across VLANs for publicly routable IPv4 addresses
Default to taking the VLAN ID into account when reassembling only
for private IPv4 addresses as defined by RFC 1918 and for link-local
addresses. Otherwise, do not take the VLAN ID into account unless
the "Enable stricter conversation tracking heuristics" preference
is enabled. Fixes #14356.
2021-05-25 20:09:25 -04:00
John Thacker 21a204643e prefs: Allow empty strings specified from the command line
prefs_set_pref should allow the value of a preference argument set with
'-o pref:value' to be an empty string. Some of the types, like string
and range preferences, can and should be set to empty strings in some
cases. For types that wish to reject empty strings as a syntax error,
that can happen later in set_pref based on type, as already done for
PREF_UINT. Fixes #17199
2021-05-25 11:41:54 +00:00
Jirka Novak c1084fe97e RTP Player: Settings for enabling use of disk as temporarly store
New advanced settings are created:
- rtp_player_use_disk1 - controls if decoded samples are stored in
  memory or on disk.
- rtp_player_use_disk2 - controls if dictionary for decoded samples
is stored in memory or on disk.
- documentation updated
2021-04-26 10:57:22 +02:00
Jim Young d42042fcbb Qt: Add checkbox for enabling/disabling packet-list hover_style
At times the presence of the packet-list hover_style colorization can make
it difficult to determine the state of the packet directly under the mouse
cursor. This forces the user to move the mouse cursor away from the
packet-list row to reveal the next colorization state. The packet-list row
colorization style precedence, from highest to lowest, is: hover_style,
Selected, Ignored, Marked and then coloring rules.

This patch adds a new 'Packet List settings:' checkbox option 'Enable
mouse-over colorization'. By default the supporting preference
`gui.packet_list_hover_style.enabled` will be enabled (TRUE). When this
checkbox is disabled, the packet-list hover_style (mouse-over)
colorization will not be used.
2021-04-21 08:36:27 +00:00
Guy Harris be000686de prefs: use g_error() to report certan errors.
Other errors use g_error(); use it for these errors, so the message is
more meaningful.
2021-03-20 01:33:44 -07:00
João Valverde cff3a1c08d prefs: Don't clobber env variable G_MESSAGES_DEBUG
Avoid silently overwriting the user's configuration.

Ping #17271.
2021-03-06 12:40:20 +00:00
Gerald Combs c7f66cf934 TShark: Load extcap preferences only when needed.
In our first pass through our options, look for ones that might require
extcap. Call extcap_register_preferences() only when that's the case.

Warn about missing extcap preferences only when we've loaded them.
2021-02-11 13:36:22 +00:00
Jirka Novak cf9ffd3d83 All RTP dialogs: Added option to specify count of decimal places
Preferences are extended with advanced settings:
gui.decimal_places1 - 2
gui.decimal_places2 - 4
gui.decimal_places3 - 6

rtp_analysis_dialog, rtp_player_dialog and rtp_stream_dialog uses new settings
for formating numbers. Same information in all dialogs uses same settings.
It solves request #15481.

Note: Other UI dialogs can be adapted later.
2021-01-01 12:41:09 +00:00
Moshe Kaplan e16166a74c Detect and replace bad allocation patterns
Adds a pre-commit hook for detecting and replacing
occurrences of `g_malloc()` and `wmem_alloc()` with
`g_new()` and `wmem_new()`, to improve the
readability of Wireshark's code, and
occurrences of
`g_malloc(sizeof(struct myobj) * foo)`
with
`g_new(struct myobj, foo)`
to prevent integer overflows

Also fixes all existing occurrences across
the codebase.
2020-12-22 14:56:38 +00:00
Stig Bjørlykke 9cafd342ac Lua: Add get_preference() and set_preference() utility functions.
Support uint, bool, enum, string, range, filename and directory preferences.
Added apply_preferences() to write to file and apply changes.
2020-12-08 22:56:50 +00:00
John Thacker 524a28c4b1 QT/CLI: Move max tree items and depth to prefs
Move the maximum number of tree items and maximum tree depth to
preferences instead of hardcoded values. Refer to issue #12584 for
an example VNC capture where real data exceeds the current limit.
2020-10-23 04:18:36 +00:00
Martin Mathieson 218881dd13 Fix some spelling errors detected in epan/prefs.c
Ignored "st_sort_casesensitve", as it will not normally be seen by users,
and changing it would lose the previous setting (if set).
2020-09-01 20:43:42 +00:00
Gerald Combs 9b07412277 Qt: Add a packet diagram view.
Add a new top-level view that shows each packet as a series of diagrams
similar to what you'd find in a networking textook or an RFC.

Add proto_item_set_bits_offset_len so that we can display some diagram
fields correctly.

Bugs / to do:
  - Make this a separate dialog instead of a main window view?
  - Handle bitfields / flags

Change-Id: Iba4897a5bf1dcd73929dde6210d5483cf07f54df
Reviewed-on: https://code.wireshark.org/review/37497
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-10 18:17:50 +00:00
Guy Harris bab7b8d638 prefs: plug a memory leak.
Don't allocate the cols_hidden GString until we know we need it.

Change-Id: I02966d2820efeb5d61d259a567bf9063d8b519f1
Ping-Bug: 16335
Reviewed-on: https://code.wireshark.org/review/37043
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-03 00:06:57 +00:00
Peter Wu ef717da61a CMake: remove ENABLE_PCAP_NG_DEFAULT option
pcapng has been the compile-time default since 2011. If there are any
users who would like to use the libpcap format, then they should use
runtime options instead (e.g. `tshark -P` or `editcap -F pcap`).

Change-Id: I54b70368cdc3ca78bc8617bc488cc687740a1eb9
Reviewed-on: https://code.wireshark.org/review/36721
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-06 01:29:37 +00:00
Guy Harris e1e8e2dce9 Clean up some comments in the preferences file.
Automatic software updates are now supported in macOS as well.

In the file, the channel name doesn't have UPDATE_CHANNEL_ in front of
it; it's just DEVELOPMENT or STABLE.

Change-Id: I11a8e10b3c0ee6c4eec2568bf94d42c4098b82a5
Reviewed-on: https://code.wireshark.org/review/36207
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-02-27 05:17:57 +00:00
Orgad Shaneh b6ce60afbb Prefs: Fix name of deprecated TPNCP port preference
Change-Id: I6a5d2ca72b59ee1a77ad37b6fe6b87c6ba9d9bef
Reviewed-on: https://code.wireshark.org/review/35805
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2020-01-14 13:52:03 +00:00
Roland Knall 936a844cc3 Qt: Fix PacketListHeader column
Due to changes in #35206, if you have a lot of columns the display
of all columns may be hindered depending on your screen resolution.

With this change, displaying the column information can be disabled
via a Preferences->Layout checkbox element. Additionaly, the column
information will always be displayed as a tooltip element

Bug: 16317
Change-Id: Ib8c0fc0a84deaca96631270b320f3a530ba87d89
Reviewed-on: https://code.wireshark.org/review/35706
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2020-01-09 12:32:34 +00:00
Orgad Shaneh e0bb1ddea7 TPNCP: Update from downstream
* Support little-endian systems
* Improve error reporting
* Implement some new features in the protocol

Change-Id: I73e07a588c4a028fd0c22e1570adb7957ba2d52f
Reviewed-on: https://code.wireshark.org/review/35467
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2020-01-09 11:25:22 +00:00
Huang Qiangxiong 623b347d1e Protobuf: add dissecting protobuf fields as wireshark fields preferences, etc.
Two enhancements and one fixed bug:

1. Add dissecting protobuf fields as wireshark (header) fields preferences. User
can input the full names of protobuf fields or messages in Filter toolbar for
searching.

2. Add 'protobuf_field' dissector table. Dissector based on protobuf can register
itself to 'protobuf_field' keyed with the full names of fields of BYETS or STRING
types.

3. A bug about search MESSAGE or ENUM type in context is fixed.

4. Another small enhancement is adding prefs_set_preference_effect_fields() which
can mark a preference that affects fields change (triggering FieldsChanged event).

See the linked bug for sample capture file and .proto files.

Ping-Bug: 16209
Change-Id: Ibc3c45a6d596a8bb983b0d847dd6a22801af7e04
Reviewed-on: https://code.wireshark.org/review/35111
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-12-19 05:04:17 +00:00
Uli Heilmeier 3361109b15 QT/CLI: Remove limit for object export files
Removes the limit to export more than 1000 files with the same name
when exporting objects.
For this a preference name gui.max_export_objects is used.

Bug: 16010
Change-Id: Iefc138ac2617491aad3b6ad5827c9058aed112c7
Reviewed-on: https://code.wireshark.org/review/34339
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-11-05 22:40:27 +00:00