Commit Graph

43665 Commits

Author SHA1 Message Date
João Valverde 07371d4557 dfilter: Split tostr() into debug and pretty print 2021-10-11 21:55:45 +00:00
João Valverde 5dd90e3b30 dfilter: Cache stnode_tostr()
This avoids having to save/free the pointer for each tostr()
invocation (or leak memory).
2021-10-11 21:55:45 +00:00
Guy Harris c2b6a27e97 autosar_nm: get rid of unused protocol IDs.
We fetch the protocol IDs for several protocols, but use none of them.
Get rid of them.
2021-10-11 20:44:41 +00:00
Lin Sun fdd1a82ed9 packet-btmesh: fix build without GCRYPT 2021-10-11 19:10:41 +00:00
João Valverde 5481bffa5c proto: Check for reserved keywords in filter names 2021-10-11 19:15:26 +01:00
Dr. Lars Völker 7f9b8874b5 BPSEC, BPv7, COSE: Bugfix MacOS build
The usage of PRIi64 and PRIu64 may lead to failed builds on MacOS - at
least it did for me.

This patch fixes this.
2021-10-11 11:58:23 +02:00
Martin Mathieson a5df18e51e Fix some spelling errors 2021-10-11 04:44:49 +00:00
João Valverde 041aa24a37 ftypes: Rewrite FT_PROTOCOL comparison operator
For efficiency do the comparison in a single function call
instead of trying to preserving exactly the previous semantics.

Still I tried not to deviate much.
2021-10-10 20:48:29 +00:00
João Valverde 13e9e7199c ftypes: Use an order function to compare ftypes
All the order operators can be defined in terms of 'lt'
and 'eq' so use that to reduce the number of required
methods from 6 to 2.

Further reduce to one by combining those two into a single
function that has memcmp semantics: negative return is
"less than", positive is "greater than" and zero is equal.
2021-10-10 20:48:29 +00:00
Dr. Lars Völker 9aa87dae84 TECMP: Bugfix: TECMP should not decode NULL frames
Null frames are frames with invalid data. This patches makes sure that
the invalid data is not further dissected.

Closes #17644

Bug present since Wireshark 3.4.
2021-10-10 20:16:13 +00:00
Dr. Lars Völker 0d276b47d1 AUTOSAR NM: Bugfix: wrong filters for user defined elements
When UDP-NM was renamed into AUTOSAR-NM (as well as filename changed)
the author of that patch missed the dynamic filters. This patch fixes
this oversight and makes sure all filters of AUTOSAR NM start with
"autosar-nm.".

Fixes #17643
2021-10-10 20:00:15 +00:00
Brian Sipos ce0592514c BPv7: Add Bundle Protocol version 7 and BPSec dissectors from dtn-wireshark 2021-10-10 13:27:17 +00:00
John Thacker 35d09a7854 BT-DHT, BT-uTP: Use conversation_set_dissector_from_frame_number
Since the UDP connection switches back and forth between DHT and uTP,
use conversation_set_dissector_from_frame_number so that the dissector
called by try_conversation_dissector in packet-udp.c doesn't change for
a given frame based on the last packet clicked in the GUI.

Split out a heuristic dissector from uTP so that conversation_set_dissector
is only called from the heuristic dissector.

This doesn't make a difference when the heuristics are accurate but
might in some edge cases.
2021-10-10 11:31:06 +00:00
David Fort faf6fabfe3 rdpudp: update parsing of AckVec packets to last spec
Last version of MS-RDPEUDP2 has detailled the interpretation of ackvec packets. The
patch also adds the interpretation of ack vector items (bitmap or RLE encoded).
2021-10-10 09:59:44 +00:00
Dr. Lars Völker 08a8429125 TECMP: Bugfix wrong payload length for payloadtvb
The TECMP dissector did not set the length to the correct value but by
accident just used all bytes present. This is not correct.

This bugfix is for Wireshark 3.4 and newer.

Closes #17638
2021-10-10 06:49:22 +00:00
Dr. Lars Völker a534b7aed0 ISO15765: Bugfix, LIN config influenced CAN
This patch fixes the update_config routine, which turned off the CAN
config, when LIN diagnostic frame parsing is deactivated.

Closes #17639
2021-10-10 06:33:15 +00:00
John Thacker ac9e95acca BT-uTP: Strengthen heuristic
Strengthen the heuristic, including fixing a typo, disabling via
preference the pre-release "Version 0" of the protocol that hasn't been
supported by any clients for a decade, and putting a limit on the maximum
window size by default via preference. This might be enough to enable it
by default, but hold off on doing so for until more testing.

Also fix a couple of typos and add unit strings.
2021-10-09 13:06:44 +00:00
Chris Caldwell ee6d020288 OptoMMP: Added expanded memory ranges and descriptions.
Added the expanded memory ranges and descriptions as found in Opto 22's document on the OptoMMP Protocol Guide at: https://documents.opto22.com/1465_OptoMMP_Protocol_Guide.pdf
Removed trailing new-line at end of file.
2021-10-08 20:25:40 +00:00
João Valverde 2c701ddf6f dfilter: Improve grammar to parse ranges
Do the integer conversion for ranges in the parser. This is more
conventional, I think, and allows removing the unnecessary integer
syntax tree node type.

Try to minimize the number and complexity of lexical rules for
ranges. But it seems we need to keep different states for integer
and punctuation because of the need to disambiguate the ranges
[-n-n] and [-n--n].
2021-10-08 19:18:56 +01:00
João Valverde 9d87c4712e dfilter: Fix parsing of value strings
If we have a STRING value in an expression and a numeric comparison
we must also check if it matches a value string before throwing
a type error.

Add appropriate tests to the test suite.

Fixes 4d2f469212.
2021-10-08 18:53:15 +01:00
John Thacker 39e0b3155f RPC: Don't defragment without the entire fragment
If the RPC dissector doesn't have all the bytes of the a fragment
and thus needs to do TCP desegmentation, but can't or won't for some
reason, then don't try to defragment either, regardless of what the
defragmentation preference says.  Fix #11198.
2021-10-08 06:10:46 +00:00
John Thacker 3757b69f2d lisp: convert get_addr_str to use pinfo->pool 2021-10-08 04:17:28 +00:00
João Valverde 92285e6258 dfilter: Improve grammar to parse functions
A function is grammatically an identifier that is followed by '(' and ')'
according to some rules. We should avoid assuming a token is a function
just because it matches a registered function name.

Before:
  Filter: foobar(http.user_agent) contains "UPDATE"
  dftest: Syntax error near "(".

After:
  Filter: foobar(http.user_agent) contains "UPDATE"
  dftest: The function 'foobar' does not exist.

This has the problem that a function cannot have the same name
as a protocol but that limitation already existed before.
2021-10-08 04:01:24 +00:00
João Valverde db85625af9 dfilter: Rewrite ws_assert_magic() again 2021-10-08 04:01:24 +00:00
João Valverde 541d45fc6f dfilter: Remove no-op statement 2021-10-08 04:01:24 +00:00
John Thacker dbf5782b70 BT-DHT: Support BEP 42, DHT Security Extension
Properly support BEP 42: the 'ip' string includes the port, so the
expected length is 6 octets, not 4. That key also appears on the top
level, and sorts before the 'r' key, so add it to heuristics.

Take the opportunity to strengthen the heuristics; certain other keys
never sort before others, and we know the types of several of the keys.
That allows us to go from seven possibilities for the first four bytes
to four possibilities for the first five bytes, which is surely precise
enough to enable the heuristic by default.

Sort the value_strings.
2021-10-08 03:45:22 +00:00
João Valverde 4d2f469212 dfilter: Use exceptions for error handling in semcheck
Instead of checking for an error return and throwing the exception
then do it where the errors occurs. This takes advantage of the nice
properties of error exceptions to reduce the amount of error
checking code.
2021-10-07 23:01:50 +00:00
João Valverde 5fcdf25697 dfilter: Generalize special case of one byte literal
Instead of only accepting a byte literal specification if the LHS is a
len-1 byte string, accept it everywhere bytes are wanted.

Before:
  $ dftest "frame[1] contains 0x01"
  Filter: frame[1] contains 0x01

  Constants:
  00000 PUT_FVALUE	01 <FT_BYTES> -> reg#2

  Instructions:
  (...)

  $ dftest "frame[1:4] contains 0x01"
  Filter: frame[1:4] contains 0x01
  dftest: "0x01" is not a valid byte string.

After:
  $ dftest "frame[1:4] contains 0x01"
  $ Filter: frame[1:4] contains 0x01

  Constants:
  00000 PUT_FVALUE	01 <FT_BYTES> -> reg#2

  Instructions:
  (...)
2021-10-07 23:01:50 +00:00
Martin Mathieson d8b28f8040 Fix some field mask widths. 2021-10-07 21:33:49 +00:00
João Valverde 9dab2280ca dfilter: Fix parsing of octal character escape sequences
Octal escape sequences \NNN can have between 1 and 3 digits. If
the sequence had less than 3 digits the parser got out of sync
with an incorrect double increment of the pointer and errors out
parsing sequences like \0, \2 or \33.

Before:
  Filter: ip.proto == '\33'
  dftest: "'\33'" is too long to be a valid character constant.

After:
  Filter: ip.proto == '\33'

  Constants:
  00000 PUT_FVALUE	27 <FT_UINT8> -> reg#1

  Instructions:
  00000 READ_TREE		ip.proto -> reg#0
  00001 IF-FALSE-GOTO	3
  00002 ANY_EQ		reg#0 == reg#1
  00003 RETURN

Fixes #16525.
2021-10-07 18:44:37 +00:00
Evan Huus 0eda51a646 to_str: scope tvb_ip6_to_str 2021-10-07 13:31:23 -04:00
Michail Koreshkov 086feb2f09 Ignore length of data parameter in DT1 message
Some upper level tracing tool writes message in single DT1 even
length of data greater than 255 bytes.
2021-10-07 16:01:22 +00:00
Evan Huus 07f5472aa7 to_str: scope tvb_ip_to_str 2021-10-07 10:25:12 -04:00
Anders Broman 83446c4719 LTE-RRC: Add a couple of more "protocols". 2021-10-07 12:22:26 +00:00
Roy Zhang c946ee3686 5G LI: Add dissector for 5G Lawful Interception
packet-li5g.c used to parse the LI x2/x3 PDU header which defined in ETSI TS 103 221-2
lix2 used to parse the x2 xIRI payload, the ASN.1 defined in 3GPP 33.128.

Add the dissector generated by asnwer

will merge this file in a new request, so, delete it from the 5G LI branch

Add a comment line stating the 3gpp document in lix2.asn

fix the commit warning
2021-10-07 03:53:50 +00:00
John Thacker ca5a45428f SMPP: Handle unaligned PDUs better
Test to see if the start of a packet looks like SMPP before
calling tcp_dissect_pdus, so that we don't calculate a bogus
length (and fail to process many packets) if the capture
starts in the middle of a TCP connection.

When the heuristic dissector has found SMPP, mark it as a
conversation with the SMPP dissector.

There's room for more improvement by scanning through the current
segment to look for the PDU start, but this makes it work
considerably better, at least as well as 1.10.x. Improves #11306.
2021-10-07 03:37:56 +00:00
João Valverde e4e0b97082 dfilter: Use wslog with ws_assert_magic() 2021-10-06 15:44:48 +00:00
João Valverde 8c5a4f9100 dfilter: Replace node accessor macros with functions
Replace macro magic to improve ease of comprehension and maintenance.
2021-10-06 15:44:48 +00:00
João Valverde a7242733a4 dfilter: Fix ws_assert_magic() macro
We need to use WS_DISABLE_DEBUG, not WS_DEBUG.

Fixes 0e50979b3f.

Rename some lingering assert_magic() references.
2021-10-06 15:44:48 +00:00
João Valverde 5f8ab69cb5 Windows: Fix stdint.h redefinition warnings
We must include the headers, particulary stdint.h, at the top of
scanner.l so that the stdint.h defintions precede flex's own
replacements.
2021-10-06 16:03:19 +01:00
Stig Bjørlykke e3ba0c5ea5 lwm2mtlv: Decode Location Velocity
Decode Location Velocity opaque value according to 3GPP GAD spec,
using dissect_description_of_velocity().
2021-10-06 14:13:19 +00:00
Stig Bjørlykke d3695f8b53 gsm_a: Fix dissect_description_of_velocity()
Several improvements to dissect_description_of_velocity()
- Velocity Type is first 4 bits, do not increase offset after this
- Direction of Vertical Speed is bit 7
- Only increase curr_offset in this function
2021-10-06 13:52:30 +00:00
João Valverde 4804c1224d dfilter: Use syntax tree node replacement semantics
Instead of using 3 operations (new + free + reassign_to_parent) to transform
the tree use a simpler single replace operation instead.

This also avoids having to manually copy token values.

The set search and replace method is now obsolete.
2021-10-06 10:34:21 +00:00
Martin Mathieson af19fc795a Add NGAP Stats. 2021-10-06 09:26:42 +00:00
Oscar Gonzalez de Dios 7bdfa653a1 PCEP: Added support of draft-ietf-pce-segment-routing-policy-cp-05
added SR Policy Name TLV
added SR Policy Candidate Path Identifiers TLV
added SR Policy Candidate Path Name TLV
added SR Policy Candidate Path Preference TLV
Extended Association ID TLV format for assoc_type 6 included

Removed development comments and formatted code

Association type field values are displayed, according to IANA registered values

fixed filters for extended-association-id TLVs
2021-10-06 04:21:06 +00:00
John Thacker 9ae0d3c4f1 BSSAP: Use VLR number field
For some reason (copy and paste?) the SGSN number field was substituted
for the VLR number field, and then later the latter got commented out
as it was being unused.
2021-10-06 04:04:04 +00:00
Anders Broman d2dff29c83 NR RRC: Make more PDUs set col and proto. 2021-10-06 03:08:22 +00:00
Brian Sipos bc3bced07d COSE: Handle indefinite tstr/bstr encodings 2021-10-05 21:11:36 +00:00
João Valverde 7bf02254c1 dfilter: Rename function production rule
Make it more obvious that entities are also functions.
2021-10-05 19:19:36 +01:00
João Valverde a940318f37 dfilter: Minor grammar fixups
Clean up syntax error code. TEST and SET are never returned by
the tokenizer.

Remove unnecessary range_body() grammar element. Fix a comment.

Move the stnode_token_value() function to its proper place.
2021-10-05 17:56:21 +01:00