Commit Graph

46356 Commits

Author SHA1 Message Date
Kevin Albertson 8ad7e2f538 zstd: add test for uncompressing 0 length 2023-01-02 12:13:54 +00:00
Yaniv Kaul a2e18feae7 packet-cql: keys with length -1 are NULL values in BATCH operations
When procssing BATCH statements, Wireshark did not properly handled keys with length < 0 , which actually means that no value
is sent on the wire..
This fixes it (and as a results, parses properly some result packets it failed to parse properly before).

Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>
2023-01-02 12:13:17 +00:00
Yaniv Kaul 140ebf5829 packet-cql: keys with length -1 are NULL values
When procssing results, Wireshark did not properly handled keys with length -1, which actually means NULL.
This fixes it (and as a results, parses properly some result packets it failed to parse properly before).

Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>
2023-01-02 12:13:17 +00:00
Yaniv Kaul cffdb5945e packet-cql.c: add row number in display for RESULT opcode
Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>
2023-01-02 12:12:58 +00:00
Yaniv Kaul 91cf033cec packet-cql.c: distinguish between Snappy and LZ4 decompressed data
Simply print if it's Snappy or LZ4.

Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>
2023-01-02 11:25:12 +00:00
Yaniv Kaul 7eb8065e63 packet-cql.c: add support for SUPPORTED mesage type
Signed-off-by: yaniv.kaul@scylladb.com
2023-01-02 09:58:24 +00:00
PMcL 7d66154242 Support for an Arista Vendor Specific Protocol subtype
packet.avsp.c: Updated to include a new protocol subtype called TGen;
packet-ethertype.c: Changed AVSP to Arista Vendor Specific Protocol;
2023-01-02 07:56:43 +00:00
João Valverde f37c7c4062 dfilter: Tweak representation for length-1 byte array
Make dfilter byte representation always use ':' for consistency.

Make 1 byte be represented as "XX:" with the colon suffix to
make it nonambiguous that is is a byte and not other type,
like a protocol.

The difference is can be seen in the following programs. In the
before representation it is not obvious at all that the second
"fc" value is a literal bytes value and not the value of the
protocol "fc", although it can be inferred from the lack of
a READ_TREE instruction. In the After we know that "fc:" must
be bytes and not a protocol.

Note that a leading colon is a syntactical expedient to say
"this value with any type is a literal value and not a protocol
field." A terminating colon is just a part of the dfilter
literal bytes syntax.

Before:

Filter: fc == :fc

Syntax tree:
 0 TEST_ANY_EQ:
   1 FIELD(fc <FT_PROTOCOL>)
   1 FVALUE(fc <FT_PROTOCOL>)

Instructions:
00000 READ_TREE		fc <FT_PROTOCOL> -> reg#0
00001 IF_FALSE_GOTO	3
00002 ANY_EQ		reg#0 == fc <FT_PROTOCOL>

After:

Filter: fc == :fc

Syntax tree:
 0 TEST_ANY_EQ:
   1 FIELD(fc <FT_PROTOCOL>)
   1 FVALUE(fc: <FT_PROTOCOL>)

Instructions:
00000 READ_TREE		fc <FT_PROTOCOL> -> reg#0
00001 IF_FALSE_GOTO	3
00002 ANY_EQ		reg#0 == fc: <FT_PROTOCOL>
2023-01-02 02:54:38 +00:00
João Valverde c762d8492b dfilter: Improve debug format 2023-01-02 02:53:21 +00:00
João Valverde f5bfe89785 dfilter: Replace global variable 2023-01-02 01:19:51 +00:00
João Valverde 5d8f495233 dfilter: Minor flex clean up
Replace flex prefix to improve readability.

Remove two no-longer-needed workarounds to suppress warnings.
2023-01-02 01:19:26 +00:00
João Valverde f2218ae5f0 Lemon: Update code and remove cruft
Remove some unused historical files.

Aggressively disable warnings to keep the lemon source
pristine and avoid the maintenance burden for lemon itself.

Lemon has its own lax policy for warnings that doesn't match our
own and they won't accept external patches to remove the
warnings, so just ignore them. Lemon is just executed to generate
code for the Wireshark build and the minor code issues it has
have no influence at runtime.

For lemon generated code we selectively disable some linting
warnings.

Remove patches for lemon and lempar, they are no longer required
with these changes to silence warnings.
2023-01-01 18:18:06 +00:00
Alexander Clouter a8b16d74e1 eap: tweak conversation tracking to avoid breaking pinfo horribly
Looks like conversation_set_conv_addr_port_endpoints() from 66b441f3d is
designed with this use case in mind.

This should resolve issue #18622
2022-12-31 20:43:22 +00:00
Matan Perelman 3a23f6e6c9 gsm_a_rr: Support parsing channel requests on RACH 2022-12-30 19:44:49 +00:00
João Valverde 6bdc85e37f dfilter: Reject constant expressions
Constant logical expressions are tautologies and almost certainly
user error. Reject them as invalid.

Most of them were already rejected with insufficient type information
but some corner cases were still valid.

Before:

    Filter: ${frame.number} == 3

    Syntax tree:
     0 TEST_ANY_EQ:
       1 REFERENCE(frame.number <FT_UINT32>)
       1 FVALUE(3 <FT_UINT32>)

    Instructions:
    00000 READ_REFERENCE	${frame.number <FT_UINT32>} -> reg#0
    00001 IF_FALSE_GOTO	3
    00002 ANY_EQ		reg#0 == 3 <FT_UINT32>
    00003 RETURN

After:

    Filter: ${frame.number} == 3
    dftest: Constant expression is invalid.
    	${frame.number} == 3
    	^~~~~~~~~~~~~~~~~~~~
2022-12-30 18:46:22 +00:00
João Valverde a17fb20550 dfilter: Remove commute argument from semantic check
Take a more conservative, less flexible, maybe more elegant,
approach to type inference for now.
2022-12-30 18:46:22 +00:00
João Valverde 2ff6139307 dfilter: Add a check_nonzero() function
Small refactoring with no functional difference.
2022-12-30 18:46:22 +00:00
João Valverde d3d06c2552 dftest: Add debug command-line options 2022-12-30 13:42:26 +00:00
John Thacker 55ffdb08bb conversation: Remove conversation from the correct table
In conversation_set_addr2, if the existing conversation has
a port2, remove it from the _no_addr2 hashtable, not the _no_port2
hashtable.

Fix #18766
2022-12-30 13:16:56 +00:00
Martin Mathieson dfd3a4d61b check_tfs: find entries that define value_string identical to common tfs 2022-12-30 11:56:41 +00:00
Joakim Karlsson a661ebaae2 DECT-NWK: fix build issue [-Werror=maybe-uninitialized] 2022-12-30 11:17:06 +00:00
Joakim Karlsson 3c0cdc9e3d SNMP: generate ASN1 2022-12-30 10:34:21 +01:00
John Thacker 67db53abbf epan: Fixup get_ascii_string change
prev needs to be advanced to ptr on an invalid character even
if there aren't any bytes to copy (because we have two invalid
characters in a row.) Fixup ba7917309a

Fix #18769.
2022-12-29 22:44:37 -05:00
Joakim Karlsson 2ce57fcc19 pfcp: correction of IE 5GS User Plane Node
Fix #18760
2022-12-30 02:09:55 +00:00
Joakim Karlsson 5c151df3ad diameter: Update geographical_description 2022-12-30 02:04:42 +00:00
Joakim Karlsson 23427cc9ba LCS-AP: Update to 3GPP TS 29.171 V17.2.0 2022-12-30 02:03:33 +00:00
Joakim Karlsson 931824f4ff gsm_common: Update geographical_description 2022-12-30 02:02:42 +00:00
João Valverde 1400d92724 dfilter: Add compilation warning for ambiguous syntax
$ dfilter 'frame contains fc'
    Filter: frame contains fc

    Warning: Interpreting "fc" as "Fibre Channel". Consider writing :fc or .fc.
    (...)
2022-12-29 23:48:56 +00:00
John Thacker ba7917309a charsets: Optimize ENC_ASCII by appending valid bytes at once
For ASCII encoding, most bytes are copied directly. Count consecutive
valid bytes in an accumulator and append them all at once when we
get an invalid character with the high bit set, or at the end.
This reduces the number of reallocations and allows larger, more
optimized memcpys.
2022-12-29 21:02:12 +00:00
Gerald Combs afe5ed0aa5 epan: Initialize variables in various dissectors
Fix the following valgrind warnings:

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x78B0849: unescape_and_tvbuffify_telnet_option (epan/dissectors/packet-telnet.c:1043)

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x76917C8: dissect_rohc_ir_rtp_profile_dynamic (epan/dissectors/packet-rohc.c:1667)

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x70DCBF1: dissect_gsm_rlcmac_downlink (epan/dissectors/packet-gsm_rlcmac.c:9770)

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x6C7958E: set_mime_hdr_flags (epan/dissectors/packet-beep.c:392)

Fixes #18742
2022-12-29 19:27:16 +00:00
João Valverde af22c743bd dfilter: Refactor error location for expressions
Underline the whole expression for errors, not just the token.
Implement it for all expressions.
2022-12-29 18:28:54 +00:00
João Valverde 77ef21f86e dfilter: Replace unparsed lexical type and simplify grammar
Remove unparsed lexical type and replace it with identifier
and constant. This separation is still necessary to differentiate
names (fields and function) from literals that look like names
but it has some advantages to do it at the lexical level.

The main advantage is a much cleaner and simplified grammar,
because we only have a single token type for field names, without
any loss of generality (the same name is valid for fields and
function names for example).

The CONSTANT token type is necessary to be different from literal
to provide errors for function rules.
2022-12-29 18:28:54 +00:00
João Valverde bdd00edac8 dfilter: Rename grammar rules 2022-12-29 18:28:54 +00:00
Bernhard Dick fefc28a743 DECT-NWK: Fix BCD encoded non byte aligned strings
As proto_tree_add_bits_item does not support FT_STRING header fields
dissection of non byte aligned fields containing BCD values has been
rewritten using explicit reading of the BCD values and usage of
proto_tree_add_string
2022-12-29 09:05:29 +00:00
Bernhard Dick 4a0d7e9bbb DECT-NWK: Fix hf types for bitfields
Bitfields are neither allowed to be of type FT_NONE or FT_UINT_BYTES.
This commit fixes this for padding fields (being max 7 bits of zeroes,
thus FT_UINT8) and one field currently named as FT_UINT_BYTES that can
just be represented as FT_BYTES
2022-12-29 09:05:29 +00:00
Chuck Craft 1d6cf2f513 prefs: report load error in gui popup
ws_warning logs to console which most users will never see.
https://ask.wireshark.org/question/30035/new-computer-setup-custom-columns/
2022-12-29 04:02:15 +00:00
João Valverde 95f705dd8b dfilter: Improve error location for functions
Underline the whole expression if the error is for the function.

Before:

    Filter: frame.number == abs(1, 2)
    dftest: Function abs can only accept 1 arguments.
    	frame.number == abs(1, 2)
    	                ^~~
After:

    Filter: frame.number == abs(1, 2)
    dftest: Function abs can only accept 1 arguments.
    	frame.number == abs(1, 2)
    	                ^~~~~~~~~
2022-12-28 20:26:00 +00:00
Kevin Albertson bdb1616cf0 fix size_t cast warnings on Windows 2022-12-28 05:00:45 +00:00
Kevin Albertson eca4655a48 use uncompress_zstd in Kafka 2022-12-28 05:00:45 +00:00
Kevin Albertson f5c400c6e7 mongo: support zstd
use tvb_child_uncompress_zstd from packet-mongo
2022-12-28 05:00:45 +00:00
Kevin Albertson 8dd82ff741 add zstd_tests 2022-12-28 05:00:45 +00:00
Kevin Albertson 0ea91fc6fa error on extra data 2022-12-28 05:00:45 +00:00
Kevin Albertson a9037f45c7 do not create composite buffer with empty data
This results in an exception on tvb_composite_finalize.
2022-12-28 05:00:45 +00:00
Kevin Albertson 2f9fd85ae9 add tvbuff_zstd.c 2022-12-28 05:00:45 +00:00
João Valverde 6c1ee11172 dfilter: Allow compatible types to be compared in min/max 2022-12-27 21:09:04 +00:00
João Valverde e85f8d4cf1 dfilter: Do not jump when generating function arguments
Instead of "jumping" with length zero to the next sequential
instruction skip generating the no-op jump instruction entirely.
2022-12-27 21:09:04 +00:00
João Valverde f6a02a1e4a dfilter: Preserve function argument order when printing
Instead of printing back to front (from the top of the stack
print them front to back as a user would type them.
2022-12-27 21:09:04 +00:00
Guy Harris 0df8a7a872 SRT: expand comments to give more detail on the string encoding. 2022-12-27 10:38:44 -08:00
João Valverde 3c411657d5 SRT: Validate UTF-8 encoding
Fixes #18754.
2022-12-27 14:34:12 +00:00
Joakim Karlsson 939677f16e pfcp: Update to 3GPP TS 29.244 V18.0.0 2022-12-27 13:20:48 +00:00
Martin Mathieson 5bbe533244 WIP: Check types for _add_bits_ functions, and ensure no mask 2022-12-27 12:10:03 +00:00
João Valverde b19bed43d1 dfilter: Allow constants as the first or only argument to min/max
The strategy here is to delay resolving literals to values until
we have looked at the entire argument list.

Also we will try to commute the relation in a comparison if
we do not have a type for the return value of the function,
like any other constant.

Before:

    Filter: max(1,_ws.ftypes.int8) == 1
    dftest: Argument '1' is not valid for max()
    	max(1,_ws.ftypes.int8) == 1
    	    ^

After:

    Filter: max(1,_ws.ftypes.int8) == 1

    Syntax tree:
     0 TEST_ANY_EQ:
       1 FUNCTION(max#2):
         2 FVALUE(1 <FT_INT8>)
         2 FIELD(_ws.ftypes.int8 <FT_INT8>)
       1 FVALUE(1 <FT_INT8>)

    Instructions:
    00000 STACK_PUSH	1 <FT_INT8>
    00001 READ_TREE		_ws.ftypes.int8 <FT_INT8> -> reg#1
    00002 IF_FALSE_GOTO	3
    00003 STACK_PUSH	reg#1
    00004 CALL_FUNCTION	max(reg#1, 1 <FT_INT8>) -> reg#0
    00005 STACK_POP	2
    00006 IF_FALSE_GOTO	8
    00007 ANY_EQ		reg#0 == 1 <FT_INT8>
    00008 RETURN
2022-12-27 02:21:06 +00:00
João Valverde 6399f724d9 dfilter: Fix crash with min/max literal argument
Filter: max(1,_ws.ftypes.int8) == 1
     ** (dftest:64938) 01:43:25.950180 [DFilter ERROR] epan/dfilter/sttype-field.c:117 -- sttype_field_ftenum(): Magic num is 0x5cf30031, but should be 0xfc2002cf
2022-12-27 01:54:57 +00:00
Gerald Combs 6c8cdebe87 epan: Add a bounds check to get_utf_8_string
Check our current buffer position as well as our length.
Fixes #18758.
2022-12-27 01:54:23 +00:00
João Valverde 540b71d738 dfilter: Fix crash with a constant arithmetic expression 2022-12-26 23:55:27 +00:00
João Valverde 3ddb017a88 dfilter: Allow arithmetic expression to commute
Allow an arithmetic expression like 1 + some.field. If we
cannot assign a type to the LHS commute the terms and
try again.

Before:

    Filter: _ws.ftypes.int32 + 1 == 10

    Syntax tree:
     0 TEST_ANY_EQ:
       1 OP_ADD:
         2 FIELD(_ws.ftypes.int32 <FT_INT32>)
         2 FVALUE(1 <FT_INT32>)
       1 FVALUE(10 <FT_INT32>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 <FT_INT32> -> reg#0
    00001 IF_FALSE_GOTO	4
    00002 ADD		reg#0 + 1 <FT_INT32> -> reg#1
    00003 ANY_EQ		reg#1 == 10 <FT_INT32>
    00004 RETURN

    Filter: 1 + _ws.ftypes.int32 == 10
    dftest: Constant arithmetic expression on the LHS is invalid.
    	1 + _ws.ftypes.int32 == 10
    	^

After:

    Filter: _ws.ftypes.int32 + 1 == 10

    Syntax tree:
     0 TEST_ANY_EQ:
       1 OP_ADD:
         2 FIELD(_ws.ftypes.int32 <FT_INT32>)
         2 FVALUE(1 <FT_INT32>)
       1 FVALUE(10 <FT_INT32>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 <FT_INT32> -> reg#0
    00001 IF_FALSE_GOTO	4
    00002 ADD		reg#0 + 1 <FT_INT32> -> reg#1
    00003 ANY_EQ		reg#1 == 10 <FT_INT32>
    00004 RETURN

    Filter: 1 + _ws.ftypes.int32 == 10

    Syntax tree:
     0 TEST_ANY_EQ:
       1 OP_ADD:
         2 FVALUE(1 <FT_INT32>)
         2 FIELD(_ws.ftypes.int32 <FT_INT32>)
       1 FVALUE(10 <FT_INT32>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 <FT_INT32> -> reg#0
    00001 IF_FALSE_GOTO	4
    00002 ADD		1 <FT_INT32> + reg#0 -> reg#1
    00003 ANY_EQ		reg#1 == 10 <FT_INT32>
    00004 RETURN
2022-12-26 20:50:44 +00:00
João Valverde c37552c43c dfilter: Fix an assertion macro 2022-12-26 20:22:21 +00:00
João Valverde 1d544c2077 dfilter: Fix grammar memory leak 2022-12-26 18:48:54 +00:00
John Thacker f0f72927b4 epan: Allow FT_IPv4, FT_IPv6 custom columns to be resolved or not.
Similar to commit dbb9fe2a37, proto_item_fill_display_label
now uses address_to_display for FT_IPv4, FT_IPv6, and FT_FCWWN,
the other three address types that double as field types and which
have optional name resolution.

Add these to the list of types that, if present in a custom column,
has the GUI enable the checkbox to switch between "resolved" (names)
and not (values).

This allows adding custom columns with these field types with both
resolved and non resolved text. Note that the appropriate Name
Resolution preference settings must be enabled for the type as well.
2022-12-26 16:12:19 +00:00
João Valverde 079ef9a165 dfilter: Allow comparison relation to commute
Comparison relations should be allowed to commute but they can not
because we need type information to resolve literals to fvalues. For
that reason an expression like "1 == some.field"  is invalid. Solve
that by commuting the relation if the first try did not succeed in
assigning a type to the LHS.

After the second try give up, that means we have a relation with
constants on both sides and that is not semantically valid.

Other relations like "matches" and "contains" are not symmetric and
should not commute anyway.

Before:

    Filter: _ws.ftypes.int32 == 10

    Syntax tree:
     0 TEST_ANY_EQ:
       1 FIELD(_ws.ftypes.int32 <FT_INT32>)
       1 FVALUE(10 <FT_INT32>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 <FT_INT32> -> reg#0
    00001 IF_FALSE_GOTO	3
    00002 ANY_EQ		reg#0 == 10 <FT_INT32>
    00003 RETURN

    Filter: 10 == _ws.ftypes.int32
    dftest: Left side of "==" expression must be a field or function, not 10.
    	10 == _ws.ftypes.int32
    	^~

After:

    Filter: _ws.ftypes.int32 == 10

    Syntax tree:
     0 TEST_ANY_EQ:
       1 FIELD(_ws.ftypes.int32 <FT_INT32>)
       1 FVALUE(10 <FT_INT32>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 <FT_INT32> -> reg#0
    00001 IF_FALSE_GOTO	3
    00002 ANY_EQ		reg#0 == 10 <FT_INT32>
    00003 RETURN

    Filter: 10 == _ws.ftypes.int32

    Syntax tree:
     0 TEST_ANY_EQ:
       1 FVALUE(10 <FT_INT32>)
       1 FIELD(_ws.ftypes.int32 <FT_INT32>)

    Instructions:
    00000 READ_TREE		_ws.ftypes.int32 <FT_INT32> -> reg#0
    00001 IF_FALSE_GOTO	3
    00002 ANY_EQ		10 <FT_INT32> == reg#0
    00003 RETURN
2022-12-26 15:29:50 +00:00
João Valverde 49ec151a7a dfilter: Allow the first DFVM argument to be an fvalue
Do not assert that arg1 must be a register, allow passing constants
as the first argument to allow the arguments to commute freely.
2022-12-26 12:40:23 +00:00
João Valverde 596e0b41d1 dfilter: Change two scanner patterns to camel case 2022-12-26 07:27:40 +00:00
João Valverde 7742b22be4 dfilter: Minor fixups 2022-12-26 04:24:55 +00:00
João Valverde eda80ed336 dfilter: Improve error location for parenthesized expressions 2022-12-26 03:20:30 +00:00
John Thacker b1d93f7952 charsets: Optimize getting UTF-8 strings with an accumulator
Add all the valid bytes at once when we get to the end of the
length (or hit an invalid sequence) instead of one byte or character
at a time. This makes for a considerable speedup.
2022-12-25 20:42:28 +00:00
Gerald Combs 274a6c9d64 [Automatic update for 2022-12-25]
Update manuf, services enterprise numbers, translations, and other items.

services failed.
2022-12-25 16:46:13 +00:00
Eric Anderson d91cd30855 BACnet: Fix dissection of Notification Parameters
When the new-value element of the change-of-discrete choice contains context
tag zero, the tag content should be decoded as a BACnetDateTime. Closes #18747.
2022-12-24 19:59:24 +00:00
João Valverde 816005fc23 dfilter: Reformat grammar code
Use a consistent style for grammar rules.

Remove a comment that is too generic. The current code should
conform to how Python operates and does not need additional error
checking.
2022-12-24 18:25:11 +00:00
João Valverde b9a5009cb2 dfilter: Clean up scanner code
Clean up some issues flagged by a linter.

Remove hyphen from pattern names and remove an unused start condition.
2022-12-24 15:51:36 +00:00
Jianwei Mao d9a09aa622 IPv6: Support dissecting IETF APN6 option.
IETF APN6: Application-Aware IPv6 Networking (APN6)

APN6 option is a new option including in IPv6 Destination Options Header.

APN6 makes use of IPv6 encapsulation to convey the APN Attribute along with
data packets and make the network aware of data flow requirements at different
granularity levels. The APN attribute can be encapsulated in the APN header.

References:
1. https://datatracker.ietf.org/wg/apn/about/
2. https://datatracker.ietf.org/doc/draft-li-apn-header/
3. https://datatracker.ietf.org/doc/draft-li-apn-ipv6-encap/
2022-12-24 08:15:27 +00:00
Guy Harris 13f3ebc4e5 Add a routine to get the path of an executable given the program name.
That reduces the number of get_progfile_dir() calls, leaving only the
calls that are done either to 1) get the pathname in order to display it
or 2) get the pathname in order to reset the library path.

That makes it easier to figure out which get_progfile_dir() calls are
made to find the directory in which (non-extcap) binaries from Wireshark
are installed and which - if any - are made to figure out the directory
in which *the currently-running executable* are stored.  (Currently,
get_progfile_dir() attemps to get the former, not the latter, so
extcaps in an extcap subdirectory, for example, will get the parent
directory of that subdirectory, *not* the directory in which they weere
installed.)
2022-12-23 23:20:22 +00:00
João Valverde 44511c318d dfilter: Improve error location for expressions
Try to underline the whole expression instead of the
token.
2022-12-23 18:23:14 +00:00
João Valverde 3938b406fb dfilter: Refactor error location tracking
Remove duplicate location struct by adding a new header.

Pass around a structure instead of a pointer.
2022-12-23 18:23:06 +00:00
Martin Mathieson 51a6dfffc7 PDCP-LTE: add a filter for decypted data 2022-12-23 10:59:35 +00:00
João Valverde 4e1211de90 dfilter: Add support for negation of arithmetic expressions 2022-12-22 23:51:16 +00:00
Pascal Quantin e9176b652d ASN.1 PER: fix dissect_per_restricted_character_string_sorted()
Avoid incrementing offset if it was already changed when trying to fetch
length. Closes #18702
2022-12-22 20:51:49 +00:00
John Thacker 5ee2e7c268 QUIC: Handle QUIC connections multiplexed on the same 5-tuple
Different QUIC connections can be multiplexed on the same network
5-tuple. Handle this, including checking for Stateless Reset tokens
on all connections on the same 5-tuple.

Create a CONVERSATION_QUIC type using our internal QUIC connection
ID, and set the conversation elements so that subdissectors like
TLS that set conversation data only alter data for the one QUIC
connection instead of all multiplexed connections.

Various failures are expected, per RFC 9000, if zero-length connection
IDs are used when multiplexing connections on the same local IP addresses
and ports.

Fix #17099
2022-12-22 19:56:19 +00:00
Martin Mathieson 369993d72c E2AP: Use gnbid to share RAN Function ID mappings 2022-12-22 19:18:18 +00:00
Martin Mathieson 398b05d199 DECT-NWK: Fix a couple of typos 2022-12-22 12:05:12 +00:00
João Valverde ba1a85d381 dfilter: Improve arithmetic error messages 2022-12-22 10:13:30 +00:00
easonweii 0e4bcf427f H224: Completing of H.224 dissection for Client Data Octets
Add the client protocols prasing for CME (Client Management Entity) and H.281/FECC (Far-End Camera Control).
Related #18667
2022-12-22 08:40:53 +00:00
Bernhard Dick ae0d6324c4 DECT-NWK: Fix windows build
When building using msvc implicit changes of the integer sizes in
fmt_dect_nwk_ipei are treated as error due to possible loss of
information.
This is now forecome by explicitely masking the shifted value to fit in
guint16 and by typecasting in calculation to guint16 (the maximum value
that needs to fit here is sum(x=1..x=12)(9x)=702 )
2022-12-21 21:30:20 +00:00
Bernhard Dick 8aec74c0ba DECT-NWK: Simplify data dissector call 2022-12-21 21:30:20 +00:00
Bernhard Dick cdf134b4e5 DECT-NWK: Update wmem_strbuf function usage
In 32f88ad22c the function to create new
sized wmwm strbufs has been renamed and got a parameter change. This
updates DECT-NWK parts accordingly.
2022-12-21 21:30:20 +00:00
Bernhard Dick b7d2d107d4 DECT-NWK: Update hf type
Use type int instead of gint for all hf_ variables as this is used in
the functions and structures
2022-12-21 21:30:20 +00:00
Bernhard Dick 0905bc33b5 DECT-NWK: Remove solved TODO marks 2022-12-21 21:30:20 +00:00
Bernhard Dick 9cddc16d68 DECT-NWK: Dissect more IPUI types 2022-12-21 21:30:20 +00:00
Bernhard Dick 4e0365b25b DECT-NWK: Improve display of DECT chars/strings 2022-12-21 21:30:20 +00:00
Bernhard Dick 1d8152afd7 DECT-NWK: Escape DECT chars >= 0x80 2022-12-21 21:30:20 +00:00
Bernhard Dick ad06d7cec6 DECT-NWK: Use DECT charset for strings 2022-12-21 21:30:20 +00:00
Bernhard Dick 75fb2e770c DECT-NWK: Add basic support for DECT charsets 2022-12-21 21:30:20 +00:00
Bernhard Dick cc86a34c90 DECT-NWK: Fix IPEI string formatting 2022-12-21 21:30:20 +00:00
Bernhard Dick 1272bd3c2d DECT-NWK: Fix missing initialization 2022-12-21 21:30:20 +00:00
Bernhard Dick 4fed21f5a8 DECT-NWK: Make format function static 2022-12-21 21:30:20 +00:00
Bernhard Dick e3f010683f DECT-NWK: Dissect more S-Format message types
Adds basic dissection for futher S-Format message types:
* CISS
* CRSS
* COMS
* CLMS
2022-12-21 21:30:20 +00:00
Bernhard Dick 98a86dc660 DECT-NWK: Add fields to PORTABLE-IDENTITY
Add dissection of TPUI and IPEI field including IPEI format string to
the PORTABLE-IDENTITY S-Format information element
2022-12-21 21:30:20 +00:00
Bernhard Dick 3b1084d0a1 DECT-NWK: Fix missing prototype 2022-12-21 21:30:20 +00:00
Bernhard Dick e95424b4cd DECT-NWK: fix proto tree item length
The Default Cipher Key algorithm field within AUTH-TYPE is only in the
last two bits of octet 5c, not 5c+5d
2022-12-21 21:30:20 +00:00
Bernhard Dick bb9785c849 DECT-NWK: Fix typos 2022-12-21 21:30:20 +00:00
Bernhard Dick d4f070ce54 DECT-NWK: Add further ie dissection
Added dissectin of the S-Format information fields
* DURATION
* IWU-TO-IWU
* MODEL-IDENTIFIER
* CODEC-LIST
2022-12-21 21:30:20 +00:00
Bernhard Dick 775ea97ddf DECT-NWK: Fix TERMINAL-CAPAPILITY
The mask for the control codes field within the TERMINAL-CAPABILITY
information element was masking the wrong bits.
2022-12-21 21:30:20 +00:00
Bernhard Dick 528391f2bd DECT-NWK: Fix hf definition
Definition of hf_dect_nwk_s_ie_terminal_capability_blind_slot_6a
reffered to the TFS for its bits by accident, this is now removed.
2022-12-21 21:30:20 +00:00
Bernhard Dick be04f23917 DECT-NWK: fix typo in field name 2022-12-21 21:30:20 +00:00
Bernhard Dick 271f7e00f9 DECT-NWK: Fix value_string terminations 2022-12-21 21:30:20 +00:00
Bernhard Dick 2e6e44d1b1 DECT-NWK: Add MULTI-DISPLAY, MULTI-KEYPAD
Add basic dissection of S-Format elements MULTI-DISPLAY and
MULTI-KEYPAD. The dissector now holds information regarding control
characters of the DECT charset.
2022-12-21 21:30:20 +00:00
Bernhard Dick 1c0da0d2e2 DECT-NWK: Add TERMINAL-CAPABILITY dissection
Dissection of the TERMINAL-CAPABILITY S-Format information element has
been implemented.
2022-12-21 21:30:20 +00:00
Bernhard Dick f4ec602228 DECT-NWK: Add LOCATION-AREA dissection 2022-12-21 21:30:20 +00:00
Bernhard Dick d1befab186 DECT-NWK: Add single binary value IEs
Add dissection of the S-Format information elements RAND, RES, RS all
holding an arbitrary data within their whole field length
2022-12-21 21:30:20 +00:00
Bernhard Dick 42751da3c3 DECT-NWK: Add AUTH-TYPE dissection 2022-12-21 21:30:20 +00:00
Bernhard Dick 79e3822dee DECT-NWK: Dissect MM messages
Added value strings for all MM messages and use S-Format IE dissection
also for MM
2022-12-21 21:30:20 +00:00
Bernhard Dick eaeff2858a DECT-NWK: Fix CIPHER-INFO
The value for Escaping to proprietary algorithm was wrong and the
Boolean field Y/N was registered using the wrong base, resulting in a
failed assertion during dissection
2022-12-21 21:30:20 +00:00
Bernhard Dick d9130e8d20 DECT-NWK: Add fixed len information elements
Dissection of all fixed length S-Format information elements has been
added to the dect-nwk dissector
2022-12-21 21:30:20 +00:00
Bernhard Dick 443f0dcc33 DECT-NWK: Handle CALLING-PARTY-NUMBER
Add begin of dissection of S-Format Calling Party Number information
element.
2022-12-21 21:30:20 +00:00
Bernhard Dick da2048d5f3 DECT-NWK: Move IE dissection out of LCE
Dissection of S-Format information elements has moved to an own
function that is now also used for dissecting CC messages
2022-12-21 21:30:20 +00:00
Bernhard Dick b7fc9a2788 DECT-NWK: Begin LCE-PAGE-RESPONSE dissection
First steps in dissection of the LCE-PAGE-RESPONSE message. Basic
dissection for S-FORMAT information elements being mandatory or
optional in this message is included.
2022-12-21 21:30:20 +00:00
Harald Welte 1be5ec9433 DECT-NWK: Initial dissector for DECT NWK layer
Change-Id: Idf0b97ce40ec5b2dd1b507a72fed64cfee288354
2022-12-21 21:30:20 +00:00
Pascal Quantin 318b5a819d NAS 5GS: fix a typo 2022-12-21 15:59:14 +00:00
João Valverde 263bda375c dfilter: Check if type supports unary minus
Fix crash for types that do not support unary minus.

Fixes #18750.
2022-12-21 14:43:39 +00:00
Martin Mathieson 7f5668e8ec WLAN: fix a couple of warnings from check_typed_item_calls.py 2022-12-20 21:21:35 +00:00
Martin Mathieson 5ccde702c1 PDCP-NR: Add a field to show/filter decrypted data 2022-12-20 16:36:39 +00:00
Nardi Ivan 507d5c5386 QUIC: update final constants for QUICv2
Old v2-01 version has been removed, like we did for v2-00 in 78d78eb016.

See:
https://datatracker.ietf.org/doc/draft-ietf-quic-v2/
https://datatracker.ietf.org/doc/draft-ietf-quic-version-negotiation-14
2022-12-20 10:43:47 +01:00
Martin Mathieson 202da2a700 WLAN: fix a conflicting entry for value_string 2022-12-19 22:15:10 +00:00
GREGORIO-M 1a2642ec69 MP-DCCP: Fixed typo in filter name
mp_joidid to mp_joinid
2022-12-19 11:06:25 +00:00
GREGORIO-M c1756855eb MP-DCCP: Solving Compilation Errors on Certain Compilers
-Removed some whitespaces
2022-12-19 11:06:25 +00:00
GREGORIO-M 801f954a53 MP-DCCP: Solving Compilation Errors on Certain Compilers
-Fixed a few issues with whitespaces
-Fixed duplicate field entries for mp_join, mp_prio and mp_addr
2022-12-19 11:06:25 +00:00
GREGORIO-M 1ebdeb2943 MP-DCCP: Fixed Compilation Error on Certain Compilers
-Reading whether a connection was MP_CAPABLE had incorrect arguments for its type.
2022-12-19 11:06:25 +00:00
GREGORIO-M 5c42b6e84f MP-DCCP: Fixed Rare Packet Malformation Error
-Applied change #2 in commit e98638bf798c5ccdb12b8af7a591b218f660b001 from wireshark/master
2022-12-19 11:06:25 +00:00
GREGORIO-M 599e51462e MP-DCCP: Solving Compilation Errors on Certain Compilers
-Changed the encoding of certain options to their appropriate value, the old values caused compilation error on some machines
-Reverted change #1 in commit c7d3335110290886f6dd56fa640c8b0ca0b7fce5 which caused a packet malformation error due to a data item being read incorrectly.
2022-12-19 11:06:25 +00:00
GREGORIO-M 350875f44f MP-DCCP: Solving Compilation Errors on Certain Compilers
-Certain lines had a mixture of tabs and spaces which prevented compilation on certain machines
2022-12-19 11:06:25 +00:00
GREGORIO-M 174730bdcc MP-DCCP: Solving Compilation Errors on Certain Compilers
-Certain lines had a mixture of tabs and spaces which prevented compilation on certain machines
-Replaced protocol abbreviation from mpdccp.mp_* to dccp_mp_* to solve PROTOABBREV error when building
2022-12-19 11:06:25 +00:00
GREGORIO-M 151414ac35 MP-DCCP: Resolved Minor Merge Issues
-Changed proto_tree_add_unit to proto_tree_add_item, as suggested for the dissect feature option
-Changed conditional statements to switch case in for MP_ADDADDR
2022-12-19 11:06:25 +00:00
GREGORIO-M 7f02b09c41 MP-DCCP: Improved MP_CONFIRM
-MP_Confirm dissection now works as a recursive function, which is capable of more effectively dissect a list of incoming confirmations.
2022-12-19 11:06:25 +00:00
GREGORIO-M 2b6e9d7b2b MP-DCCP: Modified MP_CONFIRM to match IETF draft.
-List MP_OPT as a subtree with relevant MP_SEQ, ID Address and/or subflow. 
-Fixed a compilation warning due to an except statement creating subtree for an inexistent tree.
2022-12-19 11:06:25 +00:00
Nathalie Romo 7bb4c2fb1e MP-DCCP: -Rename multi-path subobtions to match IETF draft.
-Add MP-KEY value.
-Add Key Data in MP_CLOSE.
-Add HMAC data.
-Correct IPv4 address endianess.
2022-12-19 11:06:25 +00:00
Nathalie Romo bdc9210978 DCCP: Fix dissection of Feature options to match feature_number names instead option_type, and include MP_CAPABLE feature. 2022-12-19 11:06:25 +00:00
GREGORIO-M 720c05c799 MP-DCCP: Added all features to MP-DCCP V6.
Previous implementation lacked MP_ADDADDR, MP_REMOVEADDR and had an outdated version of MP_PRIO.

Fixed a bug where the dissector had an incorrect offset of 1 byte, resulting in it incorrectly reading headers and data, something resulting in malformed packets.
2022-12-19 11:06:25 +00:00
GREGORIO-M 16ea20120c MP-DCCP: Implemented MP-DCCP up-to V4.
Used Leonard Walter's MP-DCCP dissector code.
2022-12-19 11:06:25 +00:00
Gerald Combs f951d80201 [Automatic update for 2022-12-18]
Update manuf, services enterprise numbers, translations, and other items.
2022-12-18 16:46:50 +00:00
John Thacker dbb9fe2a37 epan: Allow FT_ETHER custom columns to be resolved or not
Have proto_item_fill_display_label (which is used for custom
columns resolved type and packet diagrams) use address_to_display
for FT_ETHER. This is resolved when name resolution for MAC
Addresses is enabled.

Add FT_ETHER to the list of types that, if present in a custom
column, has the GUI enable the checkbox to switch between "resolved"
and "unresolved" text.

This allows FT_ETHER custom columns to be displayed as either
resolved addresses or unresolved. (Note that to be displayed
as resolved, the column resolved option must be checked and
the name resolution preference enabled.)

Fix #18665
2022-12-17 20:07:45 +00:00
João Valverde 2bc72fa3db IPP: Fix invalid UTF-8 encoding
Fixes #18739.
2022-12-17 17:41:11 +00:00
Martin Mathieson b2572f3a35 Fix some spelling errors 2022-12-17 11:41:29 +00:00
John Thacker 7baa0ca0c4 proto: Custom column concatenation and truncation
Fix some issues regarding custom columns near the maximum size:

Fix where when near the column limit, a comma was not being added
to separate a value but the first character of the next field was,
resulting in an invalid field.

Create the "result" and the "expr" (resolved and unresolved) separately
to address issue where for multifield custom columns of different
types, the "result" might be truncated without "expr" necessarily
being so. This created problems when concatenating the end of the
result to the expr for certain types later.

Avoid passing a NULL to snprintf for integer columns of BASE_NONE
of unexpected value.

Indicate when the custom column has been truncated, since after
commit e449b560c0 this string value is no longer
used to create the filter and is for display only. Also use
the label truncation function so that truncatation is on UTF-8
boundaries.

Fix #17618
2022-12-16 21:08:47 +00:00
João Valverde c2850d7203 C15 CH: Fix UTF-8 string truncation 2022-12-16 19:45:02 +00:00
João Valverde 2de92a94df epan: Add a bounds check to tvb_uncompress_lz7huff() 2022-12-16 19:45:02 +00:00
João Valverde 730981f76a GSM A-bis: Add an assertion to prevent a buffer overflow
==207143==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7f59752e0f00 at pc 0x7f5971cd0737 bp 0x7ffe881b1ef0 sp 0x7ffe881b1ee8
READ of size 4 at 0x7f59752e0f00 thread T0
    #0 0x7f5971cd0736 in setup_rlc_mac_priv epan/dissectors/packet-gsm_abis_pgsl.c:194:8
    #1 0x7f5971ccfc89 in dissect_gprs_data epan/dissectors/packet-gsm_abis_pgsl.c:357:3
    #2 0x7f5971ccf6ea in dissect_abis_pgsl epan/dissectors/packet-gsm_abis_pgsl.c:477:3
    #3 0x7f5974483daa in call_dissector_through_handle epan/packet.c:822:9
    #4 0x7f5974478c05 in call_dissector_work epan/packet.c:920:9
2022-12-16 19:45:02 +00:00
John Thacker 5b96d57b18 protobuf: Do not crash on zero length bytes element
If a field name has been written to the json dumper for
a bytes element (Base64), then a Base64 value must be written
later, even if the value is zero length.

Move the JSON_DUMPER_FLAGS_NO_DEBUG flag to the json_dumper header,
and use it in the protobuf dissector, so that errors in the JSON
dumper state transitions do not abort the application through a
ws_error() call. Use DISSECTOR_ASSERT in that case, since it should
happen only with a dissector bug (as with the zero bytes elements
issue fixed here), not with malformed packets.

Only instantiate the json_dumper and create its output string if
we intend on displaying its output, instead of doing so whenever
we have a message type name.

Fix #18730.
2022-12-16 12:20:30 +00:00
Vasil Velichkov a4f56e90a6 BER: Fix extension lengths
Previously the length was ignored and if a Sequence contains more then
one extensions (in the ellipsis) then the value of the second was
wrongly added to the value of the previous one.
2022-12-16 08:55:47 +00:00
Chuck Craft 3a61e3f851 SNMP/UDP: SNMP is walking on UDP conversation/stream ID 2022-12-16 08:46:03 +00:00
Gerald Combs b0cf030b30 RTPS: Add offset overflow checking.
Add and use check_offset_addition, which adds an expert item and throws
an exception if we're about to overflow our offset.

Fixes #18737
2022-12-15 16:16:00 -08:00
João Valverde 1ca46907d4 DMP: Fix invalid UTF-8 encoding 2022-12-15 15:04:08 +00:00
João Valverde 10bfb702a6 ECMP: Fix invalid UTF-8 encoding 2022-12-15 14:23:01 +00:00
João Valverde be44dab5d6 Zbee ZDP: Fix UTF-8 string invalid truncation 2022-12-15 14:23:01 +00:00
João Valverde 0256d09ab8 NCSI: Fix invalid UTF-8 encoding 2022-12-15 14:23:01 +00:00
João Valverde 2db8d6213f AllJoyn: Fix invalid UTF-8 encoding
Fixes #18725.
2022-12-15 14:23:01 +00:00
João Valverde 8afd34c616 Alljoyn: Fix -Wdocumentation warnings 2022-12-15 14:23:01 +00:00
Martin Mathieson d17c018013 tools/check_typed_item_calls: check FT_BOOLEAN mask length 2022-12-15 13:28:05 +00:00
Dario Lombardo 1e8d3d8695 tshark: fix duplicate fields issue in ek output.
Fix: #18036.
2022-12-15 12:22:30 +00:00
Jeremy Kerr ff728ab37d MCTP: Add decoder for message type
Once we have a full MCTP message, we can decode its type (including IC
field). This change adds type decode support, for the types present in
packet-mctp.h.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2022-12-15 12:21:06 +00:00
Jeremy Kerr cfcb33e8b7 MCTP: Add NCSI (and ethernet) over MCTP dissection
This change adds support for trivially-encapsulated MCTP protocols,
starting with NCSI-over-MCTP.

We need to handle this slightly different from the existing MCTP-based
protocols (MCTP control protocol and NVMe-MI), as the inner protocol is
unaware of the type byte and (optional) checksum tailer. So, add a new
dissector table, "mctp.encap-type" for these, meaning we can just hook
into the raw NC-SI dissector.

We also add the type definition for MCTP-over-ethernet, as defined in
the NCSI-over-MCTP specification.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2022-12-15 12:21:06 +00:00
Jeremy Kerr 728e89b955 MCTP: Add header for MCTP packet types
We have a few hard-coded MCTP type definitions in use (for MCTP control
protocol, and NVMe-MI) already, and we're about to add a couple more.

This change adds a header for packet-mctp, just with the type
definitions, and uses it for the current types.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2022-12-15 12:21:06 +00:00
Bernhard Dick 7b53d22b27 DECT-DLC: Remove abandonend part 2022-12-15 12:17:29 +00:00
Bernhard Dick 969f12c365 DECT-DLC: Unify variable naming
Naming of variables, i.e. for header fields was inconsistent (dlc_ vs
dect_dlc_). This is now changed to use the abbreviation (dect_dlc_) on
all global places.
2022-12-15 12:17:29 +00:00
Bernhard Dick f56a3fed08 DECT-DLC: Fix missing prototype 2022-12-15 12:17:29 +00:00
Bernhard Dick 584e65c950 DECT-DLC: Fix typos in hf definitions 2022-12-15 12:17:29 +00:00
Bernhard Dick 9a96284e5a DECT-DLC: Reassemble fragments
The DECT-DLC dissector now reassembles fragments before handing them
over to the NWK layer. Most of this is done by reusing of the reassembly code
from packet-lapdm.c.
2022-12-15 12:17:29 +00:00
Bernhard Dick 594207d04e DECT-DLC:DECT-DLC: Really disable abandoned func
The preprocessor definition to disable the stub
proto_reg_handoff_dect_aastra in packet-dect-dlc did not work, so it's
disabled via comment now.
2022-12-15 12:17:29 +00:00
Harald Welte c6fb1b2308 DECT-DLC: Don't call NWK dissector if there's no payload
Change-Id: Ia86185f52b724be61db2d94ffaf51fd00ebab84c
2022-12-15 12:17:29 +00:00
Harald Welte a13d71dab9 DECT-DLC: Initial dissector for DECT DLC protocol layer
Change-Id: Iabd75b0f9b12ea9162dc164741123feb1ba7992d
2022-12-15 12:17:29 +00:00
John Thacker 4672e73900 NBAP: Add UEID to HS-DSCH flows added from RadioLinkReconfiguration
A few HS-DSCH conversations are created when calling add_hsdsch_bind,
such as when a RadioLinkReconfigurationPrepare procedure has
a id-HSDSCH-MACdFlows-to-Add element. This method should add
the CommunicationContextID to the conversation just like the
other ways of creating the conversation. This provides a UEID
for a unique key for RLC reassembly.
2022-12-15 12:13:36 +00:00
João Valverde 38e73b895a SGsAP: Use ENC_APN_STR
Fixes #18701.
2022-12-15 03:08:39 +00:00
João Valverde 31ab1a0a17 SIP: Fix heap-use-after-free crash with ASAN
Fixes 358641a5ca.

Fixes #18735.
2022-12-15 02:13:30 +00:00
Brendan Meath 3a43d97898 NAS-5GS: change TLV to TLV_E for CAG Information list IE 2022-12-14 18:55:55 +00:00
Alexis La Goutte 8504578ec2 ieee80211: fix typo for encoding 2022-12-14 15:58:38 +00:00
Alexis La Goutte 30df11941b ieee80211: fix trailing whitespace 2022-12-14 15:58:38 +00:00
Alexis La Goutte 1856d1368a ieee80211: Add Location Civic (Measurement Report) 2022-12-14 15:58:38 +00:00
Alexis La Goutte 4b9aef8371 ieee80211: Add Location Civic (Measurement Request) 2022-12-14 15:58:38 +00:00
Alexis La Goutte 7191006bc4 ieee80211: Add Usage Rules/Policy Subelement
for LCI Report
2022-12-14 15:58:38 +00:00
Alexis La Goutte ce58638fe4 ieee80211: Add Measurement Request LCI Report dissection 2022-12-14 15:58:38 +00:00
Alexis La Goutte 0a5fcb4680 ieee80211: Update Measurement Request/Report value_string
From 802.11-2020.pdf
2022-12-14 15:58:38 +00:00
Alexis La Goutte b54c882df5 ieee80211: Add Measurement Request LCI Request dissection 2022-12-14 15:58:38 +00:00
Martin Mayer 4bbc640763 OCP.1: Fix Notification Context Parsing
The notification context field was parsed as a 4-byte fixed-length field but is defined as type OcaBlob (variable length).
This fix parses the notification context as an OcaBlob parameter while maintaining the field `ocp1.context`.
2022-12-14 15:54:10 +00:00
Jim Young dfa387d405 file-pcapng: Add Darwin Flow ID and Wake Packet flag 2022-12-14 15:52:26 +00:00
John Thacker 925904d6ce pkixqualified: Clear the oid at the start of each QCStatement
Clear the object_identifier_id global at the beginning of
each QCStatement, in case the statementId BER has errors and
does not put a value in the ptr. (call_ber_oid_callback correctly
handles being passed a NULL.)

Fix #18552.
2022-12-14 15:51:09 +00:00
Brian Sipos 9866cf3bad BPv7: Add conversation and endpoint tracking
This adds BPv7 source and destination as first-class text addresses for the packet.
This fixes proto-data used for decode-as table editing outside of a layer.
2022-12-14 15:44:36 +00:00
David Perry c6abd4ff7b Support SCTP over DTLS 2022-12-14 14:06:06 +00:00
Peter Dobransky 2d9e8416da OAM: Add support for missing DPoE and 1904.1 attributes
Add support for several DPoE and IEEE 1904.1 OAM attributes and
enhanced the decoding of several others.
2022-12-14 13:07:58 +00:00
David Fort bf158b3e41 tpkt: don't have the heuristic enforce TPKT dissecting
Most RDP connections starts with TPKT and then switch to TLS, so enforcing TPKT
for the whole conversation makes the decoding fail.
2022-12-14 12:00:47 +00:00
David Fort d90d525dd7 tls: do not enforce the TLS dissector for the whole connection
In the case of RDP traffic, the conversation usually starts with 3 TPKT packets
and then switch to TLS. The SSL dissector was setting the conversation dissector
without specifying any start packet which were leading to have the 3 first packets
interpreted as invalid SSL records (which they are as it's TPKT packets). This patch
fixes by specifying the first true SSL packet.
2022-12-14 12:00:47 +00:00
David Fort d560ae612a rdpudp: support desegmentation
The RDPUDP protocol transports TLS or DTLS records, but as the payload of RDPUDP is small,
most of the time records are splitted over multiple RDPUDP packets. This patch adds
support for desegmentation in RDPUDP so that we interpret the results of the SSL
dissector and we can give back untreated content when dissecting the next packet.
2022-12-14 12:00:47 +00:00
David Perry 8513da747d BGP: improve PDU handling 2022-12-14 09:22:34 +00:00
Gerald Combs dcf00fc3bd NCP: Add offset overflow checking.
Add and use check_offset_addition, which adds an expert item and throws
an exception if we're about to overflow our offset.

Fixes #18720
2022-12-14 08:57:44 +00:00
John Thacker 10666fb7c3 UMTS RLC: AMD and UMD PDUs can be larger than 255 bytes
AMD and UMD PDUs can be larger than 255 bytes, so the
offset should not be stored in a guint8. Otherwise,
the offset overflows and the last 256 bytes of the PDU
are added as an extra "fragment."
2022-12-14 08:56:56 +00:00
João Valverde 358641a5ca SIP: Fix fixed buffer UTF-8 string truncation
Fixes #18699
2022-12-14 08:56:26 +00:00
Alexis La Goutte 37c400afe3 usb-ccid: fix mask found by check_typed_items_calls
epan/dissectors/packet-usb-ccid.c filter= usbccid.dwFeatures.stopIccClk  - mask has odd number of digits 0x100 expected max for FT_BOOLEAN is 8
epan/dissectors/packet-usb-ccid.c filter= usbccid.dwFeatures.nadValNot0accept  - mask has odd number of digits 0x200 expected max for FT_BOOLEAN is 8
epan/dissectors/packet-usb-ccid.c filter= usbccid.dwFeatures.autoIfsd  - mask has odd number of digits 0x400 expected max for FT_BOOLEAN is 8
2022-12-13 14:16:11 +00:00
Alexis La Goutte 594aaca250 usb-ccid: fix typo found by check_typed_item_calls
packet-usb-ccid.c:598 proto_tree_add_item called for hf_ccid_wLevelParameter  -  item type is FT_UINT8 but call has len 2
2022-12-13 14:16:11 +00:00
John Thacker 2fd04b6ba9 bpv6: Fix possible infinite loop
display_extension_block is supposed to return the current offset,
not the number of bytes remaining. The number of bytes remaining
can be less than the current offset and cause an infinite loop.

In the case of an error, set lastheader and return the current
offset in order to break out of the main processing loop.

Fix #18711.
2022-12-13 07:33:19 -05:00
Pascal Quantin 73866d3623 RoHC: fix dissection of IP version alternate encoding for IP profile
As specified in RFC 3843 chapter 3.1
2022-12-12 20:43:04 +00:00
John Thacker f0002e0e3d umts_fp: Handle absent checksums when there is no payload
3GPP TS 25.427 and TS 25.435 both say that the Payload CRC IE
may only be present if the frame contains payload for E-DCH
frames, even where the setup of the transport bearer indicated
that the CRC would be present otherwise. So if there's no payload
and the CRC is missing, treat that as missing-but-expected rather
than marking the packet as malformed.

Take the opportunity to switch to proto_tree_add_checksum, which
handles all the various cases. Ping #8859
2022-12-12 15:00:27 +00:00
John Thacker ec30a03387 usb-video: Validate encoding of fourcc
Don't add raw bytes as a string; convert to UTF-8.

Fix #18713.
2022-12-12 08:41:42 -05:00
Gerald Combs 3924162f00 [Automatic update for 2022-12-11]
Update manuf, services enterprise numbers, translations, and other items.

services failed.
2022-12-11 20:24:56 +00:00
Ludovic Rousseau 699e9162d8 CCID USB: decode PC_RDR_SET_PARAMS & RDR_PC_PARAMS
Add decoding of the abProtocolDataStructure part of the command and the
response.
2022-12-11 15:55:51 +01:00
Ludovic Rousseau 5a260568b6 CCID USB: Correctrly identify protocol number
The bProtocolNum field is at offset 9, not 8.
Offset 8 is already used for bError.
2022-12-11 15:55:51 +01:00
Tomasz Moń cf6fd1248f
USB: Fix Darwin source and destination handling
Set the direction based on request type in a similar manner as it done
for other URB types, i.e. set source to host on URB submit. Correctly
set bus number based on locationID upper 8 bits.

Fixes #16768
2022-12-10 19:40:34 +01:00
Guy Harris 17d7b7cb73 wslua_proto: document the init and prefs_changed functions.
Don't just indicate that they exist and are settable, indicate what the
*do*.

See https://ask.wireshark.org/question/29843/how-to-maintain-a-packetfile-specific-var/.
2022-12-10 02:49:52 -08:00
John Thacker 29c6f4ebf1 H224: Add for Decode As
Add H224 as a possible type for Decode As for RTP Payload Type

Fix #18680
2022-12-09 10:13:00 +00:00
Chien Wong 82a0a5215d ieee80211: Fix SAE Confirm dissecting
IEEE 802.11-2020, Section 12.4.7.6 says that an SAE Confirm message,
with a status code not equal to SUCCESS, shall indicate that a peer
rejects a previously sent SAE Confirm message. In this case, the Confirm
message may not carry a Send-Confirm field or a Confirm field, as
hostapd does. So we simply ignore possible fields following Status code.

Signed-off-by: Chien Wong <m@xv97.com>
2022-12-09 06:37:51 +00:00
Odysseus Yang c19f31247f MBIM: Remove repeated hf_mbim_ms_device_slot_mapping_info_map_count 2022-12-08 20:42:58 +00:00
John Thacker bcc77ab189 http-urlencoded: Optimize parsing
Use tvb_find_guint8 and tvb_ws_mepbrk to find the
token boundaries for www-form-urlencoded. Use tvb_memcpy
to copy groups of bytes that don't have special characters
like + or %.

This is considerably more optimized (e.g. find_guint8 uses
memchr) than the naive loop, and speeds up the relevant part
by up to 10x.

Also handle cases where value is empty and there is no =
by splitting on &, instead of looking for the next =.

Together with bd1f2cc996, fix #13779.
2022-12-08 02:28:37 +00:00
David Perry d3fd7a92ec PCEP: Stub in support for more objects 2022-12-07 18:53:51 +00:00
Moshe Kaplan f413260df9 WSLUA: Add new lua function register_packet_menu()
This adds support to Wireshark for custom context menus for packets, so
that when a packet's context menu is opened (e.g., by right-clicking),
Wireshark can support doing things like "run a program" or
"open a URL" with a field from the packet as a parameter. Note that
this is similar to ArcSight's integration commands feature.

For example, it could be used like the following:

```
ROBTEX_URL = "https://www.robtex.com/dns-lookup/"
local function search_robtex(...)
    local fields = {...};

    for i, field in ipairs( fields ) do
        if (field.name == 'http.host') then
            browser_open_url(ROBTEX_URL .. field.value)
            break
        end
    end
end
register_packet_menu("Search host in Robtex", search_robtex, "http.host");
```

Fixes issue #14998
2022-12-07 18:47:14 +00:00
Tomasz Moń bad5ae8c42
USB: Allow registering protocol specific dissectors
Formerly only the class specific dissectors could be registered for
bulk, control and interrupt endpoints. While this is sufficient for
major classes, there are some classes that only use one or two of
possible class/subclass/protocol triple values. Allow registering
specific triples so appropriate dissector can be automatically selected
based on CONFIGURATION DESCRIPTOR data.

Register DFU Run-Time and DFU Mode triples so user no longer needs to
manually set Decode As for USB DFU.
2022-12-06 16:36:18 +01:00
Tomasz Moń 2fcc819366
USBLL: Correctly handle last fragment retransmissions
Add fragment_add_check_with_fallback() and use it in USBLL dissector
instead of fragment_add_check() to avoid last fragment retransmissions
from being treated as separate transfers. With this change, the last
fragment retransmissions are correctly grouped together with the rest
of the transfer.

Only skip single fragment reassembly if retransmission is not possible
at the protocol level, i.e. for SETUP DATA0 (when it is not merged with
OUT data) and for isochronous transfers. The reassembly must not be
skipped for other transfers (especially for full-speed bulk) because
otherwise it wouldn't be possible to group retransmissions together with
the first data packet.

Do not use DATA0/DATA1 tracking for isochronous transfers. Isochronous
data cannot be retransmitted because there are no handshakes (there is
no ACK nor NAK after isochronous data packets).
2022-12-06 07:26:02 +01:00
Stig Bjørlykke 6558b58e58 dtls: Support Connection ID when using Block Ciphers
Add support for DTLS Connection ID when using Block Ciphers
with the deprecated extention type (53) from
draft-ietf-tls-dtls-connection-id-07.

Closes #18705
2022-12-05 14:05:34 +00:00
João Valverde b29ee628e2 IPv6: Remove some redundancies in address detail
The loopback and unspecified addresses are repeated. Keep
only the "special purpose" field, in accordance with the
IANA registry (and unlike RFC 4291) to remove the redundancy.

Add the "Unique Local Unicast" range to address space field,
also from the IANA registry.

Unique-Local and Link-Local are still repeated in both fields.
Oh well...
2022-12-05 13:39:38 +00:00
João Valverde d216f0a6e2 IPv6: Add special-purpose address detail
Add a field to show special purpose assignments listed in [1].

[1] https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
2022-12-05 13:39:14 +00:00
João Valverde f8d308e9af Kafka: Add more loop checks
Add a safeguard to limit the maximum number of iterations.

Do not allocate a new buffer for every loop iterations in a loop that
depends on the result of the decompression routine.

Either allocate the buffer once or free after use. Defensive programming
is more important than speed in this case.
2022-12-05 11:53:31 +00:00
Kevin Albertson 266a0d38b4 kafka: fix note of ZSTD_decompressStream return 2022-12-05 00:16:59 +00:00
Kevin Albertson 9412adf7bf kafka: stop decompressing once all input is consumed 2022-12-05 00:16:59 +00:00
John Thacker c36dde6e13 nxp_802154_sniffer: Add heuristics
UDP port 49999 is not IANA registered, so add some heuristics
to the NXP 802.15.4 sniffer so that it doesn't claim packets
from other protocols that have chosen that ephemeral port.

Don't return 0 after already adding things to the tree; do that
check in the heuristics.

Fix #18695
2022-12-04 23:51:10 +00:00
Gerald Combs 3b7df80a0a [Automatic update for 2022-12-04]
Update manuf, services enterprise numbers, translations, and other items.
2022-12-04 16:48:16 +00:00
Martin Mathieson eba1f048b3 E2AP: Use S-NSSAI field in KPM 2022-12-04 13:38:12 +00:00
João Valverde f96885ab06 IPv6: Add multicast scope and flags address detail 2022-12-04 12:57:49 +00:00
Martin Mathieson b7c3bae518 check_typed_item_calls: add check for add_bitmask fields 2022-12-03 17:15:24 +00:00
John Thacker bd1f2cc996 epan: Use realloc when extending the uncompressed buffer
tvb_uncompress initially allocates an output buffer of twice the
input size. It is typical to have a compression ratio of 2:1 or
5:1, but in the extreme case (lots of all identical bytes), 1030:1
is possible.

When extending the output buffer, instead of always malloc'ing
a new buffer and memcpy'ing the old buffer into it, call realloc,
which at least some (most?) of the time will extend the current
buffer in place instead. This should reduce the time to unzip
from always O(N^2) (where N is the compression ratio) to something
average case more like O(N) or O(N log N), depending on how often
it actually copies the data. It only really affects pathological
cases.

Related to #13779.
2022-12-03 13:00:28 +00:00
João Valverde 868313956f proto: Tweak admonition for proto_tree_add_string()
Try the clarify the distinction and implications of a string
value vs a string label.
2022-12-03 11:28:48 +00:00
João Valverde 32f88ad22c wmem: Remove strbuf max size parameter
This parameter was introduced as a safeguard for bugs
that generate an unbounded string but its utility for
that purpose is doubtful and the way it is being used
creates problems with invalid truncation of UTF-8
strings.

Rename wmem_strbuf_sized_new() with a better name.
2022-12-03 01:54:52 +00:00
Harald Welte 3311b34106 gsmtap: Support V5-in-GSMTAP
GSMTAP has had support for various other ISDN related protocols as
sub-types of the GSMTAP_TYPE_E1T1 type.  We've recently started to work
on V5 (ITU-T G.964/G.965) and introduced a new sub-type for this.

Let's add the related dispatch from packet-gsmtap.c to packet-v5ef.c
2022-12-02 16:49:20 +01:00
Peter Dobransky 8683c4e328 Add support for missing DPoE and IEEE 1904.1 OAM attributes
DPoE
- D-ONU Packet Buffer (0xD7000A)

IEEE 1904.1
- aReadWriteMACAddress (0x07/0x00-1D)
- aPhyType (0x07/0x00-20)
- aAutoNegotiationAdminState (0X07/0x00-4F)
- aMACControlFunctionsSupported (0x07/0x00-5D)
- acConfigMulticastLlid (0xD9/0x01-07)
2022-12-02 08:35:02 +00:00
John Thacker 13823bb105 openflow_v6: Prevent infinite loops in too short ofp_stats
The ofp_stats struct length field includes the fixed 4 bytes.
If the length is smaller than that, report the length error
and break out. In particular, a value of zero can cause
infinite loops if this isn't done.
2022-12-01 21:18:12 -05:00
John Thacker 0e11932183 kafka: Don't try to decompress if the length is zero.
There's no point in trying to decompress a message with
length zero, and some of the third party decompression
libraries (e.g. zstd) can give unexpected results that
lead to infinite loops if we do so. A message length zero
is almost surely a file with errors.
2022-12-01 20:43:39 -05:00
João Valverde 967a3c3df9 Qt: Check field autocomplete for syntactical validity
Currently the autocompletion engine always suggests a protocol
field completion, even in places where it isn't syntactically
valid.

Fix that by compiling the preamble to the token under the cursor
and checking the returned error. If it is DF_ERROR_UNEXPECTED_END
that indicates a field or literal value was expected. Otherwise
a field replacement is not valid in this position.

Fixes #12811.
2022-12-01 22:50:09 +00:00
Tomasz Moń 5853886d50
reassembly: Store pointer to first gap
Store pointer to first gap to reduce number of full list traversals
needed when linking new fragments. When all captured fragments are in
order, the first gap is effectively pointing to list tail. The best case
scenario, where the list traversals are completely eliminated, happens
every time for protocols that always have the fragments ordered (most
notably USBLL Full-Speed capture containing Bulk OUT transfers with
a lot of retransmissions).

The memory usage is increased by a single pointer and 32-bit contiguous
length counter per fragment head. The additional CPU usage is constant
per insertion, i.e. does not increase with the number of fragments in
the list.

Fixes #17311
2022-12-01 20:14:40 +01:00
John Thacker 8623cd9746 icmpv6: Format DNS name as UTF-8 for output
DNS names technically have arbitrary unknown encoding.
When adding them as a string for output, format as UTF-8.

Fix #18689
2022-12-01 08:23:51 -05:00
John Thacker f2a0d25dba bpv6: Prevent infinite loops
display_extension_block is supposed to return the current offset,
not the number of bytes remaining, which can be less than the current
offset and cause an infinite loop. In the case of errors, set
lastheader and return the current offset to break out of loops.
2022-12-01 01:40:17 +00:00
Bernhard Dick 415296436b DECT-MITEL-ETH: Fix #18683
Adds missing NULL-termination in headerfield list in
dissect_dect_mitel_eth_mac_con_ind and removes handover to general data
dissector as this is path is no longer reached due to handling the
different message types within this dissector.
2022-11-30 23:53:34 +01:00
João Valverde b116ccd6d5 dfilter: Replace compile booleans arguments with a bit flag 2022-11-30 17:36:17 +00:00
João Valverde 84e75be5c6 dfilter: Add optimization flag
When we are just testing code to see if it compiles performing
optimizations is wasteful. Add an option to disable them.
2022-11-30 17:36:17 +00:00
Joakim Karlsson 4b0bf62791 asn2wrs: disable template line directive by default
Same as with !8955, To debug with line directive build with
-DENABLE_DEBUG_A2W=ON flag
2022-11-30 17:31:46 +00:00
João Valverde 729ea56b46 wmem: Remove wmem_strbuf_new_label()
Only dissectors are using this function and there is no use case,
as far as I know, that requires its use. Any limitation of length
is imposed transparently by the UI backend.

This function is problematic because it is not Unicode aware and
will truncate a string on an arbitrary byte boundary for multibyte
strings.

Replace its use with a normal strbuf without a length limite and
remove the function because it is not useful and the ITEM_LABEL_LENGTH
parameter does not belong in wmem anyway.
2022-11-30 15:55:54 +00:00
João Valverde 93814ef740 dfilter: Always set error pointer in case of failure 2022-11-30 15:00:34 +00:00
John Thacker 8a67ca77e6 http: Check CitrixAGBasic Auth encoding
CitrixAGBasic Authentication has Base64 encoded values. The result of
Base64 decoding is not guaranteed to be valid UTF-8 (or ASCII), so
verify it.

Also add the username and password to the credentials tap.

Fix #18677.
2022-11-30 07:54:01 -05:00
John Thacker 10c84b6450 HTTP2: Load dynamic hf entries when UAT is changed
The dynamic hf entries for HTTP2 read from the UAT should be
changed when the UAT is changed or reset, not on each file
load and file close. If a field is added as a column, coloring
rule, or filter, and the capture file is changed, deregistering
the field and reregistering it can cause a crash.

Use the same approach as with HTTP and SIP, slightly modified
because in HTTP2 the header fields hash contains the static
headers as well, to prevent adding duplicate entries via the UAT.

Fix #14768
2022-11-30 11:04:05 +00:00
Joakim Karlsson 5b8cb733fa asn2wrs: disable line directive by default
To debug with line directive build with -DENABLE_DEBUG_A2W=ON flag
2022-11-30 11:03:09 +00:00
Martin Mathieson c69d0114ea tools/check_static.py - fix remaining errors 2022-11-30 08:49:38 +00:00
Martin Gallo 129ed6d4c4 SAPSNC: Added SAP SNC as main dissector 2022-11-29 13:34:38 +00:00
John Thacker 9a19d48736 CIMD: Implement User Data encoding
When CIMD indicates that a message was sent in the 7 bit GSM alphabet,
each character has been converted to ASCII or ISO-8559-1 with the
use of combining escape sequences for characters not present in
the destination encoding. Properly convert back to GSM 7 bit encoding
and then to UTF-8 for display.

Fix #18676.
2022-11-29 07:02:26 -05:00
João Valverde f6e850af47 AJP13: Remove odd use of ITEM_LABEL_LENGTH 2022-11-29 10:22:44 +00:00
João Valverde a0d77e9329 dfilter: Return an error object instead of string
Return an struct containing error information. This simplifies
the interface to more easily provide richer diagnostics in the future.

Add an error code besides a human-readable error string to allow
checking programmatically for errors in a robust manner. Currently
there is only a generic error code, it is expected to increase
in the future.

Move error location information to the struct. Change callers and
implementation to use the new interface.
2022-11-28 15:46:44 +00:00
Bernhard Dick 7fc7830b13 DECT-MITEL-ETH: gint -> int for hf 2022-11-28 15:04:15 +00:00
Bernhard Dick 7cde243a66 DECT-MITEL-RFP: gint -> int for hf 2022-11-28 15:04:15 +00:00