Commit Graph

88398 Commits

Author SHA1 Message Date
João Valverde 152fef5b38 Qt: Remove an #ifdef 2023-08-18 01:01:10 +00:00
Martin Mathieson d0312ddf4a Fix some filters and field widths 2023-08-17 22:08:30 +01:00
João Valverde 759c0feab3 CMake: Accept any supported Lua version by default 2023-08-17 18:16:12 +00:00
Alexis La Goutte 008d389e94 ieee80211: fix mask is all set
packet-ieee80211.c hf_ieee80211_gann_flags_reserved filter= wlan.gann.flags.reserved  - mask is all set - this is confusing - set 0 instead! : 0xFF
packet-ieee80211.c hf_ieee80211_he_trigger_bar_info_blk_ack_seq_ctrl filter= wlan.trigger.he.common_info.bar_info.blk_ack_starting_seq_ctrl  - mask is all set - this is confusing - set 0 instead! : 0xFFFF
2023-08-17 17:43:02 +00:00
Alexis La Goutte e4544bd5ae ieee80211: fix wrong item type/length and bitmask
Warning: epan/dissectors/packet-ieee80211.c:24227 proto_tree_add_uint called for hf_ieee80211_he_om_rx_nss  -  item type is FT_UINT16 but call has len 4
Warning: epan/dissectors/packet-ieee80211.c:24229 proto_tree_add_uint called for hf_ieee80211_he_om_channel_width  -  item type is FT_UINT16 but call has len 4
Warning: epan/dissectors/packet-ieee80211.c:24233 proto_tree_add_uint called for hf_ieee80211_he_om_tx_nsts  -  item type is FT_UINT16 but call has len 4
Warning: epan/dissectors/packet-ieee80211.c:24326 proto_tree_add_uint called for hf_ieee80211_he_uph_ul_power_headroom  -  item type is FT_UINT8 but call has len 4
Warning: epan/dissectors/packet-ieee80211.c:24330 proto_tree_add_uint called for hf_ieee80211_he_uph_reserved  -  item type is FT_UINT8 but call has len 4
Warning: epan/dissectors/packet-ieee80211.c:24348 proto_tree_add_uint called for hf_ieee80211_he_btc_avail_chan  -  item type is FT_UINT16 but call has len 4
Warning: epan/dissectors/packet-ieee80211.c:24350 proto_tree_add_uint called for hf_ieee80211_he_btc_reserved  -  item type is FT_UINT16 but call has len 4
2023-08-17 17:43:02 +00:00
Stig Bjørlykke 66a502e195 Qt: Add loadGeometry to ManufDialog
Load and save dialog geometry for MAC Address Blocks dialog.
2023-08-17 19:01:50 +02:00
Huang Qiangxiong b86172a37d STUN: add Change IP or Port to INFO column 2023-08-17 16:32:03 +00:00
João Valverde fea3f90147 Rename the Lua log domain
The name "WSLua" looks kind of weird. Use just "Lua" instead.
2023-08-17 15:39:21 +01:00
João Valverde 80c63485e4 Qt: Close console dialog when reloading Lua
Fixes a crash using the console because the dialog holds a pointer
to the Lua state that gets invalidated by the reload.

Forcing the dialog to close drops the invalid reference and avoids
the crash and all the other attending state problems with the reload.

In theory there might be console types other than Lua so we may
want to fix the code to close only Lua type dialogs if only Lua
plugins are reloaded.
2023-08-17 15:38:57 +01:00
João Valverde 8ebbcd4ecf Qt: Use a vertical layout with Lua console
Switch from a horizontal input/output text layout to a vertical
layout with a splitter in the middle.

Change to a QTextEdit while at it, just because the performance
reasons that might suggest using QPlainTextEdit are not very
relevant here.

Use the proper keyboard shortcut for macOS.
2023-08-17 15:32:36 +01:00
Stig Bjørlykke 249516680b Qt: Add loadGeometry to CredentialsDialog
Load and save dialog geometry for Credentials dialog.
2023-08-17 15:18:18 +02:00
John Thacker 615c2bf15a batadv: Can't add bitmask with no fields
proto_tree_add_bitmask has an error if called with an empty
set of fields. The flags field is unusued in BATADV_OGM2, so
just add without using a bitmask tree.

Part of #17890
2023-08-17 07:29:09 -04:00
Jonas Wamsler e6110367de sapsnc: Fix dissection of Quality of Protection parameter
Fixing the bug of the dissector that swaps the Quality of Protection parameter "min" and "use" in snc.
2023-08-17 10:42:32 +00:00
Darius Davis 74f25620f2 Telnet: Fix unescaping of some option subnegotiation.
A confusion of offsets can cause mis-dissection of some Telnet option
subnegotiation data.  Fix it by directly testing whether the required offset
exists within the tvb.

Fixes #19236
2023-08-17 10:21:49 +00:00
João Valverde 29ad6db8aa epan: Remove obsolete "logger" funnel.h callback
This function is just a wrapper around ws_log() and has been
superseded by the more feature-complete full wslog API.

It doesn't seem to be exposed to Lua scripts so removing it
should not break anything Lua-related.
2023-08-17 10:04:53 +00:00
Markku Leiniö 90cc69536b Remove article 'a' from manuf data 2023-08-17 11:30:26 +03:00
John Thacker c3cc0e5fa7 Qt: Set StockIconToolButton cursor, leave action
Set the StockIconToolButton cursor to ArrowCursor,
so that, e.g. the buttons in a FieldFilterEdit won't
use the parent's Qt::IBeamCursor.

Set the StockIconToolButton mode back to QIcon::Normal
on a Leave event.

Fix #19278
2023-08-17 07:47:58 +00:00
Markku Leiniö a8f8e79a57 Qt: Change formatString() to use localized byte units 2023-08-17 08:24:10 +03:00
Markku Leiniö 67af3d73be Change how system default locale is set 2023-08-17 05:07:35 +00:00
Niels Widger 005cd9d1c6 Add new -p/-P capinfos options to doc/capinfos.adoc 2023-08-17 05:01:56 +00:00
Niels Widger 45772de991 Add packet comments to the output of capinfos
Created new `-p`/`-P` flags to enable and disable the output of all
individual packets comments via `capinfos`. Output of the comments
is enabled by default.

It is possible to have multiple comment blocks on a single packet. The
output of `capinfos` will include multiple comment lines for the same
packet.

When machine-readable output is enabled via `-M`, packet comments are
escaped before being printed. Using `-M` also escapes the any file-level
comments.
2023-08-17 05:01:56 +00:00
David Perry 1d2dfd693a TLS: Label incomplete segments as such
When a packet contains a complete TLS record followed by a segment, add
an entry to the TLS protocol tree labelling the segment as such.

The current behaviour claims that data as part of the parent tree item
but without any dissection or explanation. This change is meant to be a
hint that fragmentation is happening at a lower level but the traffic is
recognized as TLS.

Uses `ssl_proto_tree_add_segment_data()` to create the tree entry.
Tweaks that function to report remaining TVB length when passed a length
of -1 (which the underlying `proto_tree_add_foo()` call already treats
as "to the end of the packet").
2023-08-17 04:42:42 +00:00
Guy Harris 5d04013024 Add a set of time stamp precision values in wsutil/nstime.h and use them.
Add an enum containing a set of symbols for time stamp precisions, where
the value of the symbol is the number of digits of precision after the
decimal point.

Replace to_str_time_res_t with the new enum, ws_tsprec_e.

Deefine the TS_PREC_FIXED_ entries in the ts_precision enum, and the
WTAP_TSPREC_ #defines that correspond to known time stamp precisions, to
have the same values as the corresponding ws_tsprec_e values. This means
that their values are also the number of digits of precision after the
decimal point.
2023-08-16 22:57:51 +00:00
Guy Harris 14b8bc66e8 Initialize global_dissect_options at compile time.
We require a C11 compiler, and designated initializers have been in C
since C99.  Use them to initialize the time format and precision values
at compile time, rather than requiring that dissect_opts_init() be
called before the command-line arguments are parsed.

This is good because TShark and rawshark were *not* calling
dissect_opts_init(); that doesn't appear to have caused problems with
existing versions, but it might be causing problems with another pending
change that's failing to pass the test suite.
2023-08-16 15:34:55 -07:00
Guy Harris 50778cff57 Move the check for TS_PREC_NOT_SET out of timestamp_set_precision().
Putting it there makes it not obvious why the check is being done.
Instead, do the check before calling timestamp_set_precision() - and do
the same for timestamp_set_type(), as, in both cases, the _NOT_SET value
means that no command-line option was specified to set the timestamp
type or precision, so there's nothing to set them *to*.
2023-08-16 14:41:57 -07:00
Niels Widger bdc78d3a63 sharkd: Add optional "filter" parameter to "tap" method
Add new optional `filter` parameter to `sharkd`'s `tap` method which
sets the `fstring` filter parameter which should be used for all
`register_tap_listener` calls made when creating taps requested in the
method's `tap0`-`tap15` parameters.  The value of the new `filter`
parameter is used to set a `tap_filter` local variable in
`sharkd_session_process_tap`.  This local variable existed previously
and was already passed into most calls to `register_tap_listener`, but
was always set to an empty string.
2023-08-16 21:06:41 +00:00
Niels Widger b0bf7a8e13 editcap: Add --discard-packet-comments option and fix -a option
Added new `editcap` option `--discard-packet-comments` to discard all
packet comments when editing a pcap file and writing a new one.  This
behaves the same way as the existing `--discard-capture-comment`
option only it discards packet comments and not capture file comments.
Packet comments added with `-a` on the same command line are not
discarded.

Also, fix the existing `-a` option to work the way the documentation,
which says it should "Add or replace comment for given frame number",
describes it.  Namely, any existing comments for the packet are now
removed before the comment specified by the `-a` option is added.
2023-08-16 21:03:37 +00:00
Guy Harris f25421db6c dissect_opts: use a better name for a routine.
Yes, *one* of the things the routine does is to split a comma-separated
list into individual items, but the *main* thing it does is process all
items in an slist of entries that are strings that are comma-separated
lists of items by passing them to a callback routine.

Rename the routine to describe what it does, namely process an enable or
disable list in the aforementioned format, calling a routine that
enables or disables the item.
2023-08-16 13:34:00 -07:00
Martin Mathieson 011aa3adfd Misc dissector fixes 2023-08-16 18:45:20 +00:00
Guy Harris bb31b5704c Note that the -t flag affects the recent file.
The applyGlobalCommandLineOptions() method of the Wireshark and Logray
main window will cause time stamp format and precision settings provided
by the command line to be saved in the recent file, so the next time the
user starts up Wireshark or Logray, they'll get the settings from the
previous invokation with -t.

(This code is a little tricky, so it's not obvious what *not* setting
the parameter in the recent structure would break, if anything.  And
I'm not sure anybody's complained about the behavior.)
2023-08-16 11:13:12 -07:00
Niels Widger ef14ebd180 sharkd: initialize the columns correctly for sip stats
`MIN_SETUP_COLUMN`'s `user_data.uint_value` field is used to track a
global counter field for all SIP request methods in order to calculate
the average time.  This field was not being initialized correctly in
`sip_stat_init` causing subsequent taps in `sharkd` to return
incorrect data.  Additionally, initialize `COUNT_COLUMN`'s
`user_data.uint_value` and `AVG_SETUP_COLUMN`'s
`user_data.float_value` which were reset in `sip_stat_reset` but not
initialized in `sip_stat_init`.  With these changes, the fields
initialized/reset in `sip_stat_init` and `sip_stat_reset`, both in
`epan/dissectors/packet-sip.c`, should line up.

Finally, remove a duplicate initialization of `RESENT_COLUMN` in
`sip_stat_reset`.
2023-08-16 16:18:37 +00:00
João Valverde 5d35745f01 Qt: Add "success" hint to IO Console Dialog 2023-08-16 15:19:00 +00:00
João Valverde 5a1da4f692 Lua: Remove console.lua
Add Lua 5.1 support for the new IO Console Dialog. Remove the
obsolete console.lua file.
2023-08-16 15:19:00 +00:00
João Valverde 919bc0d6f5 CMake: Update FindLua module
Replace our code with the upstream version, simplified to search
only for our supported Lua versions.

This allows selecting Lua versions 5.2, 5.2 or "any". The default
is 5.2 only because supporting more than one Lua versions is
generally the wrong thing to do. Allow falling back to
5.1 *explicitly*
2023-08-16 15:19:00 +00:00
João Valverde 8ed0b47667 Qt: Add Lua console dialog
This adds a dialog in the Tools menu to open a console and evaluate
Lua code using the embedded Lua engine. It replaces the previous
console.lua implementation that was more limited to use, because
it relies on GUI bits exposed to Lua. It used two separate windows
for that reason.

The implementation uses the existing "funnel" API amd  relies heavily
on callbacks to maintain separation between GUI and epan code and
make it generic enough to possibly support more use cases than just
the Lua 5.2 console.

The open and close callbacks are used to install and remove a custom
print() lua function with dialog creation and destruction.

The eval callback is basically the same as luaL_dostring().
2023-08-16 15:19:00 +00:00
John Thacker de1d30cb4e Qt: Fix compilation on Qt5 and clang
The QByteArray constructor from a const char * and a size uses a
qsizetype for the size in Qt6 but an int in Qt5
(See https://doc.qt.io/qt-6/qbytearray.html#QByteArray-1 vs
https://doc.qt.io/qt-5/qbytearray.html#QByteArray-1 )

Prevent a warning (->err) about shortening from 64 to 32 bits
when compiling with clang and Qt5, where ints are 32 bits
and qsizetype is an unsigned long long (64 bits).
2023-08-16 15:04:28 +00:00
Niels Widger dc29ae7ba3 sharkd: Add "fn" field to "frame" output
The `fn` attribute indicates the "field name" of the current tree item.
This is useful to have outside of having to parse the `f` attribute.
2023-08-16 10:25:49 -04:00
Niels Widger a4c6a2f14b sharkd: add voip-calls and voip-convs taps
Add `voip-calls` and `voip-convs` taps to `sharkd`, which provide the
same information as the `Telephony -> VoIP Calls` GUI menu item.  The
`voip-convs` tap accepts an optional comma-separated list of call ID's
allowing the caller to limit which conversations are returned.  Both a
single call ID or a `<start>-<end>` call ID range is accepted.  For
example, `voip-convs:` returns all conversations, `voip-convs:123`
returns only the conversation with call ID 123 and
`voip-convs:1,5-7,9` returns conversations with call ID's 1, 5, 6, 7
and 9.  The call ID for a conversation is returned in the `call`
field.  The set of call ID's requested by the caller is stored in a
bit-array which, on a standard Linux amd64 machine, supports storing a
maximum of 65536 call ID's.

Because many of the taps initialized by `voip_calls_init_all_taps` are
not able to be built without it, a basic CLI-based implementation of
`simple_dialog` which prints to `stderr` has been added in
`ui/cli/simple_dialog.c`.
2023-08-16 08:48:38 -04:00
Martin Mathieson 87d5daa331 Fix some spelling errors 2023-08-16 12:26:39 +01:00
WFA-achuang 75fc8ceaaa ieee80211: Add five EXT element dissectors
QoS Characteristics(113), AKM Suite Selector(114)
MLO link Infor(133), AID Bitmap(134), BW Indication(135)
Also add AKM 24 and 25 dissector
2023-08-16 17:50:52 +08:00
John Thacker 18018f7534 Qt: Don't use winId() on a child widget (Qt Wayland issue)
On Qt Wayland, winId() should only be used on a top-level window:
https://bugreports.qt.io/browse/QTBUG-76983
https://bugreports.qt.io/browse/QTBUG-93103
https://bugs.kde.org/show_bug.cgi?id=424024
https://bugreports.qt.io/browse/QTBUG-75766

Using it on the child widget and getting a native window causes the
packet list to fail to redraw correctly when scrolling. (It does
redraw when the window is brought to the back and then back to the front.)
2023-08-15 19:23:28 +00:00
Martin Mathieson f9f182f19e check_typed_item_calls.py: Add exception for checking all-set masks 2023-08-15 15:59:27 +00:00
Niels Widger 92c5fb9ad3 sharkd: Use PRIu32/PRIu64 when outputing guint32/guint64 JSON values
Update `sharkd_session_process_tap_phs_cb_aux` to use the
`PRIu32`/`PRIu64` format specifiers from `<inttypes.h>` when outputing
`guint32`/`guint64` JSON values since difference targets require
different specifiers to compile.
2023-08-15 14:32:21 +00:00
Niels Widger 1bdbea4ae1 sharkd: Remove unneeded sharkd_phs_req struct 2023-08-15 14:32:21 +00:00
Niels Widger c96b79f105 sharkd: Add phs tap to sharkd
Add `phs` tap to `sharkd`, providing the same information as
`tshark`'s `-z io,phs` option.

Additionally, modify how `tshark -z io,phs` (and therefore `sharkd`'s
new `phs` tap) handles packet comments (aka `pkt_comment` protocol
frames).  Previously, `pkt_comment` protocol frames were handled no
differently from any other protocol in `io,phs`'s `tap_packet`
callback `protohierstat_packet` but were skipped in its `tap_draw`
callback `protohierstat_draw`.  This behavior seems to have been first
introduced in 80ae3708.  For captures containing packet comments, this
lead to surprising `tshark -z io,phs` output with multiple root-level
`eth` trees.  Below is example output of the old behavior for the
`test/captures/protohier-with-comments.pcapng` capture in this
repository with two packet comments, one on an ICMPv6 packet and
another on an SSDP packet:

    # tshark -qz io,phs -r ./test/captures/protohier-with-comments.pcapng
    ===================================================================
    Protocol Hierarchy Statistics
    Filter:

    eth                                      frames:113 bytes:21809
      ipv6                                   frames:38 bytes:7456
        icmpv6                               frames:35 bytes:3574
        udp                                  frames:3 bytes:3882
          data                               frames:3 bytes:3882
      ip                                     frames:69 bytes:13993
        udp                                  frames:59 bytes:13391
          mdns                               frames:1 bytes:138
          ssdp                               frames:29 bytes:8561
          nbns                               frames:20 bytes:2200
          nbdgm                              frames:1 bytes:248
            smb                              frames:1 bytes:248
              mailslot                       frames:1 bytes:248
                browser                      frames:1 bytes:248
          dhcp                               frames:4 bytes:1864
          dns                                frames:4 bytes:380
        igmp                                 frames:10 bytes:602
      arp                                    frames:6 bytes:360
    eth                                      frames:2 bytes:377
      ipv6                                   frames:1 bytes:110
        icmpv6                               frames:1 bytes:110
      ip                                     frames:1 bytes:267
        udp                                  frames:1 bytes:267
          ssdp                               frames:1 bytes:267
    ===================================================================

Despite the comment in `phs_draw` in `ui/cli/tap-protohierstat.c`,
this does not seem to match the behavior for PHS as shown in the GUI.
The GUI seems to ignore the `pkt_comment` protocol frames and merges
their children up a level.  This commit tries to reproduce this
behavior in the `tshark -z io,phs` output by ignoring `pkt_comment`
protocol frames in `protohierstat_packet` instead of
`protohierstat_draw`.  The result is output like the following:

    # tshark -qz io,phs -r ./test/captures/protohier-with-comments.pcapng
    ===================================================================
    Protocol Hierarchy Statistics
    Filter:

    eth                                      frames:115 bytes:22186
      ipv6                                   frames:39 bytes:7566
        icmpv6                               frames:36 bytes:3684
        udp                                  frames:3 bytes:3882
          data                               frames:3 bytes:3882
      ip                                     frames:70 bytes:14260
        udp                                  frames:60 bytes:13658
          mdns                               frames:1 bytes:138
          ssdp                               frames:30 bytes:8828
          nbns                               frames:20 bytes:2200
          nbdgm                              frames:1 bytes:248
            smb                              frames:1 bytes:248
              mailslot                       frames:1 bytes:248
                browser                      frames:1 bytes:248
          dhcp                               frames:4 bytes:1864
          dns                                frames:4 bytes:380
        igmp                                 frames:10 bytes:602
      arp                                    frames:6 bytes:360
    ===================================================================

Note that there are no `pkt_comment` protocols and only a single
root-level `eth` protocol.  Additionally, the commented ICMPv6 and
SSDP packets have been merged into the first `eth` tree, and the frame
and byte counts have been incremented appropriately.
2023-08-15 14:32:21 +00:00
Mikołaj Małecki de5dc5dd23 SRT dissector: Fixed failure code presentation in the handshake 2023-08-15 11:37:29 +00:00
John Thacker 9a49fdd315 IDN: Fix use of conversation
The conversation_new() function last parameter is options, not
a place to put a uint parameter like the channel id. Change
the call to the conversation_full API in order to do what
was intended, and avoid DISSECTOR_ASSERT messages.

Only allocate the file scoped configuration data the first time
it is encountered, instead of every time a frame is parsed.

The message_info is allocated anew and filled in each time the
packet is dissected, so that should be pinfo->pool allocated.

Related to #16707, #19272
2023-08-15 10:12:31 +00:00
Anders Broman ef6511a08e BLF: Improve file dissection. 2023-08-15 10:31:47 +02:00
Guy Harris 4f4a54e6d3 blf: fix formats used to format unknown WTAP_ENCAP_ values and unsigned numbers.
Format an unhandled encapsulation type as ENCAP_n-C, where "n" is the
encapsulation type value - in *decimal*, as that's how they're defined -
and "C" is the channel number.

Format unsinged quantities, such as channel numbers and indices for log
containers, with %u, not %d.
2023-08-15 00:47:22 -07:00
Albert Chuang 23bc2d48bb ieee80211: Update 5 EHT element to verson D3.0 2023-08-15 06:02:28 +00:00