Commit Graph

276 Commits

Author SHA1 Message Date
Jaap Keuter de12268a9f Epan: Cleanup plugins only after all possible calls are made 2024-01-10 01:04:30 +00:00
João Valverde 8486ba26c6 epan: Add plugin get_descriptions callback
Allow epan plugins to push descriptions for each individual
plugin or extension managed by the epan plugin interface.

For example a Lua or Python epan plugin can push
descriptions for each *.lua or *.py script it registers.
2023-12-12 14:43:37 +00:00
João Valverde 5bcfa5b261 epan: Remove register_all_tap_listeners plugin callback
This is currently unused by anyone so remove it until the tap
listener interface can be properly tested.
2023-12-12 14:36:31 +00:00
João Valverde fd21a7717f epan: Remove HAVE_PLUGINS #ifdef 2023-12-12 14:36:19 +00:00
John Thacker 8ebde1309d Improve interface displaying and writing with multiple sections
Update the functions that get an interface name or description
to also take the section number in the record (0 if not present.)

Store a mapping of SHB number and interface number to global
interface number, and provide a function to access it. Use the
function to display the correct interface name and description
when there are multiple SHBs.

Use this information to rewrite interface numbers when writing a
pcapng file through wtap dumper, since we don't write additional
SHBs to a file when dumping. We could, but we'd have to store
exactly when to write the extra SHB when reading the file in
sequentially (unlike the other internal blocks, IDB, NRB, and
DSBs, that we intentionally move to the start.)

Since we're changing the number of sections, perhaps we should edit
the SHB options more?

Merging handles interface numbers in its own manner, but also needs
to know about the per-SHB interface ID to global ID mapping when
doing so.

Capinfos and capture file properties still require a bit more work
for proper output.

Fix #16531, fix #18049
2023-12-07 01:00:42 +00:00
John Thacker 3d4689d819 gnutls: Set FIPS mode to lax if enabled
As of GnuTLS 3.6.2, it's possible to set FIPS mode to non-enforcing
when FIPS is enabled. That's what we want to do, for the same reasons
as gcrypt and commit d5492abc89

Related to #18441
2023-10-18 19:51:17 -04:00
John Thacker 19fd8b7e81 nghttp3: Add runtime version information, if present
The compiled version is already added.

Related to #16761, #19399
2023-10-16 09:13:00 -04:00
John Thacker f1f6c1369d Don't use frames without timestamp for delta time calculations
pcapng allows simple packet blocks (which don't have timestamps),
enhanced packet blocks (which do) and custom blocks (which might
or might not have timestamps, and even if they do have timestamps,
libwiretap might not know about them), and so some records may have
timestamps while others do not.

Do not use frames without timestamps in delta time calculations.
Don't use them as reference frames for time calculations, or for
the previously displayed frame for time calculations, where the
previously displayed frame that actually has a timestamp is used.

Have the various _get_frame_ts functions return null instead of
their ts value (that is currently handled; if records without
timestamps set their abs_ts to the special "unset" value of nstime_t
that could work too, except that isn't currently handled.)

Still allow the GUI to set frames without timestamps as "Time
References", because that does still affect the "Cumulative Bytes"
column, so it's not entirely pointless; unset the reference time
so that the timestamp from the next frame that does have a timestamp
will be used as reference time.

The "previous captured frame" will show a 0 time delta when
the previous frame doeesn't have a timestamp. Perhaps a user
would also want "previous captured frame with a timestamp,"
but we'd have to store that in frame data (adding memory to
that struct.)

Fix #19397
2023-10-15 13:47:14 +00:00
John Thacker d5492abc89 gcrypt: Disable FIPS mode if possible
libgcrypt 1.10 added a new control command to force disable FIPS
mode, regardless of any file or environment variable that would turn
it on.

FIPS mode makes it impossible to _decrypt_ non-NIST approved
algorithms, both old insecure ones as well as simply unapproved
ones like ChaCha20 and Poly1305. We're decrypting, not promising
security.

Related to #18441 (but doesn't help with distributions like the
one in that bug, that have gcrypt older than 1.10.0)
2023-10-12 02:00:22 +00:00
Anders Broman 80f9a28921 Adding HTTP/3 dissection to Wireshark.
This is a copy of MR #9330 all code and credit to Omer Shapira.
2023-08-30 10:12:10 +00:00
Stig Bjørlykke 8134009b1d epan: Fix some indent TAB issues 2023-05-28 15:23:39 +00:00
João Valverde 84f963dfa2 Move ui/version_info.[ch] to wsutil 2023-02-07 23:17:37 +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 b07ab25a1c CMake: Cleanup unnecessary linking with shared libraries 2023-02-06 15:04:46 +00:00
João Valverde 7e6266d33d MSYS2: Add Lua 5.1 support and fix test suite failures 2023-01-16 11:54:43 +00:00
Sake Blok f870c6085d epan: Allow nested dependent packets
Save all dependent frames when there are multiple levels
of reassembly.

This is a retry of !6329, combined with the fix in !6509 which
were reverted in !6545.

epan: fix a segfault, introduced in !6329
2023-01-06 23:15:48 +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
João Valverde caacdae870 epan: Add a post_init() plugin routine
Epan plugins init runs before proto_init() to setup for that but there
is also a need to have a routine that runs at the end of epan_init(),
which can do pretty much anything using epan, like runnning tests.
2022-06-02 14:11:17 +00:00
Gerald Combs 87b0288b8d epan: Add the ability to add conversation filter protocols.
Convert our conversation protocols to a dynamic list and add
add_conversation_filter_protocol(). Use it in the Falco Bridge plugin to
add protocols with conversation filters.
2022-04-19 22:25:32 +00:00
João Valverde 842f53c329 Revert "epan: Allow nested dependent packets"
This reverts commit 2d8607e7e0.

This reverts commit be915d7374.

Introduces a segmentation fault, needs more work.
2022-03-28 12:40:21 +00:00
Sake Blok be915d7374 epan: Allow nested dependent packets
Save all dependent frames when there are multiple levels
of reassembly.
2022-03-06 23:43:03 +00:00
John Thacker cbf76ea22f Export PDU: Allow native encapsulations / strip headers
Allow export PDU taps to be registered with a wiretap encapsulation
instead of always using WTAP_ENCAP_WIRESHARK_UPPER_PDU. This allows
creating normal capture files that aren't tied to wireshark without
having to do a "editcap -C -L -T", as well as creating files in
formats other than pcapng and pcap with tshark.

Provide a couple sample implementations in Ethernet (WTAP_ENCAP_ETHERNET)
and IP (v4 and v6, WTAP_ENCAP_RAW_IP) that are the most common use cases.
(I can imagine a few others; WTAP_ENCAP_MPEG_2_TS could probably be
useful, for example.) Fixes #15141
2022-02-25 20:29:16 -05:00
David Perry e2fab18853 wsutil: New API to gather compile/runtime info 2022-02-24 13:27:08 +00:00
João Valverde 12d39efdca Revert "epan: Initialize wiretap"
This reverts commit c15f2aadc1.

Crashes on exit. Needs more work.

Fixes #17821.
2022-01-01 16:23:04 +00:00
João Valverde c15f2aadc1 epan: Initialize wiretap
Clients of libwireshark should not be required to initialize
explicitly wiretap, if they don't use it themselves.
2021-11-27 08:41:01 +00:00
João Valverde b9f2e4b7fa Make PCRE2 a required dependency 2021-11-14 21:00:59 +00:00
João Valverde ed8a02af17 dfilter: Add support for PCRE2
PCRE2 is the future of PCRE. The only advantage of GRegex is that
it comes bundled with GLib, which is not an advantage at all.
PCRE2 is widely available, the GRegex abstractions layer are not a
good fit and abstract things that don't need abstracting or that we
could handle better ourselves, there are open bugs (#12997) and
maintenance is spotty at best.

GRegex comes with many of the problems of bundled code, aggravated by
the fact that it completely falls outside of our control.
2021-11-14 21:00:59 +00:00
Gerald Combs 87b84b7813 Lua is a proper name. Fix its capitalization. 2021-11-11 01:08:51 +00:00
Brian Sipos abd0f1183f COSE dissector from dtn-wireshark project 2021-09-29 08:51:13 +00:00
João Valverde 750cc38669 epan: Remove some extraneous #ifdefs
If a macro identifier is not defined it evaluates to zero in an
expression, so the outer #ifdef is unnecessary and should be
avoided (the less the better).

Add a missing CMake comment while here.
2021-09-18 23:25:31 +01:00
Toni Uhlig a823e34642 Fix build error if ENABLE_SMI=OFF
* introduced with 9b13c4352d
 * HAVE_SMI_VERSION_STRING is always defined if libsmi found

Change-Id: I50480d37a3a6f31bcfe768f030af9176213b7366
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-09-17 19:29:48 +00:00
João Valverde 2cb1eb955f epan: Rename SMI dependency to "libsmi" 2021-09-16 00:42:03 +01: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 7f9c1f5f92 Move wmem to wsutil
This allows wmem to be used from other libraries, namely wsutil.
It is often the case that a funtion exists in wsutil and cannot
be used with a wmem scope, requiring some code duplication or
extra memory allocations, or vice-versa, code in epan cannot be
moved to wsutil because it has a wmem dependency.

To this end wmem is moved to wsutil. Scope management remains part
of epan because those scope semantics are specific to dissection.
2021-07-26 14:56:11 +00:00
Guy Harris dd5907d2a3 Consistently refer to blocks that have been modified as "modified".
"User" sounds as if the blocks belong to the user; at most, the current
user might have modified them directly, but they might also have, for
example, run a Lua script that, unknown to them, modified comments.
Also, a file might have "user comments" added by a previous user, who
them wrote the file and and provided it to the current user.

"Modified" seems a bit clearer than "changed".
2021-07-08 00:05:35 -07:00
David Perry 73087d6fb4 Use wtap_blocks for packet comments
Mostly functioning proof of concept for #14329. This work is intended to
allow Wireshark to support multiple packet comments per packet.

Uses and expands upon the `wtap_block` API in `wiretap/wtap_opttypes.h`.
It attaches a `wtap_block` structure to `wtap_rec` in place of its
current `opt_comment` and `packet_verdict` members to hold OPT_COMMENT
and OPT_PKT_VERDICT option values.
2021-07-07 18:40:24 +00:00
João Valverde 3a3fda2ca4 epan: Remove dependency on version_info object library
Dependending on version_info is unnecessary and forces an epan
rebuild every time the git commit id changes, which can be slow,
especially with LTO enabled, and again is unnecessary.

Printing the VCS version to the TLS debug log is a minor convenience
that doesn't justify the cost to relink epan with every commit.
2021-07-04 10:37:49 +00:00
João Valverde 0e50979b3f Replace g_assert() with ws_assert() 2021-06-19 01:23:31 +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
João Valverde 9b13c4352d epan: Add SMI version 2021-05-25 20:10:37 +01:00
João Valverde ea424f881f epan: Add c-ares version 2021-05-25 18:54:21 +01:00
João Valverde d0717c151a epan: Add nghttp2 version 2021-05-25 18:54:14 +01:00
João Valverde 9ae2820ff3 epan: Remove some superfluous calls 2021-05-25 18:54:04 +01:00
João Valverde ab4a2aa0f2 epan: Add some minimum version checks 2021-05-25 13:15:47 +00:00
David Perry 32cc1c7906 Remove use of PACKAGE_VERSION in maxminddb version 2021-05-19 17:16:01 +00:00
David Perry a1ba9453ef Add version info for lz4, zstd, maxmind
This simply implements the patches given in a comment on bug 16270.
<https://gitlab.com/wireshark/wireshark/-/issues/16270#note_400748726>
2021-05-19 13:38:25 +00:00
João Valverde 89fee9321e Avoid exposing HAVE_PLUGINS in the public API
Instead *_register_plugin() is turned into a noop (with a warning).

The test suit is failing with ENABLE_PLUGINS=Off (it was already failing
before and this patch didn't affect that).

Closes #17202.
2021-02-06 16:35:51 +00:00
Stig Bjørlykke 3dc5f5c2d6 epan: Keep decode_as_list when changing profile
The decode_as_list is built at startup and contains all protocols
registered for "decode as". Do not clear this list on profile change,
only on exit.

Bug: 16635
Change-Id: I832a042327603ae0f01b10ab620fccc03d4fd3a3
Reviewed-on: https://code.wireshark.org/review/37579
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-06-29 18:40:27 +00:00
Gerald Combs 451a241e50 Add c-ares to the required library list.
Although c-ares support was techically optional, it was either on by
default or required in all of our packaging. Go ahead and require it
globally. C-ares is widely available and synchronous name resolution can
easily result in a horrific user experience.

Change-Id: Id67c797316ed6b8a0ab5052e55a43a1b9e2a2464
Reviewed-on: https://code.wireshark.org/review/35188
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-11-23 22:45:59 +00:00