Commit Graph

538 Commits

Author SHA1 Message Date
John Thacker 4fcb4b5364 Remove PREF_DECODE_AS_UINT
PREF_DECODE_AS_UINT has been unused since all auto port preferences
were made ranges by  8604d03a98

Remove it.

Ping #14319
2024-02-27 08:47:03 +00:00
Martin Mathieson e0300eaed8 Fix lots of spellings 2024-02-25 22:46:47 +00:00
John Thacker c0288ca829 Qt: Only set Packet List style sheet when relevant prefs change
Add a colorsChanged signal/slot, more precise than the generic
preferencesChanged signal, and only call it when one of the
color related preferences have changed. Connect it to the
packetList::colorsChanged() function, instead of calling that
whenever preferencesChanged() is called. We could eventually
move the signals and slots some of the other GUI widgets to this.

Send that signal before handling preferences that change
dissection and freeze the packet list, so that when we
restore the column widths due to Qt bug 122109 it takes effect.

The packet_list_hover_style preference affects colors, not
the layout, despite its presence in the GUI layout module.
2024-02-24 11:59:05 -05:00
John Thacker e5e0797bd5 Qt: If no preferences have changed, don't signal
Enforce the requirement, already mentioned in the headers,
that preference and preference module effect flags must be
nonzero so that the application knows that a preference has changed.
(Lua, for example, needs this.)

Use this and avoid sending the PreferencesChanged signal when
preferences have not changed.
2024-02-24 08:37:08 -05:00
John Thacker a65cce3c70 extcap: Use extcap.cfg as extcap config file name
"extcap" by itself can be the name of a directory that stores
extcap programs, especially if the default profile is being
used. Add an extension to the default file name so it doesn't clash.

Follow up to 4fb2ef8af8
2024-02-23 08:18:20 +00:00
John Thacker 4300f713b1 prefs: Always write main prefs file
If writing a separate extcap preferences file fails, always write the
main preference file.

If there's a directory of the same name as a module, silently ignore it.

Followup to !14436
2024-02-20 10:34:02 -05:00
John Thacker 9a67fac86f prefs: Backwards and forwards compability for hiding columns
Continue to write the format-based hidden preference for now.
Read both preferences; if the index-based preference is read, use it.
If not, fall back to the format-based preference.

Followup to 41930060b0
2024-02-19 21:07:44 +00:00
John Thacker 4fb2ef8af8 extcap: Really don't load extcap interfaces if disabled
If the capture.no_extcap preference is set, really don't load the
extcap interfaces. Previously, the extcap interfaces were loaded
before the preference was read, because otherwise the extcap
preferences wouldn't be registered and properly read out of the
configuration file.

Wait until after that preference is read to register the
extcap preferences and then re-read just the extcap module
preferences from the configuration files. Make sure to check
other times when the preference may be changed, such as
switching profiles.

Write extcap prefs to a separate file so that they don't get lost
if the extcap interfaces aren't loaded and the prefs are then
written out. Continue writing them to the main file for backwards
compability.

Related to #15295. Cuts ~100 ms off the loading time of Wireshark
in a normal situation if the capture.no_extcap preference is set,
more if an extcap has some kind of issue that makes it take a long
time to load.
2024-02-18 20:23:39 +00:00
John Thacker 99df5f588b prefs: Read the old hidden column preference
Read the old obsolete hidden column preference and apply it.
This will convert it to the new value (and remove it) if preferences
are saved.

Follow up to 41930060b0
2024-02-14 19:27:42 -05:00
John Thacker 41930060b0 prefs: Use column index, not format, for hidden state
Obsolete the existing column hidden preference, and use the
column index instead of the format for remembering the hidden
state.

Fix #15529
2024-02-11 09:47:58 +00:00
Jan Wiesemann 9b36918071 Qt: added preference for hiding 'Welcom page' -> 'Open'
This commit adds a additional preference to hide the 'Open' (recently opened
files) section on the welcome page.
2024-02-08 07:36:49 +00:00
Gerald Combs 05ee426d93 Logray: Make the Syscalls profile the default 2024-01-29 19:37:00 +00:00
Stig Bjørlykke e60046305f Qt: Add capture comment to custom title
Add custom title option %C to show the first capture comment from
command line argument.

Ping: #19296
2024-01-02 07:38:41 +00:00
John Thacker 2792c89909 Add "Use monitor mode on all 802.11 devices if possible"
Similar to the -I option, but as a pref (defaulting to false,
which is current behavior) that sets the default for 802.11
devices to use monitor mode. (Note this depends on
commit c25e0f9084 being merged
to work properly.)

Also add the checkbox in capture options, only enabled if at
least one device supports monitor mode, that enables and disables
monitor mode on all devices that support it when toggled.

Fix #11011
2023-11-30 04:20:33 +00:00
John Thacker ed91d8ae37 Qt: Add side-by-side layout preference option for Packet Dialog
Like the option to show the bytes, this isn't in a preference
dialog (other than Advanced preferences) because it's easiest to
change it from a Packet Dialog itself.

Fix #18731
2023-11-26 18:37:44 +00:00
Stig Bjørlykke 2f1392169a prefs: Add prefs_register_dissector_preference()
Use this preference to get color code validation and autocompletion
for string preferences used for configuring a dissector name.
2023-11-26 11:17:06 +01:00
Peter Wu df2e0b7d61 Qt: add command line options support in the TLS Keylog Launcher
Add support for command line parameters, rename the preference to match.
Use the correct `SSLKEYLOGFILE` environment variable name in the text.
Rename SSL to TLS, we are no longer in 1999. Clarify that applications
other than browsers can be selected. Various dialog text improvements.
Move the Launch button to the right to make it stand out more.

Relates to #19471
2023-11-12 12:48:08 +01:00
John Thacker 1484169815 prefs: GUI preferences don't affect dissection
The GUI preferences don't affect dissection in general and shouldn't
require a costly redissection.

We used to have a PREF_EFFECT_GUI, but it seems that nothing needed
to check it because any changes were noticed in other ways, so it
was removed. (d95213afb0) Bring it
back, because the Lua set_preference assumes that *some* effect
flag is returned when a preference is changed.

We have to set this separately for each submodule too, because
the effect flags are reset to PREF_EFFECT_DISSECTION regardless
of the parent module. The changes to columns, fonts, and colors
are also handled separately without special effect flags; the
layout submodule does have its own effect flag.

Fix #17629
2023-10-31 21:29:11 +00:00
John Thacker 2adc59ff92 Prefs: Fix TCP sequence analysis override pref handling
When a preference dialog is used, we don't want to write to each
frame data the value of the TCP sequence analysis override preference
immediately, because that means that the changes take effect even
if the dialog is Rejected. The redissection isn't triggered, but that's
worse in some ways, because it puts things in an inconsistent state.

Instead, stash the list of frame datas to possibly override in the
pref, and then override them when unstashing preferences. Delete
the least when cleaning the preferences. (Storing the pointers should be
fine, because the preference dialogs are modal.)

This also allows us to correctly have the TCP sequence analysis
override preference report whether or not any frame data's
override value was changed, and avoids doing a full redissection
any time the preference dialog is opened, even if nothing is changed.

The TCP sequence analysis override preference doesn't need to
be written to a file or read from the file or command line, because
it's different for every frame, and reset to default (0) for each
new frame when a file is read.

Related to #17629
2023-10-31 01:49:57 +00:00
João Valverde e5c198a2e5 Qt: Add Browser SSL keylog dialog
Adds a new menu under Tools to launch a browser with the
SSLKEYLOGFILE environment variable set.

Adds a new GUI preference to store the browser path specific
to the SSL Keylog dialog (which may be different from the user's
preferred system browser).
2023-08-23 09:22:40 +00:00
John Thacker 95c299a065 Move autoscroll preference behavior to recent
Make whether or not we are autoscrolling a "recent" item.

Make the selection of automatically scrolling in the Capture
Options tab actually have an effect (right now it does nothing.)

Switching to a recent also means that the command line "-l" option
actually turns on automatic scrolling if the recent value is off
(currently it has no effect because it is always later overridden
by the preference value).

Document our behavior that autoscrolling, if turned on, temporarily
turns off when manually scrolling upwards or Go'ing directly to
a packet (so that a user can examine a chosen packet.) This temporary
effect does not change the "recent" status, which changes only when
the user directly turns the behavior on or off (through the capture
window, the button or menu item, or the -l command line option.)
2023-08-18 10:49:03 +00:00
John Thacker 1b82eda9eb epan: Register dynamic column fields and make them filterable
Make the text of each registered column a FT_STRING field that can be
filtered, prefixed with _ws.col - these work in display filters, filters
in taps, coloring rules, Wireshark read filters, and in the -Y, -R, -e,
and -j options to tshark. Use them as the default "Apply as Filter" value
for the columns that aren't handled by anything else currently.

Because only the columns formats that actually correspond to columns
get filled in (invisible columns work), register and deregister the
fields when the columns change.

Use the lower case version of the rest of the COL_* define for each
column as the field name.

This adds a number of conditions to "when are the columns needed",
including when the main display filter or any filter on a tap is
using one of these fields.

Custom columns are currently not implemented. For custom columns, the
tree then has to be further primed with any fields used by the custom
columns as well. (Perhaps that should happen in epan_dissect_run() -
are there any cases where we construct the columns and don't want to
prime with any field that custom columns contains? Possibly in taps
that we know only use build in columns.)

Thus, for performance reasons, you're better off matching an ordinary
field if possible; it takes extra time to generate the columns and many
of them are numeric types. (Note that you can always convert a non-string
field to a string field if you want regex matching, consult the
*wireshark-filter(4)* man page.) It does save a bit on typing (especially
for a multifield custom column) and remembering the column title might
be easier in some cases.

The columns are set before the color filters, which means that you
can have a color filter that depends on a built-in column like Info or
Protocol.

Remove the special handling for the -e option to tshark. Note that
the behavior is a little different now, because fixed field names
are used instead of the titles (using the titles allowed illegal
filter names, because it wasn't going through the filter engine.)
For default names, this means that they're no longer capitalized,
so "_ws.col.info" instead of "_ws.col.Info" - hopefully a small
price in exchange for the filters working everywhere.

The output format for -T fields remains the same; all that special
handling is removed (except for remembering if someone asked for
a column field to know that columns should be constructed.)

They're also set before the postdissectors, so postdissectors can
have access.

Anything that depends on whether a packet and previous packets are
displayed (COL_DELTA_TIME_DIS or COL_CUMULATIVE_BYTES) doesn't work
the way most people expect, so don't register fields for those.
(The same is already true of color filters that use those, along with
color filters that use the color filter fields.)

Fix #16576. Fix #17971. Fix #4684. Fix #13491. Fix #13941.
2023-07-25 00:49:52 +00:00
Gerald Combs 2150845ec3 epan: Add default log column preferences
Add default log column preferences. They're currently specific to the
Cloudtrail dissector and need to be generalized, but it's a good
starting point.

Don't clobber hard-coded custom column settings.
2023-07-18 12:24:40 -07:00
Gerald Combs 4d5c4154b1 Convert wmem to C99 types
Ping #19116.
2023-06-17 17:38:53 +00:00
Gilbert Ramirez d2c9f1824a Add a preference for ignoring duplicate frames
Sometimes you have a capture file that has many duplicate frames
because of how the capture was made, and its convenient to ignore
the duplicates so you can concentrate on the data and not all
the TCP warnings.

This adds a preference in the "Protocols" section to ignore
duplicates. This currently only works while reading a capture file
*not* during a live capture.
2023-06-09 07:21:08 +00:00
Stig Bjørlykke 1062e54fd5 prefs: Remove type of GUI preference
The type of GUI preference is unused.
Remove prefs.gui and rename prefs.gui_qt_* to prefs.gui_*.
2023-05-08 16:30:07 +00:00
John Thacker 6938e93170 prefs: Describe converted pref names properly
The Column prefs were moved to a submodule, so the name needs to
be obtained from the parent module instead of the module found,
unlike other modules.

The Column preference names themselves were also changed in addition
to the module. Wait until checking both the module name and the
preference name before printing a warning to the user that a preference
has been converted to a new name, so that the correct name is displayed.

This also means that we print the warning message now for the preferences
that just had their names changed, not the modules.

Fix #19043
2023-05-05 16:03:13 +00:00
John Thacker 91e516c5d5 epan: move deprecated column check to column file
Move the deprecated column check functions from the prefs
file to the (Wireshark internal use) column files. Make
them public so that the recent file checking can use them.

This keeps column handling in one place.

Make the recent file column width checking able to convert
a deprecated column to a custom column the same as the main
prefs file.
2023-04-29 12:06:32 +00:00
Developer Alexander bcc9e0db0c IO Graph: Hide Legend
Allows the user to hide the legend of the IO Graph.

This becomes handy as the legend may hide some graphs and it is
unfortunately not very helpful in many cases.
2023-04-10 18:05:39 +00:00
John Thacker 79812ca110 MaxMindDB: Move pref to Name Resolution prefs
Move MaxMind lookups to a global Name Resolution preference.
That's a bit of a misnomer (it's not name resolution, but it
is using external sources of data to update information about
a network object), but the MaxMind DB path location is already there.

This means that MaxMind lookups can be disabled with the '-n'
option, and enabled with a 'g' for the '-N' option. This is
significant for tshark, because MaxMind lookups are now synchronous.

Disabling the new global preference also keeps the Endpoints window
from doing MaxMind lookups; currently, even if the IPv4 and IPv6 GeoIP
prefs are disabled the data is still looked up and inserted in the
Endpoints window.

Fix #14692
2023-04-07 00:31:37 +00:00
John Thacker f0712606a3 capture: Set update interval in capture opts, default to 100ms
Reduce the default update interval for dumpcap to notify its parent
of new packets (or to check if we've met file duration, etc.) from
500 ms to 100 ms, and put in the capture options.

This makes the GUI appear to update more in real time rather than
in visible batches of packets.

This also reduces the amount of ring buffer space needed in cases
where we're doing dissection, and dissection is able to keep up,
but the files can be deleted before tshark gets to them because of
the notification lag. (See #1650.)
2023-03-14 08:43:32 +00:00
Jaap Keuter 455b9a470f sshdump: add capability to use doas on remote host 2023-02-19 13:41:24 +00:00
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