Commit Graph

43009 Commits

Author SHA1 Message Date
João Valverde ff9acff6f2 Replace usage of GLogLevel flags everywhere
ws_log_domains.h needs to be included before wslog.h to be used
to define WS_LOG_DOMAIN. Also the definition for enum ws_log_level
needs to be exported for other APIs so move that to ws_log_domains.h
and rename the file to ws_log_defs.h to reflect the new scope.
2021-06-17 12:00:10 +01:00
Isaac Boukris d2c3489d79 Revert "test"
This reverts commit af3a9d72d9.
2021-06-17 10:14:55 +03:00
Isaac Boukris af3a9d72d9 test 2021-06-17 05:05:59 +00:00
Isaac Boukris dd39d9b46a credssp: add basic dissection of TSRemoteGuardCreds
as per MS-CSSP 2.2.1.2.3
2021-06-17 05:05:59 +00:00
Adrian Granados 5852954828 ieee80211: Fix validation of subelements in the Multiple BSSID IE.
The IEEE Std 802.11ax-2021 amendment relaxes the requirements for
elements included in the Nontransmitted BSSID Profile subelement:

"Any element specific to the BSS or with content that is different
from the transmitted BSSID" can be included as a sublement.

However, it also enumerates elements that should not be included in the
Nontransmitted BSSID Profile subelement, including some extended element
IDs.

Thus, I've changed the add_tagged_field function to be more comprehensive, so that:

a) it can use the list of elements IDs to check for valid OR invalid element IDs
b) it defines necessary arguments for also checking valid OR invalid extended element IDs

The original function declaration is kept as it is, and the implementation calls the
new function, add_tagged_field_with_validation.

An alternative implementation of this change would be to have
the Multiple BSSID dissector implementation skip the check for invalid
element IDs in the Nontransmitted BSSID Profile subelement,
hence not requiring any changes to the add_tagged_field function.

However, for completeness, the add_tagged_field function should check for
valid extended element IDs in the same way it can check for valid element IDs,
and this commit provides it.
2021-06-16 15:05:33 +00:00
João Valverde dcc02b1003 dissectors: Replace g_log() with ws_log() 2021-06-16 12:50:28 +00:00
João Valverde 39df3ae3c0 Replace g_log() calls with ws_log() 2021-06-16 12:50:27 +00:00
Tomas Kukosa 4c4bb915c8 ITS: fix displaying of curvature unavailable value 2021-06-16 12:34:06 +00:00
Joakim Karlsson e22b9733cf GTPv2: make dissect_diameter_3gpp_uli public for custom dissectors 2021-06-16 13:59:44 +02:00
Martin Mathieson 6b0cfb703a netlink-route: Fix a couple of spellings 2021-06-16 10:58:56 +00:00
Joakim Karlsson 72193d037f NGAP: add more N2SmInfoType 2021-06-16 09:38:36 +00:00
Guy Harris 25a254823f wsutil: add a header that defines some "round to power of 2" macros.
Add macros to round to multiples of 2, 4, 8, 16, and 32.

Use them instead of independently defined macros.

(We don't define a general "round to a power of 2" macro to avoid the
risk of somebody passing something other than a power of 2 to it.)
2021-06-16 02:01:23 -07:00
John Thacker f541e5e769 MP2T: Catch exceptions thrown by reassembled fragments and continue
A TS packet can contain the end of a previous fragmented higher level
packet and the start of a new higher level packet. If an exception
is thrown in the first reassembled packet, catch it and continue to
process the start of the next. This is particularly likely when there
are dropped or out of order frames, since there are no fragment IDs,
just continuous streams (multiplexed by PIDs.) Similar to #13238,
but at a slightly different place in the protocol.
2021-06-16 08:00:01 +00:00
Guy Harris 6c043d5c73 wslua_tvb: fix documentation for reported_length_remaining().
In the past, tvb_reported_length_remaining(), and thus
Tvb:reported_length_remaining(), may have returned -1 if the offset was
invalid.  That's no longer the case; the former returns 0, and, as the
latter just returns the former's return value, that's true of the latter
as well.
2021-06-16 00:43:07 -07:00
Guy Harris bd9ceaebef wslua: a tvbuff doesn't have an "actual length".
It has a "reported length", which is the closes thing to an "actual
length", as it represents the length the packet, or subset thereof, had
on the network, and a "captured length", which is the amount of the
packet that the capture process saved.

In 99.999999999999999999999999999999% of all cases, a dissector should
look at the "reported length", not at the "captured length".

Rename the "len" method to "captured_len", leaving "len" around for
backwards compatibility.

Fix the documentation to reflect reality, to avoid issues such as #15655.
2021-06-16 07:12:12 +00:00
Adrian Granados 4fdf3f1038 ieee80211: Improve HE 6 GHz Capabilities IE dissector
Fixes field names and sets field values to be consistent
with equivalent HT and VHT capabilities fields as indicated
in the IEEE Std 802.11ax-2021 amendment.
2021-06-16 06:30:43 +00:00
Guy Harris 6771252f1b netlink: don't use -1 to mean "to end of packet".
Add dissect_netlink_attributes_to_end(), which takes no length argument,
and uses tvb_ensure_reported_length() to get the remaining length in the
packet.

In dissect_netlink_attributes_common(), treat negative lengths as if
they were a positive length >= 2^31, and throw a reported bounds error.

Also, throw a bounds error if there's more padding to a 4-byte boundary
than there is data in the packet.

At that point, we know the length is positive, so assign it to an
unsigned variable and use *that* in the loop.  Throw an error if the
attribute goes past the end of the packet (although we presumably would
have done that already).

(We really should eliminate all use of -1 as "to the end", and make
lengths unsigned.  We should also get rid of any places where we're
using negative offsets as offsets from the end of the packet - in the
few cases where you're dealing with trailers, you want to do that
carefully, so as not to throw an exception dissecting the trailer before
you get around to dissecting the rest of the packet - and make offsets
unsigned as well.)
2021-06-15 14:56:26 -07:00
Guy Harris e5ce3345db tvbuff: add tvb_ensure_reported_length_remaining().
It is to tvb_reported_length_remaining() as
tvb_ensure_captured_length_remaining() is to
tvb_captured_length_remaining() - it throws an exception if the offset
is out of range.

(Note that an offset that's just past the end of the {reported,
captured} data is *not* out of range, it just means that there is no
data remaining.  Anything *past* that is out of range and thus invalid.)
2021-06-15 13:32:46 -07:00
Joakim Karlsson 9be67f167f NAS 5GS: add support for more binary IEs
TS 29.502 ch6.1.6.4.4 n1SmInfoFromUe, n1SmInfoToUe, unknownN1SmInfo
2021-06-15 16:33:56 +00:00
Martin Gallo 85df6d0273 Kerberos: Add support for MS-KILE Key List Request messages
This adds the MS-KILE pre-authentication data types KERB-KEY-LIST-REQ [161] and KERB-KEY-LIST-REP [162] as per the latest Microsoft' Open Specifications.
Keys obtained from KERB-KEY-LIST-REP are learnt and saved for further use in other packets.

References:
- [MS-KILE] 2.2.11 KERB-KEY-LIST-REQ https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-kile/a8198db9-b537-4256-b903-80a716540398
- [MS-KILE] 2.2.12 KERB-KEY-LIST-REP https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-kile/38a494fc-2885-47eb-b008-3a1b574f3614
- [MS-KILE] 3.3.5.7.8 Key List Request https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-kile/732211ae-4891-40d3-b2b6-85ebd6f5ffff
2021-06-15 14:51:07 +00:00
Constantine Gavrilov 01de470856 NVMe: fix for parsing data for logpage NVMeOF Discovery.
Take into acoount reported number of records.
Thus, discard extra payload, it target has not truncated response.
2021-06-15 17:01:01 +03:00
David Fort e43d26b39e rdp: many improvements and fixes
This big patch addresses the following items:

* implement the "message" virtual channel so that multi-transport and bandwidth
PDUs are dissected;
* prepare the identification of static channels to be able to dissect them later;
* fix the compression field in channelPDUHeader.channelFlags;
* implement the drdynvc channel dissector, so now we decode the traffic on this
channel and we're able to track data on dynamic channels and transition to UDP
transport
2021-06-15 08:42:47 +00:00
Constantine Gavrilov 6ba703cba7 MVMe: append command names for commands, responses and transfers to Info column. 2021-06-15 08:27:16 +00:00
Nardi Ivan 50d878b92a HTTP3: add very basic support for PRIORITY_UPDATE frames 2021-06-15 06:11:17 +00:00
Guy Harris d92a4bfd90 netlink-route: don't dissect attributes for legacy messages.
They don't include any attributes - they're not large enough to contain
anything other than the netlink message header and the one-byte address
family.  For legacy messages, the attribute we hand to
dissect_netlink_route_attributes() is not aligned on a 4-byte boundary,
as it's the offset right after the 1-byte address family value;
dissect_netlink_route_attributes() will try to align that on a 4-byte
boundary, but that will go past the "immediately after the end of the
packet" offset, which can cause problems if any checking is done to make
sure the offset is valid.  Therefore, we don't try to dissect the
attributes, rather than relying on the attributes dissector to discover
that there's nothing left in the packet.
2021-06-14 22:24:52 -07:00
Guy Harris 9aa128c45d netlink-route: the padding is there, but not in the message length.
The message length for legacy netlink route messages doesn't include the
padding in question.
2021-06-14 12:31:32 -07:00
Martin Mathieson d9c150169d NVME: fix typo 2021-06-14 09:22:17 +01:00
Martin Mathieson 8e099bb0c7 print.c: add length check to loop
Note that it was impossible to actually overflow
the buffer, and there is a check to flush and restart
if it gets to within a few bytes of the end, but static
analyzers (CID: 1477927) are unlikely to be able to work
this out.
2021-06-14 07:03:49 +00:00
Thomas Dreibholz 7ee68a7904 Added statistics for ScriptingServiceProtocol (SSP). 2021-06-14 06:41:44 +00:00
Thomas Dreibholz e204bb3205 Added statistics for PingPongProtocol. 2021-06-14 06:41:44 +00:00
Constantine Gavrilov 74a3fac004 NVMeOF: rename fields to pass code validation. 2021-06-14 06:21:46 +00:00
Constantine Gavrilov 5d35e28e45 NVMeOF: complete decoding of fabric commands.
Add support for:
* Authentication Send
* Authentication Receive
* Disconnect
2021-06-14 06:21:46 +00:00
Constantine Gavrilov c7e082c6de NVMe: use common block for decoding CQEs for fabric and IO commands. 2021-06-14 06:21:46 +00:00
Constantine Gavrilov 8bc0924c25 NVMeOF fabric commands: simplify decoding code using field definitions. 2021-06-14 06:21:46 +00:00
Constantine Gavrilov 45201049e0 NVMeOF fabric commands: switch TCP dissect to common NVMe code. 2021-06-14 06:21:46 +00:00
Constantine Gavrilov 0b101d54da NVMeOF fabric commands: support offset in commands and completions dissectors. 2021-06-14 06:21:46 +00:00
Constantine Gavrilov d576719df4 NVMeOF: move handling of NVMeOF fabric commands, fabric completions and fabric command transfers to packet-nvme.c.
RMDA implementation is moved to packet-nvme.c, will become common implementation.
2021-06-14 06:21:46 +00:00
Constantine Gavrilov c47294197e NVMEoF: rename rdma fields names to nvmeof.
This is a preparation step to move NVMeOF parsing to generic code.
2021-06-14 06:21:46 +00:00
Constantine Gavrilov 7874e01686 NVMeOF Connect command decoding fixes. 2021-06-14 06:21:46 +00:00
Moshe Kaplan 5e2a8f37f0 Avoid duplicating duplicated memory
No reason to call wmem_strdup() on newly-allocated
memory that is exclusively used for that call
and they both have wmem_packet_scope().
2021-06-14 05:22:45 +00:00
Guy Harris 9f18356888 netlink-route: handle the padding in legacy dump request messages.
The structure containing struct rtgenmsg in the message header also
includes a structure that's aligned on a 4-byte boundary, so there's 3
bytes of padding after the struct rtgenmsg.
2021-06-13 19:19:55 -07:00
Martin Mathieson 10d0a8fd8a IPSEC: free error string
Free error string that may be set during call to
esp_sa_record_add_from_dissector().

Fixes CID: 1485671
2021-06-13 19:58:06 +01:00
John Thacker 73256b3fb7 Remove lingering circuit API from stream.h
The circuit API was removed and replaced with the conversation
"_by_id" API that uses a single uint32 value by commit
800b26edbe

Remove the lingering references to circuits from the stream API,
since it's just used with conversations now.
2021-06-13 11:51:44 +00:00
Gerald Combs 13e5cff6e8 [Automatic update for 2021-06-13]
Update manuf, services enterprise numbers, translations, and other items.
2021-06-13 09:28:55 +00:00
Guy Harris 76174b19b0 file-pcapng: correctly check whether there are any options in the block.
Check whether the length of data remaining in the block content,
starting at the offset past the data preceding options, is > 0, don't
check whether the *total* block content length is > 0.
2021-06-12 15:58:56 -07:00
Guy Harris 14b695d9b3 file-pcapng: report different "block length too short" conditions differently.
Report "length less than the minimum length for a pcapng block"
differently from "length less than the block content of this block".
2021-06-12 15:25:52 -07:00
Adrian Granados 5b4e814221 ieee80211: fixes Hotspot 2.0 Indication IE dissector
Fixes mask for reserved field, and adds support for ver. number 3.x.
Also, renames "Release Number" to "Version Number" to match
latest WFA Passpoint specification document (ver 3.2).
2021-06-12 09:18:09 +00:00
Adrian Granados 3663277f07 ieee80211: Fix RNR IE field names
Fixes a few typos and makes sure field names in the RNR IE
match the IEEE Std 802.11ax-2021 amendment.
2021-06-12 08:47:08 +00:00
João Valverde dc7f0b88bb Refactor our logging and extend the wslog API
Experience has shown that:

  1. The current logging methods are not very reliable or practical.
A logging bitmask makes little sense as the user-facing interface (who
would want debug but not crtical messages for example?); it's
computer-friendly and user-unfriendly. More importantly the console
log level preference is initialized too late in the startup process
to be used for the logging subsystem and that fact raises a number
of annoying and hard-to-fix usability issues.

  2. Coding around G_MESSAGES_DEBUG to comply with our log level mask
and not clobber the user's settings or not create unexpected log misses
is unworkable and generally follows the principle of most surprise.
The fact that G_MESSAGES_DEBUG="all" can leak to other programs using
GLib is also annoying.

  3. The non-structured GLib logging API is very opinionated and lacks
configurability beyond replacing the log handler.

  4. Windows GUI has some special code to attach to a console,
but it would be nice to abstract away the rest under a single
interface.

  5. Using this logger seems to be noticeably faster.

Deprecate the console log level preference and extend our API to
implement a log handler in wsutil/wslog.h to provide easy-to-use,
flexible and dependable logging during all execution phases.

Log levels have a hierarchy, from most verbose to least verbose
(debug to error). When a given level is set everything above that
is also enabled.

The log level can be set with an environment variable or a command
line option (parsed as soon as possible but still later than the
environment). The default log level is "message".

Dissector logging is not included because it is not clear what log
domain they should use. An explosion to thousands of domains is
not desirable and putting everything in a single domain is probably
too coarse and noisy. For now I think it makes sense to let them do
their own thing using g_log_default_handler() and continue using the
G_MESSAGES_DEBUG mechanism with specific domains for each individual
dissector.

In the future a mechanism may be added to selectively enable these
domains at runtime while trying to avoid the problems introduced
by G_MESSAGES_DEBUG.
2021-06-11 09:40:28 +00:00
Pascal Quantin c0f8812c31 Kerberos: fix compilation without HAVE_KERBEROS flag
Closes #17439
2021-06-11 09:38:02 +02:00