Commit Graph

45044 Commits

Author SHA1 Message Date
Karsten Graul 0ab1cbdb40 SMC: show translated MTU and buffer size
Additionally append the translated/uncompressed MTU and
buffer size.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
2022-05-03 19:12:18 +00:00
Karsten Graul 341e625249 SMC: support for SMC-Rv2 LLC messages
Add the support for SMC-Rv2 Link Level Control (LLC) messages which
flow over Infiniband.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
2022-05-03 19:12:18 +00:00
Karsten Graul 7c70af016f SMC: improve SMC-Rv2 CLC message support
More fine tuning of the SMC-Rv2 support, and add the support to show
the GID list in a CLC proposal message.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
2022-05-03 19:12:18 +00:00
Guvenc Gulce b66b07a786 SMC: Add support for SMCRv2
Add SMCRv2 clc proposal/accept/confirm and decline support.
Proposal and decline parsing routines are used by SMC-R(v2) and SMC-D(v2).

Enhance the existing SMC protocol dissector in such
a generic way that it supports both SMC-R(v2) and SMC-D(v2)
protocols. These two protocols are similar to each other.
SMC-D and SMC-R has a version 1 and version 2.

Signed-off-by: Guvenc Gulce <guvenc@linux.ibm.com>
2022-05-03 19:12:18 +00:00
Dylan Ulis edfef021e7 CIP Safety: Increase error detection diagnostics to PI_ERROR 2022-05-03 15:06:50 +00:00
Alexander Clouter e75f6800ca EAP: fix packet leak caused by ce087027ef
Caught and flagged in https://gitlab.com/wireshark/wireshark/-/merge_requests/6838#note_932484809
2022-05-02 17:12:24 +01:00
Gerald Combs 2f31c09045 [Automatic update for 2022-05-01]
Update manuf, services enterprise numbers, translations, and other items.
2022-05-01 17:26:48 +00:00
Martin Mathieson 7fbfea9d68 IEEE80211: Fix a couple of filters 2022-04-30 21:56:21 +00:00
Alexander Clouter ce087027ef EAP: massage pinfo for EAPOL so the TLS decoder does not get lost 2022-04-30 13:30:20 +00:00
Alexander Clouter 6843ca2463 EAP: decode TEAP Outer-TLVs 2022-04-30 13:30:20 +00:00
Alexander Clouter 914d8bc756 EAP: add PEAP decoder
The existing PEAP support does not decode the inner attributes, this
commit adds that support by introducing packet-peap.c which recreates
a 'pseudo' EAP header before looping the TVB back into the EAP dissector.
2022-04-30 13:30:20 +00:00
Alexander Clouter 49c730cc23 EAP: use enum for pdata instead of magic numbers
Later for packet-peap.c, need to use pdata to pick into the parent
dissector so here we set up packet-eap.c to use enum.
2022-04-30 13:30:20 +00:00
Alexander Clouter b9681002c5 EAP: add MSAUTH-TLV decoder 2022-04-30 13:30:20 +00:00
Alexander Clouter f694e70771 EAP: improve EAP-TLS flag decoding
Decode TEAP's O-flag.

We also update the diagram and references as PEAPv0 has a different view
of how the flags are used compared to the RFCs and drafts.
2022-04-30 13:30:20 +00:00
Gerald Combs 70bd130379 Fix "generated by" comments in configuration files.
Add get_configuration_namespace() and use it in code that writes
"generated by" comments at the top of various configuration files.

Update our Logwolf colorfilters.
2022-04-29 18:00:21 +00:00
Joakim Karlsson b244db8f3c pfcp: Update to 3GPP TS 29.244 V17.4.0 2022-04-29 11:29:19 +00:00
Dylan Ulis 482794ff2e CIP Safety: Fix TBD bytes expert info 2022-04-29 11:28:01 +00:00
Joakim Karlsson b75b8ca72e dfilter: fix may be used uninitialized in this function [-Wmaybe-uninitialized] 2022-04-27 13:36:43 +02:00
Jonas Falkevik 7284ee091f Diameter: Decode GMLC-Number AVP
Add decoding of the GMLC-Number AVP.
3GPP TS 29.272 GMLC-Number
Encoded as a TBCD-string.
2022-04-27 09:15:45 +00:00
Jonas Falkevik bfdb4c558e epan: refactor dissector E.164 MSISDN number name
Prepare for adding reusing code where only descriptive name differs.
But the numbers are encoded using the same rules.
"E.164 number (MSISDN)" & "E.164 number (ISDN)" for example.
2022-04-27 09:15:45 +00:00
Joakim Karlsson c2444370f4 GTP': correction of Release Identifier Extension 2022-04-26 19:40:28 +00:00
easonweii b72b4cf512 LLDP: Fix malformed packets when EndOfLLDPDU TLV missing
The End of LLDPDU TLV is optional, should not as malformed even if missing.
Resolve it by checking whether the total length of each TLV reaches the total length of TVB.
Close #18029
2022-04-26 19:27:15 +00:00
Gerald Combs 90cc7cadf7 Fix a documentation warning.
Fix

epan/conversation_filter.h:43:11: warning: parameter 'A' not found in the function declaration [-Wdocumentation]
 * @param A valid protocol name.
          ^
epan/conversation_filter.h:43:11: note: did you mean 'proto_name'?
2022-04-26 19:12:11 +00:00
João Valverde 4f3f507eee dfilter: Add syntax to match specific layers in the protocol stack
Add support to display filters for matching a specific layer within a frame.
Layers are counted sequentially up the protocol stack. Each protocol
(dissector) that appears in the stack is one layer.

LINK-LAYER#1 <-> IP#1 <-> TCP#1 <-> IP#2 <-> TCP#2 <-> etc.

The syntax allows for negative indexes and ranges with the usual semantics
for slices (but note that counting starts at one):

    tcp.port#[2-4] == 1024

Matches layers 2 to 4 inclusive.

Fixes #3791.
2022-04-26 16:50:59 +00:00
João Valverde c0170dad42 dfilter: Rename "range" to "slice"
The word range is used for different things with different
meanings and that is confusing. Avoid using "range" in code to
mean "slice".

A range is one or more intervals with a lower and upper bound.

A slice is a range applied to a bytes field.

Replace range with slice wherever appropriate. This usage of
"slice" instead of range is generally correct and consistent in
the documentation.
2022-04-26 16:50:59 +00:00
João Valverde d517feee74 epan: Add more bookkeeping for layers
Packet info already contains the notion of layer depth for the
current protocol, among all the protocols in the frame. This
adds an extra layer number for the protocols that are the same
as the current one. Obviously this will only go above one if
the protocol is repeated in the stack, such as with IP tunneling.

Adds extra logic to track numbers for each protocol in the frame
and update them when calling a dissector.

The total layer number and protocol layer number are store in
the field info structure so they can be used after dissection,
namely by display filters.
2022-04-26 16:50:59 +00:00
Joakim Karlsson 74fd19fb10 NAS-5GS: correction of Configuration update command, IE 5GS registration result 2022-04-26 13:54:48 +00:00
Pedro Jose Marron 095043f74b Update Wi-SUN FAN dissector to the last version of the specification
- The latest version of the Wi-SUN FAN specification has added
  a number of Information Elements that need to be supported by
  the dissector.
- Following changes and additions have been included:
  - New Header IEs: LUTT, LBT, NR, LUS, FLUS, LBS, LND, LTO, PANID
    and RT.
  - New Payload IEs: POM, LCP, LFNVER and LGTKHASH
  - New frame types: LFN PAN Advertisements, Solicits and time
    synchronization frame types.
  - Update to the channel spacing names to incorporate the new
    ones defined in FAN 1.1
2022-04-26 13:24:06 +02:00
Peter Wu 62100da7f4 TLS: fix RSA decryption with EMS and renegotiation
The handshake hash is used to derive TLS decryption keys when the
Extended Master Secret (EMS) extension is in use.
ssl_calculate_handshake_hash updates this hash only when the master
secret has not been determined yet.

During TLS renegotiation, there are two master secrets: one before, and
one after. Before this fix, the second calculated master secret is
wrong because the second Client Hello is missing in the handshake hash.
It was missing because the handshake hash was not being updated since
the master secret for the first handshake was still present, and the
decryption state was only reset after that hash update.

To fix this, make sure to clear the SSL_MASTER_SECRET flag before
updating the handshake hash when needed. Additionally, clear the
handshake hash when processing the Client Hello just to make sure that
any previous state is gone.

Fixes #18059
2022-04-25 12:03:32 +00:00
Peter Lemenkov b1ba667acc wslua: another fix for -Werror=clobbered
```
cd /home/petro/work/wireshark/epan/wslua && /usr/bin/cc -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DWS_BUILD_DLL -I/home/petro/work/wireshark -I/home/petro/work/wireshark/include -isystem /usr/include/glib-2.0 -isystem /usr/lib64/glib-2.0/include -isystem /usr/include/lua-5.1 -isystem /home/petro/work/wireshark/epan/wslua -fvisibility=hidden  -fexcess-precision=fast -Wall -Wextra -Wendif-labels -Wpointer-arith -Wformat-security -fwrapv -fno-strict-overflow -Wvla -Waddress -Wattributes -Wdiv-by-zero -Wignored-qualifiers -Wpragmas -Wno-overlength-strings -Wno-long-long -Wredundant-decls -Wno-error=maybe-uninitialized -Wno-format-truncation -Wframe-larger-than=32768 -Wunused-const-variable -Wshadow -Wold-style-definition -Wstrict-prototypes -Wlogical-op -Wjump-misses-init -Werror=implicit -Wno-pointer-sign -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fmacro-prefix-map=/home/petro/work/wireshark/= -fmacro-prefix-map=/home/petro/work/wireshark/= -O2 -g -DNDEBUG -fPIC -std=gnu11 -Werror -MD -MT epan/wslua/CMakeFiles/wslua.dir/init_wslua.c.o -MF CMakeFiles/wslua.dir/init_wslua.c.o.d -o CMakeFiles/wslua.dir/init_wslua.c.o -c /home/petro/work/wireshark/epan/wslua/init_wslua.c
/home/petro/work/wireshark/epan/wslua/wslua_tree.c: In function ‘TreeItem_add_packet_field’:
/home/petro/work/wireshark/epan/wslua/wslua_tree.c:79:17: error: variable ‘item’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
   79 |     proto_item* item = NULL;
      |                 ^~~~
Consolidate compiler generated dependencies of target dissectors
cc1: all warnings being treated as errors
make[2]: *** [epan/wslua/CMakeFiles/wslua.dir/build.make:508: epan/wslua/CMakeFiles/wslua.dir/wslua_tree.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
```

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
2022-04-25 11:24:11 +00:00
Alexis La Goutte 19dc602fe3 802.11: fix TWT Setup dissection
Duplicate Dialog Token field

Fix #18050
2022-04-24 20:48:04 +00:00
Gerald Combs cfcfbbdd60 [Automatic update for 2022-04-24]
Update manuf, services enterprise numbers, translations, and other items.
2022-04-24 16:39:41 +00:00
John Thacker 91987dc0ab nghttp2: Implement minimum required version 1.11.0
All currently supported Linux distributions have a version greater
than 1.11.0 (and our macOS and Windows versions are also much greater),
and this allows us to use nghttp2_hd_inflate_hd2(), which replaced the
deprecated nghttp2_hd_inflate_hd()
2022-04-24 10:24:11 -04:00
Dylan Ulis e5e78d5da9 CIP Safety: Update more naming/units to match spec 2022-04-24 09:04:12 +00:00
Ben Huddleston 71b3fe0f4b couchbase: Add timestamp to DcpSnapshotMarker encoding
Timestamp is an optional part of the DcpSnapshotMarker value.
2022-04-24 07:54:36 +00:00
John Thacker d2064ae188 gnutls: Bump version to 3.5.8
Bum the minimum version of GnuTLS to 3.5.8, which was the first stable
release in the 3.5 series. All the currently supported Linux
distributions have a version at least this new.
2022-04-23 02:26:08 +00:00
Guy Harris 1ee8ead845 Provide the section number for blocks, and show it.
Add a "section number" field to wtap_rec, with a presence flag, and
provide the section number (0-based) for pcapng files.

Display it (1-based) if present.
2022-04-22 18:14:29 -07:00
Gerald Combs 7286e2982a Move the idl directory to epan/dissectors/corba-idl. 2022-04-22 20:36:57 +00:00
easonweii a1e0c34c30 GTP: Minor reconstruction
Extract Method for multiple message parsing for tpdus to simplify things for future bug fixes and to make the code logic clearer.
Encapsulate the following functions:
dissect_gtp_tpdu_by_handle
dissect_gtp_tpdu_as_pdcp_lte_info
dissect_gtp_tpsu_as_pdcp_nr_info
Note: The original code function is not changed.
2022-04-21 17:30:25 +00:00
Gerald Combs a73fd872ad dfilter: Add a null check.
Try to fix

*** CID 1504179:  Null pointer dereferences  (FORWARD_NULL)
/builds/wireshark/wireshark/epan/dfilter/dfvm.c: 327 in dfvm_dump_str()
321     				stack_print = dump_str_stack_push(stack_print, arg1_str);
322     				break;
323
324     			case STACK_POP:
325     				wmem_strbuf_append_printf(buf, "%05d STACK_POP\t%s\n", id, arg1_str);
326     				for (i = 0; i < arg1->value.numeric; i ++) {
>>>     CID 1504179:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "stack_print" to "dump_str_stack_pop", which dereferences it.
327     					stack_print = dump_str_stack_pop(stack_print);
328     				}
329     				break;
330
331     			case MK_RANGE:
332     				wmem_strbuf_append_printf(buf, "%05d MK_RANGE\t\t%s[%s] -> %s\n",
2022-04-21 17:10:44 +00:00
Gerald Combs 51f5bdc287 FPP: Add null pointer checks.
Add a couple of null pointer checks. Followup to #18043.
2022-04-21 16:49:22 +00:00
Gerald Combs 88f07ff5d1 epan: Add a null conversation checks.
Check for null conversations in conversation_add_proto_data,
conversation_get_proto_data, and conversation_delete_proto_data.
Document them as well. Ping #18043.
2022-04-21 16:27:43 +00:00
Dario Lombardo f067e40166 fpp: check conversation pointer before use.
Fix: #18043.
2022-04-21 16:05:08 +00:00
Yu Gao 49ec7da90e fix pipeline issue 2022-04-21 15:20:34 +00:00
Dylan Ulis 2f41595382 CIP Safety: Fix CRC logic when timestamp rolls over to zero 2022-04-21 15:02:25 +00:00
John Thacker 45da161430 libgcrypt: Remove HAVE_GCRYPT_AEAD , _CHACHA20
Libgcrypt 1.8.0 is required now, so these are always defined.
2022-04-21 07:11:32 -04:00
John Thacker b80cdaa243 libgcrypt: Require version 1.8.0
Libgcrypt 1.8.x is required for a large amount of decryption
support and is the current LTS version of libgcrypt. The 1.6 and
1.7 series have been end-of-life since 2017-06-30 and 2019-06-30,
respectively.

The Linux distributions that have versions of libgcrypt before 1.8.0
are nearing or at end of support (RHEL7, SLES 12, Debian stretch,
Ubuntu 16.04LTS) and can be supported by the Wireshark 3.6 LTS release
series.

Remove an enormous amount of ifdefs based on libgcrypt versions
1.6.0, 1.7.0, and 1.8.0. There will be a second pass for the
commons defines HAVE_LIBGCRYPT_AEAD, HAVE_LIBGCRYPT_CHACHA20, and
HAVE_LIBGCRYPT_CHACHA20_POLY1305, which are now always defined.

The ISAKMP dissector has some comments noting that some workarounds
were used for libgcrypt 1.6 that aren't needed with 1.7; perhaps
that could be updated now.
2022-04-20 21:30:21 -04:00
John Thacker 7a97a1dc22 epan: Add comments about _get_parent, _set_len and faked items
If we're faking items, then proto_[item|tree]_get_parent[_nth] return
the parent of the faked item, which may not be what we want. We have
no way of knowing if the logical item meant was the faked item itself
or one of its children that share the same proto_item when faked.

Thus we don't know if we should return the proto_item itself or its
parent when called on a possibly faked item. Most of the time we will
be adding new items to what we return here, which means not faking items
that could be faked (since we might be returning the root node, which
doesn't have a field_info), hurting performance (see #8069).

It can also have some unusual effects on the protocol hierarchy stats,
particularly if we change things so that non-visible items can change
their length, which has a similar issue. (#17877)
2022-04-20 21:30:34 +00:00
Andoni Diaz de Cerio 373280bc65 MIKEY: Register the application/mikey MIME type 2022-04-20 08:30:13 +00:00
Vahap Emin Agaogullari b51c70ae11 LLDP: Profinet TSN TLV Dissection
Profinet TSN TLV Dissection implemented
2022-04-20 07:44:57 +00:00
Alexis La Goutte 26be00e320 ieee80211: Fix clang analyzer warning (Dead.Store)
also indent
2022-04-20 07:25: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
Dario Lombardo 33dca395b1 aprs: NULL-terminate a string.
CID: 1495842
2022-04-19 20:45:24 +00:00
Dario Lombardo 6c3e4c7304 enip: init address on declaration.
CID: 1499496
2022-04-19 20:45:24 +00:00
Dario Lombardo 7cbb6e9a76 dissectors: init memory before use.
CID: 52571445-27
2022-04-19 20:45:24 +00:00
Alexis La Goutte e4c46563fb QUIC: Add IMMEDIATE_ACK from ACK Frequency Draft
https://datatracker.ietf.org/doc/html/draft-ietf-quic-ack-frequency#section-6
2022-04-19 18:45:43 +00:00
Alexis La Goutte 69637a731d QUIC: Update to last ACK Frequency draft(-01) 2022-04-19 18:45:42 +00:00
Martin Mathieson 58821b50b5 PDCP-NR: changes to make security keys work better 2022-04-19 15:13:51 +00:00
John Thacker 371b52120b ipp: Use proto_tree_get_parent
It's a little cleaner to use the API to do the same thing, in case
something changes internally.
2022-04-19 13:19:39 +00:00
Andoni Diaz de Cerio d2335dd414 XML: Adding new 3GPP Mission Critical XML media types
Some 3GPP MCS XML media types were not decoded correctly as XML
2022-04-19 12:52:47 +00:00
Pascal Quantin 43828765c3 NR RRC: upgrade dissector to v16.8.0 2022-04-19 12:39:03 +02:00
Pascal Quantin 58af12cac7 LTE RRC: upgrade dissector to v16.8.0 2022-04-19 09:22:58 +00:00
Pascal Quantin 5c7c723feb LPP: upgrade dissector to v16.8.0 2022-04-19 10:05:41 +02:00
João Valverde fab32ea0cb dfilter: Allow arithmetic expressions as function arguments
This allows writing moderately complex expressions, for example
a float epsilon test (#16483):

Filter: {abs(_ws.ftypes.double - 1) / max(abs(_ws.ftypes.double), abs(1))} < 0.01

Syntax tree:
 0 TEST_LT:
   1 OP_DIVIDE:
     2 FUNCTION(abs#1):
       3 OP_SUBTRACT:
         4 FIELD(_ws.ftypes.double)
         4 FVALUE(1 <FT_DOUBLE>)
     2 FUNCTION(max#2):
       3 FUNCTION(abs#1):
         4 FIELD(_ws.ftypes.double)
       3 FUNCTION(abs#1):
         4 FVALUE(1 <FT_DOUBLE>)
   1 FVALUE(0.01 <FT_DOUBLE>)

Instructions:
00000 READ_TREE		_ws.ftypes.double -> reg#1
00001 IF_FALSE_GOTO	3
00002 SUBRACT		reg#1 - 1 <FT_DOUBLE> -> reg#2
00003 STACK_PUSH	reg#2
00004 CALL_FUNCTION	abs(reg#2) -> reg#0
00005 STACK_POP	1
00006 IF_FALSE_GOTO	24
00007 READ_TREE		_ws.ftypes.double -> reg#1
00008 IF_FALSE_GOTO	9
00009 STACK_PUSH	reg#1
00010 CALL_FUNCTION	abs(reg#1) -> reg#4
00011 STACK_POP	1
00012 IF_FALSE_GOTO	13
00013 STACK_PUSH	reg#4
00014 STACK_PUSH	1 <FT_DOUBLE>
00015 CALL_FUNCTION	abs(1 <FT_DOUBLE>) -> reg#5
00016 STACK_POP	1
00017 IF_FALSE_GOTO	18
00018 STACK_PUSH	reg#5
00019 CALL_FUNCTION	max(reg#5, reg#4) -> reg#3
00020 STACK_POP	2
00021 IF_FALSE_GOTO	24
00022 DIVIDE		reg#0 / reg#3 -> reg#6
00023 ANY_LT		reg#6 < 0.01 <FT_DOUBLE>
00024 RETURN

We now use a stack to pass arguments to the function. The
stack is implemented as a list of lists (list of registers).
Arguments may still be non-existent to functions (this is
a feature). Functions must check for nil arguments (NULL lists)
and handle that case.

It's somewhat complicated to allow literal values and test compatibility
for different types, both because of lack of type information with
unparsed/literal and also because it is an underdeveloped area in the
code. In my limited testing it was good enough and useful, further
enhancements are left for future work.
2022-04-18 17:10:31 +01:00
João Valverde 92c1519dfe dfilter: Add float multiplication/division 2022-04-18 17:09:05 +01:00
João Valverde eb2a9889c3 dfilter: Add abs() function
Add an absolute value function for ftypes.
2022-04-18 17:09:00 +01:00
Richard Sharpe 8889d8c78b ieee80211: Implement more KDEs from ieee802.11-2016 and on.
I have picked up more KDEs from ieee802.11-2016 and Draft P802.11REVmd_D5.0
and Draft P802.11be_D1.4.
2022-04-17 23:59:26 +00:00
Gerald Combs bce8825df8 [Automatic update for 2022-04-17]
Update manuf, services enterprise numbers, translations, and other items.
2022-04-17 16:37:54 +00:00
Ahmet Alperen Bulut d66c29ab07 IEEE1905: Fix CAC Termination Request's offset calculation
Fixes #18042
2022-04-17 08:49:59 +00:00
Andrii Vladyka f4c7bd9c75 DOCSIS: Fixed RNG-RSP Commanded Power Sub-TLVs dissection 2022-04-16 20:22:53 +00:00
Benedikt Heumüller 90c784bd97 fpp: Fix mCRC calculation
Conversations start at SMD-S and are continued with SMD-C frames
Added CRC information to proto_data of conversation for mCRC calculation
Continue checksum calculation for faulty fragments
Reassembly information added to info column
Reworked packet_direction
2022-04-16 18:46:05 +00:00
Alexis La Goutte 83959f77e3 dfvm: Fix Dead Store found by Clang Analyzer 2022-04-16 18:15:45 +00:00
Arne Schwabe c2c20a6f2d Implement parsing of OpenVPN tls-crypt packets
This implements parsing the packets in tls-crypt mode. Parsing is very
limited since tls-crypt encrypts the packets. Since detecting tls-crypt
is not easy apart from two tls-crypt-v2 specific opcodes, it is preference
that needs explicitly set.
2022-04-16 13:40:15 +00:00
Dylan Ulis 88719f0884 CIP Safety: Minor Refactoring, Part 2 2022-04-16 06:57:13 +00:00
João Valverde af878388fe dfilter: Fix scanning of strings
The code was ignoring a SCAN_FAILED return value.
2022-04-15 22:51:15 +01:00
Gerald Combs e364444b24 wslua: Update the menu group documentation.
Update to match ca04f4c8cb.
2022-04-15 21:30:50 +00:00
easonweii b4a15f8be3 BER: Add the length check of dissecting BER integers, int64, and booleans
Add the length check of dissecting BER integers, int64, and booleans, the expert info is added for bad lengths, includes the name of the field and actual length.
Related to #18005
2022-04-15 11:56:17 +00:00
Chuck Craft 98793186b9 CQL: format timestamp as microseconds (ENC_TIME_USECS)
Closes #18038
2022-04-14 19:08:55 +00:00
Gerald Combs b51a635bce BACapp: Fix a recusion check.
Make sure fAbstractSyntaxNType() always decrements its proto_depth on
exit. Fixes #18039.

Remove a no-longer-needed p_add_proto_data() call.
2022-04-14 18:16:42 +00:00
Chuck Craft 4e0cd3dbd2 epan: add ENC_TIME_USECS timestamp encoding
Needed to format timestamp in #18038 - packet-cql.c
Mirrors changes made in !1924 - Add ENC_TIME_NSECS timestamp encoding
Documentation in README.dissector, proto.c, proto.h - could use
refresh in a different merge request.
2022-04-14 15:18:30 +00:00
João Valverde 827d143e6e dfilter: Allow function arguments to be non-existent.
Instead of not calling the function if an argument is non-existent
(read tree fails), call the function and let the function handle
the condition.
2022-04-14 13:07:41 +00:00
João Valverde cb2f085f14 dfilter: Add max() and min() functions
Changes the function calling convention to pass the first register
number plus the number of registers after that sequentially. This
allows function with any number of arguments. Functions can still
only return one value.

Adds max() and min() function to select the maximum/minimum value
from any number of arguments, all of the same type. The functions
accept literals too. The return type is the same as the first argument
(cannot be a literal).
2022-04-14 13:07:41 +00:00
Dylan Ulis 943c38d606 CIP Safety: Minor Refactoring, Part 1 2022-04-13 20:48:41 +00:00
Dylan Ulis 3c25b69ff6 CIP: Correct DATE, DATE_AND_TIME type handling, Part 2 2022-04-13 20:22:29 +00:00
Dylan Ulis 234db3b48f CIP Safety: Display human readable timestamps 2022-04-13 20:04:40 +00:00
Pascal Quantin 50ada3d65c NGAP: workaround a gcc 10.2.1 compilation issue
Fixes #17858
2022-04-13 16:58:54 +02:00
John Thacker 01239eb59d whois: Assume UTF-8, add an expert info
Move the assumption for WHOIS responses to UTF-8 (which is backwards
compatible with ASCII), and add an expert info regarding that
assumption. There is no indication for encoding in the protocol.
Using Show Packet Bytes is sufficient for most purposes, but someone
could add a preference if desired.
2022-04-13 12:29:12 +00:00
Gerald Combs ca04f4c8cb Qt: Update our dynamic menu groups.
Add log-specific statistics groups, and use them to limit the dynamic
menu items in Wireshark and Logwolf.
2022-04-12 12:14:03 -07:00
João Valverde 8746eea297 dfilter: Try to resolve field reference instead of using a heuristic
Instead of using a heuristic to decide whether the form ${...} is
a macro or not, try to resolve the name to a registered protocol
field and use that instead.

This increases somewhat the surface for clobbering existing macro
names with new field registrations but we'll cross that bridge when
we get to it.

Rejecting protocol field types reduces this probability again but it
may not be intuitive to the user trying to mistakenly use a reference
to a protocol why it is parsed as a macro. The reasons for rejecting
FT_PROTOCOL types as not interesting field references are not
very strong but it seems reasonable.

$ dftest 'frame.number != ${frame.number}'
Filter: frame.number != ${frame.number}

Instructions:
00000 READ_TREE		frame.number -> reg#0
00001 IF_FALSE_GOTO	5
00002 READ_REFERENCE	${frame.number} -> reg#1
00003 IF_FALSE_GOTO	5
00004 ALL_NE		reg#0 != reg#1
00005 RETURN

$ dftest 'frame != ${frame}'
dftest: macro 'frame' does not exist
2022-04-12 14:03:18 +00:00
John Thacker 4c7865c81b whois, finger: Dissect at FIN (or after) on first pass
The WHOIS and finger dissectors wait to dissect at FIN, but they
need to actually dissect at FIN (or at reassembled out of order
segments after FIN) on the first pass instead of returning without
dissecting.

Only add data reassembled at FIN to the tree if it was actually
reassembled at the FIN frame; if it was reassembled in the first pass
at a later frame due to out of order segments, it will be added there.

In addition to fixing first pass dissection, this also fixes the
case where the FIN segment is the first segment with data. Fix #18037.
2022-04-12 08:29:48 -04:00
Chuck Craft 3aee6ce9d6 ACN/rdmnet: add protocol check to TCP heuristic 2022-04-12 09:29:47 +00:00
João Valverde 03e41d4950 ftypes: Fix a macro argument 2022-04-12 09:41:58 +01:00
Anders Broman 096947337e PER:Add function to add "PER encoded lable" to the tree. 2022-04-12 08:33:36 +02:00
João Valverde 09696f1762 Try to fix a narrowing warning
"C:\Development\wsbuild64\Wireshark.sln" (default target) (1) ->
"C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj.metaproj" (default target) (18) ->
"C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj" (default target) (108) ->
       (ClCompile target) ->
C:/Development/wireshark/epan/dfilter/scanner.l(463,54): warning C4267: '+=': conversion from 'size_t' to 'int
       ', possible loss of data [C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj]
C:/Development/wireshark/epan/dfilter/scanner.l(463,54): warning C4267:         state->location.col_start += sta
       te->location.col_len; [C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj]
C:/Development/wireshark/epan/dfilter/scanner.l(463,54): warning C4267:
                           ^ (compiling source file C:\Development\wsbuild64\epan\dfilter\scanner.c) [C:\Development\ws
       build64\epan\dfilter\dfilter.vcxproj]
2022-04-11 22:23:13 +01:00
João Valverde 2f02cd6e19 dfilter: Handle missing error location more gracefully
If we don't have an offset, don't print anything with underline.

Also it can underline filters using macros correctly now.

$ tshark -Y 'ip and ${private_ipv4:ip.sr}' -r /dev/null
tshark: Left side of "==" expression must be a field or function, not "ip.sr".
    ip and ip.sr == 192.168.0.0/16 or ip.sr == 172.16.0.0/12 or ip.sr == 10.0.0.0/8
           ^~~~~
2022-04-11 21:03:06 +00:00
Yu Gao ceef8aa8ee fix the indent 2022-04-11 19:39:11 +00:00
João Valverde 24443fa33a tshark: Add underline to dfilter errors
$ tshark -Y 'frame.number == 123foobar and ip' -r /dev/null
tshark: "123foobar" is not a valid number.
    frame.number == 123foobar and ip
                    ^~~~~~~~~
2022-04-11 19:25:37 +00:00
Gerald Combs 4b556d6bc6 Qt+epan: Get log conversation filters working.
In conversation_filter.h, add a separate log_conv_filter_list. Use it in
register_log_conversation_filter and add conversation_filter_from_log.
It looks like we no longer use find_conversation_filter externally, so
remove it from the API.
2022-04-11 17:26:50 +00:00
Gerald Combs 1c9538624f [Automatic update for 2022-04-10]
Update manuf, services enterprise numbers, translations, and other items.
2022-04-10 19:23:47 +00:00
João Valverde 4d9470e7dd dfilter: Add location tracking to scanner and use it to report errors
Add location tracking as a column offset and length from offset
to the scanner. Our input is a single line only so we don't need
to track line offset.

Record that information in the syntax tree. Return the error location
in dfilter_compile(). Use it in dftest to mark the location of the
error in the filter string. Later it would be nice to use the location
in the GUI as well.

$ dftest "ip.proto == aaaaaa and tcp.port == 123"
Filter: ip.proto == aaaaaa and tcp.port == 123
dftest: "aaaaaa" cannot be found among the possible values for ip.proto.
	ip.proto == aaaaaa and tcp.port == 123
	            ^~~~~~
2022-04-10 10:09:51 +01:00
João Valverde da19379eb5 dfilter: Create the syntax node in the scanner and pass that
Revert to passing a syntax node from the lexical scanner to the grammar
parser. Using a union is not having a discernible advantage and requires
duplicating a lot of properties of syntax nodes.
2022-04-10 09:54:03 +01:00
Matthias Ringwald d23fec2116 bluetooth: show packet status in info column 2022-04-09 22:57:34 +02:00
Matthias Ringwald 50de7dd6ca bluetooth: show SCO packet type in col_protocol 2022-04-09 19:10:44 +02:00
João Valverde fb9a176587 dfilter: Allow grouping arithmetical expressions with { }
This removes the limitation of having only two terms in an
arithmetic expression and allows setting the precedence using
curly braces (like any basic calculator).

Our grammar currently does not allow grouping arithmetic expressions
using parenthesis, because boolean expressions and arithmetic
expressions are different and parenthesis are used with the former.
2022-04-08 23:12:04 +01:00
Pascal Quantin b7ba126644 F1AP: upgrade dissector to v16.9.0 2022-04-08 16:41:20 +00:00
Pascal Quantin ab71cb51ff XnAP: id-TargetNodeID is a protocol IE 2022-04-08 16:11:40 +00:00
Pascal Quantin 894762b654 X2AP: fix a typo 2022-04-08 15:42:00 +00:00
Pascal Quantin 82f268789c E1AP: upgrade dissector to v16.9.0 2022-04-08 17:12:15 +02:00
Pascal Quantin 3bf9bc6326 XnAP: upgrade dissector to v16.9.0 2022-04-08 16:45:15 +02:00
Pascal Quantin c9353fdece NGAP: upgrade dissector to v16.9.0 2022-04-08 14:16:59 +00:00
Pascal Quantin 4b42dcf3c0 X2AP: upgrade dissector to v16.9.0 2022-04-08 13:46:58 +00:00
Pascal Quantin e101aa6e78 S1AP: upgrade dissector to v16.9.0 2022-04-08 15:22:29 +02:00
Joel Colledge ddbafcd9ba DRBD: Add support for dissecting DRBD on InfiniBand
InfiniBand and RDMA over Converged Ethernet (RoCE) are handled by the
infiniband dissector. Register DRBD as a dissector for infiniband
payloads.

Not yet implemented:
* Dissection of data payloads. For P_DATA and similar packets, the data
  payload is transmitted over multiple packets. Only the first packet
  containing the DRBD header is dissected.
* Dissection of the InfiniBand Immediate Data. DRBD uses this for
  sequence numbers and for indicating which stream the packet belongs
  to.
* Any attempt to associate packets into conversations. This could be
  achieved when the connection packets have been captured, but would be
  very difficult otherwise.
* An association with infiniband.cm.req.serviceid.dport. When using
  RoCE, this is the port that the user specifies for the connection, so
  it would be useful to associate it with the DRBD conversation and show
  it. Otherwise it is tricky to identify DRBD connections.
2022-04-07 19:13:14 +00:00
Thomas Jansen aac695d62e icmpv6: Fix dissection of PREF64 option for shorter prefixes
RFC 8781 shows in section 4 that the prefix field of the PREF64 option
header is always 96 bits (or 12 bytes), regardless of the prefix length
code that only specifies which parts of the prefix are significant. The
option itself thus always has a fixed length. Even if they are not used
in the significant part of the prefix itself, the unused bits are still
part of the prefix field of the PREF64 option and the offset must be
adapted accordingly.

The previous implementation would fail to correctly parse any PREF64
option with a PLC other than 0 (i.e. the full 96 bits) due to the unused
remaining bits in the option not being consumed.

Closes #18033.
2022-04-07 09:09:36 +00:00
Stig Bjørlykke bcb992c4fb nas_eps: Fix typo in function name
Fix typo in dissect_nas_eps_esm_msg().
2022-04-07 07:13:00 +00:00
Richard Sharpe 34f8420d1e ieee80211: Correct the dissection of the 802.11ax Capabilities device class.
The numbers were reversed.

Closes #18030
2022-04-06 18:31:50 -07:00
Matthias Ringwald c3c94ff4fd Bluetooth: print event code for unknown HCI events 2022-04-06 23:35:33 +00:00
João Valverde cc5726b63f dfilter: Remove leading colon special meaning
Instead of saying a leading colon will make any token a literal
value, say it is part of the syntax of bytes arrays. This is
useful to write bytes without a separator, and other potentially
ambiguous formats.

The restriction in meaning to bytes and simple numeric values
should make the rules for handling a leading colon (specifically
ommiting it or not) saner without much loss of functionality.
2022-04-07 00:16:07 +01:00
João Valverde 0313cd02bc dfilter: Fix RHS bias for literal values
Fixes a3b76138f0.
2022-04-06 23:46:22 +01:00
João Valverde 7429832db4 Fix a log message 2022-04-06 23:42:04 +01:00
Jaap Keuter 8d646c1657 DHCPv6: Fix interpretation of user class data length fields
Closes #18032
2022-04-06 19:11:58 +00:00
Jorge Mora d681da2534 IWARP_DDP_RDMAP: add MPA error codes given by RFC6581 2022-04-06 18:55:55 +00:00
Jorge Mora c59315c45a IWARP_DDP_RDMAP: add MPA error codes given by RFC5044
Add error type name mapping for the LLP (Lower Layer Protocol).
Add error code name mapping for the MPA Error type.
2022-04-06 18:55:55 +00:00
Jorge Mora 6630bee851 IWARP_DDP_RDMAP: fix error codes for RDMA layer
Display the error code name only if it is not an RDMA Local
Catastrophic error type.
2022-04-06 18:55:55 +00:00
Jorge Mora d4cfae1b72 IWARP_DDP_RDMAP: change Terminate header bits to set-notset 2022-04-06 18:55:54 +00:00
Jorge Mora 72b44d13ea IWARP_DDP_RDMAP: fix Terminate opcode tree hierarchy
The Terminate Control tree should be under the Terminate tree.
2022-04-06 18:55:54 +00:00
Jorge Mora 63c1b032c8 IWARP_DDP_RDMAP: fix Terminate layer name mapping 2022-04-06 18:55:54 +00:00
João Valverde 5584aba326 dfilter: Fix slice using range [:j]
Fixes:

$ dftest 'frame[:10] contains 0xff'
dftest: ":10" is not a valid range.
2022-04-06 18:35:10 +01:00
João Valverde a6f37323e6 dfilter: Clean up lexical scanning 2022-04-06 18:11:27 +01:00
João Valverde 8108e67de7 dfilter: Fix memory leak with leading colon
When retrying fvalue_from_literal() we were leaking the error
message string.

Refactor the code to avoid the retry. This assumes the only
valid use of a leading ':' with a literal is for an IPv6 address.

Bytes with leading ':' are supported but the colon is skipped,
so the parser doesn't see it.

Fixes df0fc8b517.
2022-04-06 18:09:12 +01:00
John Thacker c2e1ee2e57 tcp: Rework out of order dissection to dissect sooner
Rework the out of order dissection to store the out of order
segments and add them to reassemblies only after the gaps are filled.
This allows reassembly of contiguous segments to be dissected when
they can, instead of having to wait for all segment gaps to be
filled. In cases where a segment has an erroneous later sequence number,
this prevents reassembly from being completely halted.

It is now guaranteed that when the subdissector is called that the
segment from the current frame is either the first segment of the
MSP or has bytes that were requested from the last call of the
subdissector. This makes it easier to split MSPs in a later commit.
MSPs now always have the first segment with the sequence number,
so MSP_FLAGS_MISSING_FIRST_SEGMENT and first_frame_with_seq are
obsolete and can be removed later.

This fixes a long standing TODO in the out of order test in
suite_dissection.py

Dissection is more consistent between the first pass and later
passes, though there is more to be done.
2022-04-06 08:41:58 -04:00
John Thacker 444e3f230c tcp reassembly: Add fragment_add_out_of_order 2022-04-06 07:53:02 -04:00
John Thacker 4e184104af exceptions: Add an expert warning for FragmentBoundsError
FragmentBoundsErrors aren't malformed, but add an expert warning
at the PI_NOTE level to hint to users that they may want to turn
on reassembly preferences.
2022-04-06 07:17:14 -04:00
João Valverde 12c8cc32f0 dfilter: Fix parsing of some IPv6 compressed addresses
Fix parsing of some IPv6 addresses and add tests.

Also pass tokens as unparsed unless the user was specfic about
the semantic type. For example the IPv4 address 1.1.1.1 is also a
valid field, but 1.1.1.1/128 is not (because of the slash). However
choose not to enforce the distinction in the lexical scanner and pass
everything as unparsed unless the meaning is explicit in the syntax
with leading dot, colon, or between angle branckets.
2022-04-06 10:10:04 +01:00
Maxim Sharabayko 0e269659ec srt: added reference to the internet draft 2022-04-06 05:52:10 +00:00
John Thacker f5567200fa tcp: Mark unreassembled PDUs as fragmented in tcp_dissect_pdus
PDUs on TCP streams can fail to be reassembled for a variety of reasons,
most of which can be determined by the TCP dissector before calling
a subdissector.  However, individual subdissectors can have their own
preference indicating not to desegment, and this cannot be handled until
the subdissector calls tcp_dissect_pdus(). Fix #18027.
2022-04-06 00:04:19 -04:00
João Valverde b4a0b30f88 Regenerate ASN.1 dissectors 2022-04-05 23:14:16 +01:00
João Valverde 7ed5d5036e dfilter: restore support for identifiers using hyphen
Restores support for filters such as "mac-lte", that was broken
in 330d408328.

This means we are not able to support arithmetic expressions with binary
minus without spaces.

$ dftest 'tcp.port == 1-2'
dftest: "1-2" is not a valid number.
2022-04-05 15:38:20 +01:00
Richard Sharpe 454552c149 ieee80211: Conform to ieee802.11-2016 for the Capability Info field.
The format and meaning of the bits in the Capability information field
has been different than what was implemented since at least 802.11-2016.

Defined in 9.4.1.4 Capability Information field.
2022-04-05 13:24:58 +00:00
João Valverde 8fb28f5161 dfilter: Minor grammar cleanup
Remove duplication for arithmetic expressions.
2022-04-05 12:04:37 +01:00
João Valverde 20afbd46ec dfilter: Remove existence test syntax tree nodes
After some experimentation I don't think these two existence tests
belong in the grammar, it's an implementation detail and removing it
might avoid some artificial constraints.
2022-04-05 12:04:37 +01:00
João Valverde fb08c4b4a8 dfilter: Replace bitwise sttype with arithmetic
Most of the bitwise codepaths are just duplicating code for
the arithmetic type. Parse bitwise expressions as arithmetic
instead.
2022-04-05 12:04:37 +01:00
João Valverde c98df5eef5 dfilter: Print syntax tree using dftest + format enhancements
Add argument to dfilter_compile_real() to save syntax tree text
representation.

Use it with dftest to print syntax tree.

Misc debug output format improvements.
2022-04-05 12:04:37 +01:00
João Valverde d91734ab6a dfilter: Fix range registers in DFVM dump 2022-04-05 12:04:37 +01:00
Ahmet Alperen 498760b628 IEEE1905: Fix miscalculated offset 2022-04-05 03:28:50 +00:00
Chuck Craft 49c434d012 BER: breakout multi-octet length field 2022-04-05 02:27:00 +00:00
João Valverde 330d408328 dfilter: Allow arithmetic expressions without spaces
To allow an arithmetic expressions without spaces, such as "1+2",
we cannot match the expression in other lexical rules using "+". Because
of longest match this becomes the token LITERAL or UNPARSED with semantic value
"1+2". The same goes for all the other arithmetic operators.

So we need to remove [+-*/%] from "word chars" and add very specific
patterns (that won't mistakenly match an arithmetic expression) for
those literal or unparsed tokens we want to support using these characters.
The plus was not a problem but right slash is used for CIDR, minus for
mac address separator, etc.

There are still some corner case. 11-22-33-44-55-66 is a mac
address and not the arithmetic expression with six terms "eleven
minus twenty two minus etc." (if we ever support more than two terms
in the grammar, which we don't currently).

We lift some patterns from the flex manual to match on IPv4 and
IPv6 (ugly) and add MAC address.

Other hypothetical literal lexical values using [+-*/%] are already
supported enclosed in angle brackets but the cases of MAC/IPv4/IPv6 are
are very common and moreover we need to do the utmost to not break backward
compatibily here.

Before:
    $ dftest "_ws.ftypes.int32 == 1+2"
    dftest: "1+2" is not a valid number.

After:
    $ dftest "_ws.ftypes.int32 == 1+2"
    Filter: _ws.ftypes.int32 == 1+2

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 -> reg#0
    00001 IF_FALSE_GOTO	4
    00002 ADD		1 <FT_INT32> + 2 <FT_INT32> -> reg#1
    00003 ANY_EQ		reg#0 == reg#1
    00004 RETURN
2022-04-04 20:28:55 +00:00
João Valverde 34ad6bb478 dfilter: Make logical AND higher precedence than logical OR
In most, if not all, programming languages logical AND has
higher precedence than logical OR. Apply the principle of
least surprise and do the same for Wireshark display
filters.

Before: ip and tcp or udp => ip and (tcp or udp)

    Filter: ip and tcp or udp

    Instructions:
    00000 CHECK_EXISTS	ip
    00001 IF_FALSE_GOTO	5
    00002 CHECK_EXISTS	tcp
    00003 IF_TRUE_GOTO	5
    00004 CHECK_EXISTS	udp
    00005 RETURN

After: ip and tcp or udp => (ip and tcp) or udp

    Filter: ip and tcp or udp

    Instructions:
    00000 CHECK_EXISTS	ip
    00001 IF_FALSE_GOTO	4
    00002 CHECK_EXISTS	tcp
    00003 IF_TRUE_GOTO	5
    00004 CHECK_EXISTS	udp
    00005 RETURN
2022-04-04 19:51:38 +00:00
Martin Mathieson ffba3dd487 RLC-NR: Don't overwrite SDAP config from RRC with 0. 2022-04-04 10:50:28 +00:00
João Valverde 70582b84f6 dfilter: Allow parsing binary number as a byte array of len 1
Before:

    Filter: eth[0] == 0b00110011

    Instructions:
    00000 READ_TREE		eth -> reg#0
    00001 IF_FALSE_GOTO	4
    00002 MK_RANGE		reg#0[reg#1] -> 0:1
    00003 ANY_EQ		reg#1 == 0b:00:11:00:11 <FT_BYTES>
    00004 RETURN

After:

    Filter: eth[0] == 0b00110011

    Instructions:
    00000 READ_TREE		eth -> reg#0
    00001 IF_FALSE_GOTO	4
    00002 MK_RANGE		reg#0[reg#1] -> 0:1
    00003 ANY_EQ		reg#1 == 33 <FT_BYTES>
    00004 RETURN
2022-04-04 02:02:58 +00:00
João Valverde fbd32cf853 Replace g_log() calls with ws_log() 2022-04-04 01:33:58 +00:00
John Thacker ac7583c065 tpkt+rdp: Add a heuristic dissector for TPKT for RDP
Port 3389 is IANA assigned for RDP, but on TCP it can appear over
TPKT with or without underlying TLS, depending on the RDP Security
Settings. Add a heuristic dissector for TPKT. The heuristic is a
little weak so disable it by default for the general case, but
register it as a PINO specifically for the IANA assigned port.

On port 3389, by default Wireshark now tries heuristics for TPKT
and TLS (ordering depending on whether "Try heuristic sub-dissectors
first" is enabled for TCP). Once it finds a packet that passes
the heuristics, it sets the conversation dissector and from then
on will desegment/report Continuation Data as appropriate. This
is nicer than having to manually configure Decode As for RDP
standard encryption (without TLS). Related to #17952, #17437.
2022-04-03 19:02:47 +00:00
Gerald Combs 381ba88152 [Automatic update for 2022-04-03]
Update manuf, services enterprise numbers, translations, and other items.
2022-04-03 16:43:35 +00:00
Stig Bjørlykke 16871f66d7 coap: Change text format used in COL_INFO
Change to use format_text() and format_text_string() on strings
used in COL_INFO to explicitly show '\n' and such.
2022-04-03 12:07:33 +02:00
João Valverde f0ca30b60b dfilter: More arithmetic fixes
Fix a failed assertion with constant arithmetic expressions.

Because we do not parse constants on the lexical level it is
more complicated to handle constant expressions with unparsed
values.

We need to handle missing type information gracefully for any
kind of arithmetic expression, not just unary minus.
2022-04-02 18:10:33 +00:00
Martin Mathieson 6065552dd4 Skinny: revert previous change 2022-04-02 15:05:40 +00:00
John Thacker 6dfd96f6fe rdp: Register RDP as a TLS subdissector for port 3389 directly
ssl_dissector_add registers TLS as the dissector for TCP for the given
port. We can't use it, since on port 3389 TPKT (for RDP) can be over TLS
or directly over TCP, depending on the RDP security settings.
Fix #17952.
2022-04-02 07:47:07 -04:00
Martin Mathieson cf629e2547 ZBNCP: Fix some filter names. 2022-04-02 11:21:14 +00:00
Dylan Ulis 436abf4cf7 CIP: Show Attribute ID as decimal 2022-04-01 20:01:53 +00:00
Nan Xiao 1997a86634 EVS: Refactor dissecting compact format code 2022-04-01 19:32:34 +00:00
João Valverde 67e5e5c3ab dfilter: Fix arithmetic expressions on the LHS
Filter: _ws.ftypes.framenum % 3 == 0

Instructions:
00000 READ_TREE		_ws.ftypes.framenum -> reg#0
00001 IF_FALSE_GOTO	4
00002 MODULO		reg#0 % 3 <FT_FRAMENUM> -> reg#1
00003 ANY_EQ		reg#1 == 0 <FT_FRAMENUM>
00004 RETURN
2022-04-01 14:33:38 +01:00
John Thacker 856cd96bb3 http2: Use the actual maximum table size for partial header workaround
Use the actual maximum table table size, which may have been set to
a value other than the default 4096, to fill the table with dummy
entries. Fix #17936
2022-04-01 12:10:48 +00:00
Stig Bjørlykke e6202cf1d9 coap: Format text used in COL_INFO
Use format_text_wsp() on strings from packet used in COL_INFO to
show non-printable characters as C-style escapes.
2022-04-01 12:42:58 +02:00
Dylan Ulis f23a774819 CIP: Correct DATE type handling 2022-04-01 07:13:56 +00:00
João Valverde a81617fda5 Fix build on CentOS 7
CentOS 7 has an old version of GCC that lacks support for C11
macro generics.
2022-03-31 19:48:48 +00:00
Dror Eiger af716cdb4a Geneve: add parsing of GCP options 2022-03-31 19:05:56 +00:00
João Valverde 8bc214b5bb dfilter: Add remaining arithmetic integer ops 2022-03-31 16:49:42 +01:00
Nardi Ivan 85aa5939f1 NNTP: fix indentation 2022-03-31 15:21:02 +02:00
Nardi Ivan 88840f61a2 NNTP: add support for STARTTLS
Close #18020
2022-03-31 15:04:58 +02:00
Roman Volkov 59bd93413a mpeg table: fix, shows a CRC32 field for an empty PAT 2022-03-31 11:07:14 +00:00
João Valverde 2a9cb588aa dfilter: Add binary arithmetic (add/subtract)
Add support for display filter binary addition and subtraction.

The grammar is intentionally kept simple for now. The use case
is to add a constant to a protocol field, or (maybe) add two
fields in an expression.

We use signed arithmetic with unsigned numbers, checking for
overflow and casting where necessary to do the conversion.
We could legitimately opt to use traditional modular arithmetic
instead (like C) and if it turns out that that is more useful for
some reason we may want to in the future.

Fixes #15504.
2022-03-31 11:27:34 +01:00
Martin Mathieson ae537e24f0 Skinny: Set some masks to match boolean field width 2022-03-30 20:44:39 +01:00
João Valverde 5cd0e4cc97 dfilter: Fix use after free with references
By the time we are using the reference fvalue the tree may have gone
away and with it the fvalue. We need to duplicate the reference
fvalues and take ownership of the memory.
2022-03-30 14:05:22 +01:00
João Valverde 9ab2837637 dfilter: Add fvalue duplicate method 2022-03-30 14:05:22 +01:00
Alexis La Goutte 19c0e83d8b quic: add missing draft uri for quic cibir TP 2022-03-30 07:37:48 +00:00
Alexis La Goutte eac578445c QUIC: Add cibir_encoding TP
From  https://datatracker.ietf.org/doc/html/draft-banks-quic-cibir-01
2022-03-30 07:37:48 +00:00
João Valverde 260942e170 dfilter: Refactor macro tree references
This replaces the current macro reference system with
a completely different implementation. Instead of a macro a reference
is a syntax element. A reference is a constant that can be filled
in the dfilter code after compilation from an existing protocol tree.
It is best understood as a field value that can be read from a fixed
tree that is not the frame being filtered. Usually this fixed tree
is the currently selected frame when the filter is applied. This
allows comparing fields in the filtered frame with fields in the
selected frame.

Because the field reference syntax uses the same sigil notation
as a macro we have to use a heuristic to distinguish them:
if the name has a dot it is a field reference, otherwise
it is a macro name.

The reference is synctatically validated at compile time.

There are two main advantages to this implementation (and a couple of
minor ones):

The protocol tree for each selected frame is only walked if we have a
display filter and if the display filter uses references. Also only the
actual reference values are copied, intead of loading the entire tree
into a hash table (in textual form even).

The other advantage is that the reference is tested like a protocol
field against all the values in the selected frame (if there is more
than one).

Currently the reference fields are not "primed" during dissection, so
the entire tree is walked to find a particular reference (this is
similar to the previous implementation).

If the display filter contains a valid reference and the reference is
not loaded at the time the filter is run the result is the same as a
non existing field for a regular READ_TREE instruction.

Fixes #17599.
2022-03-29 12:36:31 +00:00
João Valverde 431cb43b81 dfilter: Remove parenthesis deprecation warning
This usage devalues a mechanism for warning users that deserves more
attention than this minor suggestion.

The warning is inconvenient for intermediate and advanced users.
2022-03-29 12:19:26 +00:00
Joakim Karlsson f401cdeaae asn1: fix missing dissector generation 2022-03-29 12:05:27 +00:00
Anders Broman 2c5f2ac6f3 BER: Add a function to add a BER encoded boilerplate. 2022-03-29 11:23:07 +00:00
Chuck Craft 4476db5798 zigbee/isis-clv/wsdg: depreciate -> deprecate
zigbee per Document 07-5356-19
Unchanged: packet-cfm.c per ITU standard
packet-opa-mad.c - unable to confirm status
2022-03-28 18:20:24 +00:00
João Valverde d2907d91c0 dfilter: Add more logging for bytecode 2022-03-28 17:59:07 +01:00
João Valverde 9ee9b40b64 dfilter: Store expanded text 2022-03-28 17:22:01 +01:00
João Valverde a1299d63d9 dfilter: Lower level of two debug messages 2022-03-28 17:20:00 +01:00
Fabian Viöl b55e012524 uds: Don't append parameter record if not available 2022-03-28 15:29:10 +00:00
João Valverde b9b45a4a8f dfilter: Add ftypes pseudofields
This adds a _ws.ftypes namespace with protocol fields with all
the existing field types.

Currently this is only useful to debug the display filter compiler,
without having to find a real protocol field with the desired type.

Later it may find other uses.
2022-03-28 15:42:32 +01: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
João Valverde ac0a69636b dfilter: Add support for unary arithmetic
This change implements a unary minus operator.

Filter: tcp.window_size_scalefactor == -tcp.dstport

Instructions:
00000 READ_TREE		tcp.window_size_scalefactor -> reg#0
00001 IF_FALSE_GOTO	6
00002 READ_TREE		tcp.dstport -> reg#1
00003 IF_FALSE_GOTO	6
00004 MK_MINUS		-reg#1 -> reg#2
00005 ANY_EQ		reg#0 == reg#2
00006 RETURN

It is supported for integer types, floats and relative time values.
The unsigned integer types are promoted to a 32 bit signed integer.

Unary plus is implemented as a no-op. The plus sign is simply ignored.

Constant arithmetic expressions are computed during compilation.

Overflow with constants is a compile time error. Overflow with
variables is a run time error and silently ignored. Only a debug
message will be printed to the console.

Related to #15504.
2022-03-28 11:20:41 +00:00
Nardi Ivan 3d1b2876dd QUIC: further update of the fields names used in version negotiation
Fix: 4bed80187e
2022-03-27 19:09:02 +00:00
Gerald Combs b05a149acd [Automatic update for 2022-03-27]
Update manuf, services enterprise numbers, translations, and other items.
2022-03-27 16:53:18 +00:00
Gerald Combs 4597cf3b08 AC DR: Fix a couple of shadow variable warnings. 2022-03-27 16:19:10 +00:00
Richard Sharpe f0e4a9960c ieee80211: Handle the case where a Vendor Specific response is not DPP! 2022-03-27 07:22:52 +00:00
Nardi Ivan 4bed80187e QUIC: update the name of a field used in version negotiation (draft-06) 2022-03-26 21:53:58 +00:00
Jaap Keuter 118e45d853 netflow: handle zero length varlen fields
Closes #18010
2022-03-26 19:45:54 +00:00
Richard Sharpe 7680335a5b ieee80211: Handle fragmented DPP Configuration in GAS Comebacks.
These were not being handled properly.
2022-03-26 11:42:01 -07:00
John Thacker d7f3612613 proto: Fix comment on NTP Era 1 Epoch
NTP Era 1 begins on 7 February 2036, 06:28:16 UTC, exactly when
the 64 bit fixed point timestamp rolls over. See RFC 4330/5905 (and
the correct comments later in get_time_value). Fix the comment where
the constant is defined (the value is already correct, however.)
2022-03-25 17:16:54 -04:00
João Valverde a3b76138f0 dfilter: Fix memory leak
Filter: tcp.srcport == udp.port

Instructions:
00000 READ_TREE		tcp.srcport -> reg#0
00001 IF_FALSE_GOTO	5
00002 READ_TREE		udp.port -> reg#1
00003 IF_FALSE_GOTO	5
00004 ANY_EQ		reg#0 == reg#1
00005 RETURN

=================================================================
==180444==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 34 byte(s) in 1 object(s) allocated from:
    #0 0x55f21e4a9ff9  (/home/jpv/projects/wireshark/wireshark/build-asan/run/dftest+0xcdff9)
    #1 0x7f95ea661338  (/usr/lib/libc.so.6+0x82338)

SUMMARY: AddressSanitizer: 34 byte(s) leaked in 1 allocation(s).

Fixes a68b408a9f.
2022-03-25 18:38:11 +00:00
Nan Xiao 47f72e2366 EVS: Support decoding Primary 64.0 kbps packets 2022-03-25 15:15:42 +00:00
Chuck Craft 14bf5bbdf1 wslua: Lua Console - add Clear button; restore print() 2022-03-25 09:47:05 +00:00
Sake Blok 2d8607e7e0 epan: fix a segfault, introduced in !6329 2022-03-25 09:46:47 +00:00
João Valverde 3ac17381a6 ftypes: Fix IPv6 bitwise_and buffer overrun
*** CID 1503219:  Memory - illegal accesses  (OVERRUN)
/builds/wireshark/wireshark/epan/ftypes/ftype-ipv6.c: 142 in bitwise_and()
136
137     	prefix = MIN(a->prefix, b->prefix);	/* MIN() like in IPv4 */
138     	prefix = MIN(prefix, 128);		/* sanitize, max prefix is 128 */
139
140     	dst->value.ipv6 = fv_a->value.ipv6;
141     	while (prefix >= 8) {
>>>     CID 1503219:  Memory - illegal accesses  (OVERRUN)
>>>     Overrunning array "bitmasks" of 9 bytes at byte offset 127 using index "prefix" (which evaluates to 127).
142     		dst->value.ipv6.addr.bytes[pos] &= b->addr.bytes[pos] & bitmasks[prefix];
143
144     		prefix -= 8;
145     		pos++;
146     	}
147
2022-03-25 09:13:47 +00:00
Vadim Yanitskiy 4ed32de2ee E212: update and add new MCC/MNC entries for Kazakhstan
References (mostly in Russian):

* https://ru.wikipedia.org/wiki/MNC
* https://htmlweb.ru/geo/oper.php?country=KZ
* http://www.mcc-mnc.com/
2022-03-24 20:42:38 +00:00
Ryan Doyle 78656fe00f Redis RESP: REdis Serialization Protocol v2 dissector
This adds support for RESP v2.
2022-03-23 13:30:10 +00:00
Nan Xiao 33e97e6130 EVS: Support decoding Primary 32.0 kbps packets 2022-03-23 12:46:44 +00:00
João Valverde 2fc8c0e36b dfilter: Handle a bitwise expr on the RHS 2022-03-23 11:04:41 +00:00
João Valverde 0335ebdc3a dfilter: ftype_is_true -> ftype_is_zero 2022-03-23 11:04:41 +00:00
Gerald Combs 110dbffbe9 Rename Sysdig Bridge to Falco Bridge.
The Sysdig Bridge plugin loads Falco plugins, so rename it to Falco
Bridge.

Make it optional and dependent on libsinsp+libscap, similar to our codec
plugins.

Remove some unused code.
2022-03-22 17:51:32 +00:00
Gerald Combs 3ae5ccbe52 Remove some debugging code. 2022-03-22 17:51:32 +00:00
Gerald Combs 349c067414 Sysdig Bridge: Handle info and conversation fields.
Fix our field length display as well.
2022-03-22 17:51:32 +00:00
Gerald Combs 72b1e028a8 Sysdig Event: Find the sdplugin dissector once.
We only need to search for dissectors at startup while registering
handoffs.
2022-03-22 17:51:32 +00:00
Mark Stemm 665a04e5e9 Update pluginevent to match falcosecurity/libs
It recently changed from 320 to 322, probably as a result of a rebase
to master, so reflect that change here.

It won't change once the plugin changes code is merged to master.
2022-03-22 17:51:32 +00:00
Loris Degioanni 8c3f436cc0 load the plugins from the wireshark directory 2022-03-22 17:51:32 +00:00
Loris Degioanni d226a7aa98 separate list of conversation filters for logshark
Conflicts:
	CMakeLists.txt
2022-03-22 17:51:32 +00:00
Loris Degioanni de5f59d7a4 sysdig: initial implementation of sysdig plugins support
This commit introduces a new wireshark plugin which is able to act as proxy to sysdig plugins, loading them into Wireshark and transforming their output into dissectors that Wireshark can use to display the data.
2022-03-22 17:51:32 +00:00
Loris Degioanni 625a042ff8 initial skeleton for sysdig plugins experiments 2022-03-22 17:51:32 +00:00
Joakim Karlsson 67a3256bcd rpcrdma: fix build issue [-Wmaybe-uninitialized] 2022-03-22 14:21:13 +00:00
Joakim Karlsson f07c30fffe CBOR: fix build issue [-Wmaybe-uninitialized] 2022-03-22 14:09:42 +00:00
Nardi Ivan 7c1dd842ff Diameter: improve IMEI/IMEISV dissection in User-Equipment-Info AVP
3GPP.User-Equipment-Info AVP should contain the IMEISV (if type is 0).
However some implementations put the IMEI there: decode it but display a
protocol error indication too.
2022-03-22 13:59:00 +00:00
João Valverde 16729be2c1 dfilter: Add bitwise masking of bits
Add support for masking of bits. Before the bitwise operator
could only test bits, it did not support clearing bits.

This allows testing if any combination of bits are set/unset
more naturally with a single test. Previously this was only
possible by combining several bitwise predicates.

Bitwise is implemented as a test node, even though it is not.
Maybe the test node should be renamed to something else.

Fixes #17246.
2022-03-22 12:58:04 +00:00
Jaap Keuter 3e3db6cd3e CFM: Unindent dissector code by restructuring loop conditions
Include missing default switches to handle incorrect protocol values.
2022-03-22 07:37:02 +00:00
João Valverde 631cf34f0c dfilter: Use a function pointer array to free registers 2022-03-21 18:43:36 +00:00
Constantine Gavrilov 89a39134ff NVMeOF TCP: fix storing of QID for TCP protocol -- fix missing commit. 2022-03-21 18:31:21 +00:00
João Valverde 6a0129a0e3 dfilter: Fix EditorConfig settings 2022-03-21 17:49:12 +00:00
João Valverde 54d8627c9a dfilter: Add more comments to optimization pass 2022-03-21 17:36:41 +00:00
João Valverde d60f2580ba dfilter: Pass around constants in instructions
The DFVM instructions arguments are generic boxed types but instead
of using FVALUE and PCRE types the code passes aroung REGISTER types
instead. Change that to pass constants in the instruction.
2022-03-21 17:09:56 +00:00
João Valverde 94d909103e dfilter: Remove DFVM constant initialization 2022-03-21 17:09:43 +00:00
João Valverde ae17e733ac dfilter: Use more DFVM values in gencode 2022-03-21 17:09:29 +00:00
João Valverde 769f1f10de dfilter: Add DFVM value constructor 2022-03-21 17:09:19 +00:00
Constantine Gavrilov 402bd8f28d NVMeOF TCP: fix storing of QID for TCP protocol. 2022-03-21 16:21:43 +02:00
João Valverde 1b574e7466 dfilter: Cleanup dfvm_apply() 2022-03-21 12:38:09 +00:00
João Valverde 22f3d87a8f dfilter: Use singly linked list for registers
Replace calls to list append with list prepend where applicable.
2022-03-21 11:47:19 +00:00
João Valverde ea949ef719 dfilter: Cleanup dfilter_dump() 2022-03-21 11:26:52 +00:00
Gerald Combs 6a97b2095c [Automatic update for 2022-03-20]
Update manuf, services enterprise numbers, translations, and other items.
2022-03-20 16:41:14 +00:00
João Valverde 50f04cb9da dfilter: Remove dead code 2022-03-19 20:10:43 +00:00
Jorge Mora 984dc6de78 IWARP_DDP_RDMAP: display read request tags and offsets in hex 2022-03-19 19:38:26 +00:00
Jorge Mora 4a80186e2b RPCoRDMA: do not reassemble if there is only one fragment
Only reassemble if reply chunk size is non-zero to avoid reassembly
of a single fragment. The RPC-over-RDMA reply has no data when the
reply chunk size is non-zero but it needs to reassemble all
fragments (more_frags = FALSE) in this frame. On the other hand
when the reply chunk size is zero, the whole message is given in
this frame therefore there is no need to reassemble.
2022-03-18 21:22:11 +00:00
John Thacker 37a0054551 http: Pass data relative to the original offset to follow tap
dissect_http_message might get called with a nonzero offset into
the tvb if there are multiple messages/segments in a frame. Only
send data starting from that offset to the follow tap, instead of
starting at tvb offset 0. Fix #18006
2022-03-18 21:11:09 +00:00
Stig Bjørlykke 60ba57387c data: Add data shown as text to Info column
Fill the Info column when showing data as text.
2022-03-18 12:59:59 +00:00
Richard Sharpe e61fe552d0 ieee80211-radiotap: Add support for headers to be bit-based as well as TLVs.
Johannes Berg pointed out this was the intent of the TLV definitions and
supplied some code for implementing that. I simply made it work.
2022-03-17 22:26:12 +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
John Thacker b82ef4ad04 tls: Use TCP reassembly functions for desegmentation
Since TLS uses the TCP multisegment pdus for desegmentation,
use the TCP reassembly functions so that both the first frame
and sequence number are used. Fix #11173 somewhat better than
the previous fix, because it avoids the (unlikely) case of two
different fragments comparing equal when just bit twiddling a
single key.
2022-03-17 07:42:52 -04:00
John Thacker 9ca501ae13 tcp: Use first frame and sequence number for reassembly
It's possible to have more than one TCP segment for the same
stream that begins in the same frame when there is encapsulation
(e.g. DVB BaseBand Frames carrying GSE or MPE with IP.)

We always have the tcp_multisegment_pdu when looking up fragments
in TCP, so declare reassembly functions for TCP that accept the
MSP as data, so we can use the starting sequence number of the MSP
to distinguish segments with identical first frames. (Using the
sequence number alone would fail with re-used sequence numbers in
long connections or reused ports, and also have more hash collisions
with relative sequence numbers.) This is analogous to #11173 for
TLS.
2022-03-17 11:28:44 +00:00
João Valverde 588d22a82b dfilter: Allow variable number of jumps during codegen
Use a list to allow a variable number of jumps, instead of a fixed
count. The flexibility in the number of jumps a given syntax tree
node might need to handle is useful to add new kinds of
operations.
2022-03-16 20:12:22 +00:00
João Valverde 5f13127a94 ftypes: Remove unnecessary macro 2022-03-16 19:28:41 +00:00
João Valverde 72751919b2 ftypes: Remove shared boolean from fvalue struct
This shared variable hidden behind a macro does not provide any
efficiency gains and just obscures the code. Move the boolean to
the fvalue protocol struct, where it belongs.
2022-03-16 19:25:45 +00:00
João Valverde 32446523f6 dfilter: Fix stnode_tostr()
Syntax tree nodes can mutate and change type so the caching being used
is keepign a stale representation and printing wrong results. Recreate
the string every time the function is called.

We still store the string pointer in the node to be able to pass a const
char * to the caller without leaking memory, as a convenience.
2022-03-16 19:23:33 +00:00
Jorge Mora 765d6755fb RPCoRDMA: add padding on iWarp read and write chunks
Add padding bytes as a separate fragment when last fragment's data
is not on a four-byte boundary. The MPA layer removes the padding
bytes from all iWarp Reads and Writes. The iWarp Send messages are
padded correctly.

Fixes #17963.
2022-03-16 05:33:46 +00:00
Jorge Mora db09e81dd8 RPCoRDMA: add iWarp read chunk reassembly
Add binary tree, request_list, to add rdmap_request_t struct using
the sink steering tag of a tagged message as the key. The request
info is used to map the read response STag to the segment STag and
to map the read response offset to the segment offset.

Since the read chunk message is reassembled in the last read
response, go through all segments to calculate read chunk size
and the received bytes on the last read fragment. If all read chunk
fragments has been added to the reassembly table then complete the
reassembly and return the reassembled buffer.

Related to #17963.
2022-03-16 05:33:46 +00:00
Jorge Mora 327437d04d IWARP_DDP_RDMAP: add read request to struct rdmapinfo
Add struct rdmap_request to save read request info and include it
as read_request in rdmapinfo to pass to payload subdissectors.
Need to populate read request info even if rdma_tree is NULL.
Even though a read request does not have any payload data, call
upper layer dissector for message reassembly.

Related to #17963.
2022-03-16 05:33:46 +00:00
Jorge Mora 596c4151d8 RPCoRDMA: add iWarp reply chunk reassembly
Make sure to process RDMA_NOMSG not only for Infiniband but for
iWarp as well.

Related to #17963.
2022-03-16 05:33:46 +00:00