Commit Graph

85312 Commits

Author SHA1 Message Date
John Thacker 73d8bb1bc3 XML: Do escape ASCII control characters
XML 1.0 allows valid UTF-8 characters, except for the ASCII control
characters other than tab, carriage return, and line feed.
(It does not allow form feed and vertical tab, so the allowed group is
not the same as the standard ctype.h isspace category. It also
allows but discourages DEL (\x7F).)

The characters cannot be included as character references of the
form &#xx; either; there is technically no way to include them.
Escape them as done prior to 89e96c1e77
but continue to leave bytes with the high bit set alone so that
UTF-8 printable characters are not escaped.

Fix #10445
2022-09-21 23:46:35 +00:00
Pau Espin 0c7e8ce9a5 ui: Fix Qt deprecation messages
Related: https://gitlab.com/wireshark/wireshark/-/issues/18358
2022-09-21 16:29:10 +02:00
John Thacker 30b309d24c proto: Validate add_string values as UTF-8
When a dissector directly adds a string value through
proto_tree_add_string[_format_value], validate that it is
UTF-8 so that only valid UTF-8 strings are used internally,
and written to output (whether text, JSON, or XML.)
(We were treating it as a UTF-8 string anyway, but not
validating it.)

If the string passed in is not UTF-8, that's a dissector bug
Dissectors that use API functions like tvb_get_string_enc
will always produce valid UTF-8, but some do their own
processing.

Fix #18317
2022-09-21 07:53:01 -04:00
ismaelrti 72cf5754e2 RTPS: Added dissection of Compression Id in Data Representation
New field added to PID_DATA_REPRESENTATION
2022-09-21 11:35:43 +00:00
John Thacker b46a3fbf23 GTP: Fix NSAPI shift in Radio Priority
The NSAPI value was not being shifted correctly before being
added to the tree description.
2022-09-21 00:06:28 +00:00
Gerald Combs ce44047584 Qt: Manually connect our "Edit" menu actions.
Use manual, new-style connections for each of our "Edit" menu actions.
KDE's clazy project recommends them over auto-connnections:

https://github.com/KDE/clazy/blob/1.11/docs/checks/README-connect-by-name.md

Use queued connections for the mark, ignore, and other actions that might
run a nested event loop.
Fixes #18344.
2022-09-20 16:39:30 +00:00
Frank Gorgas-Waller ebf42e3bbc Added requirements to support DLT_AUERSWALD_LOG as already added in libpcap 2022-09-20 16:38:06 +00:00
Chuck Craft c199b747aa Revert "Qt: only half of enabled/disabled protocols list is processed"
This reverts commit 248955d614.

It speeds up the loop when type_ is EveryWhere (see: enum SearchType)
but a hang or crash for other combinations of type_ and protocolType_.
2022-09-20 11:07:13 -05:00
ismaelrti 82dcb50bbc RTPS: Wrong deserialization of optional members.
Optional user data members are not correctly dissected if
the parameter header is placed after padding.
2022-09-20 10:14:05 +00:00
ismaelrti e7a7b630a4 RTPS: PluginParticipantSecurityAttributesMask value is incorrectly displayed
Offset not incremented before parsing PluginParticipantSecurityAttributesMask field.
2022-09-20 09:00:32 +00:00
Alexis La Goutte 2d22f72d4d ciscodump(extcap): Fix DeadStore 2022-09-20 06:27:46 +00:00
Alexis La Goutte 4ad78f8f12 bgp: fix deadcode found by Clang Analyzer
packet-bgp.c:6886:9: warning: Value stored to 'reader_offset' is never read [deadcode.DeadStores]
packet-bgp.c:6903:13: warning: Value stored to 'reader_offset' is never read [deadcode.DeadStores]
packet-bgp.c:6907:13: warning: Value stored to 'reader_offset' is never read [deadcode.DeadStores]
packet-bgp.c:6917:9: warning: Value stored to 'reader_offset' is never read [deadcode.DeadStores]
packet-bgp.c:6925:9: warning: Value stored to 'reader_offset' is never read [deadcode.DeadStores]
2022-09-20 06:27:46 +00:00
Alexis La Goutte 7e45b72c39 pfcp: Fix deadcode found by Clang Analyzer
packet-pfcp.c:8650:9: warning: Value stored to 'offset' is never read [deadcode.DeadStores]
2022-09-20 06:27:46 +00:00
Alexis La Goutte 9503dd4576 oran: Fix deadcode found by Clang Analyzer
packet-oran.c:517:5: warning: Value stored to 'bit_offset' is never read [deadcode.DeadStores]
2022-09-20 06:27:46 +00:00
Alexis La Goutte 4bcc8d86f8 mbim: Fix deadcode found by Clang Analyzer
packet-mbim.c:5651:5: warning: Value stored to 'offset' is never read [deadcode.DeadStores]
packet-mbim.c:5703:5: warning: Value stored to 'offset' is never read [deadcode.DeadStores]
2022-09-20 06:27:46 +00:00
Alexis La Goutte 7b2f022240 diameter: Fix Clang Warning
line 2198 Although the value stored to 'vnd' is used in the enclosing expression, the value is never actually read from 'vnd'
2022-09-20 06:27:46 +00:00
John Thacker 0a0ff53f5c GTP: Have all the matched message types appear in SRT
Dynamically create the indices for the SRT table so that
all the message types sent from the tap get put in the SRT
table, instead of hardcoding in a list of four that is a
smaller subset of what is matched in gtp_match_response.
2022-09-19 07:44:46 -04:00
Gerald Combs 0e462b9aae Qt: Fix some QRC paths. 2022-09-18 23:31:09 +00:00
Martin Mathieson fafc3ca6f1 Fix some spelling errors 2022-09-18 22:16:26 +00:00
Gerald Combs b92b66c0f4 [Automatic update for 2022-09-18]
Update manuf, services enterprise numbers, translations, and other items.
2022-09-18 16:45:13 +00:00
Chuck Craft 248955d614 Qt: only half of enabled/disabled protocols list is processed
In Only enabled/disabled protocols lists, the rowCount decreases
as item state is changed in the parent. An equlibrium point is
reached at halfway when rows processed == remaining size of list.
Grab a static rowcount before entering the loop.
2022-09-18 14:58:47 +00:00
John Thacker 223748d23c tplink-smarthome: Reject packets that don't match
If this dissector is going to be registered to a port that isn't
IANA assigned to it, it should at least reject packets that don't
look like the protocol. If it's going to handle TCP desegmentation,
it also should deal with not necessarily starting at the beginning
of a stream too.
2022-09-18 09:04:20 -04:00
John Thacker 1ccf4f3c73 GTP: Use a map for mapping from <teid,address> to frame
For GTP session tracking (off by default), there's a mapping
from <TEID, ADDRESS> to frame numbers. The current implementation
is a tree (converting the address to a string for keys) of linked
lists of the TEIDs. That gets very slow when there's a large number
of TEIDs. Convert it to a map that uses the teid and address,
with the TEID used for the hash.

There's still a reverse lookup (foreach_remove) when TEIDs are reused
or sessions fail, but this still yields over a 10x speedup on a
few moderate sized test files (~50000 GTP-C packets).
2022-09-17 07:39:05 -04:00
John Thacker efd72ab95d Add missing debian symbol
Commit e3ce838a3e added a
new function.
2022-09-16 21:18:55 -04:00
John Thacker 8129b9dee8 GTP: Use direct hashing in the session table
The session table maps frames (which are 32 bit uints that
start at 1) to sessions (which are also 32 bit uints that
start at 1), so use GUINT_TO_POINTER and the direct hash
functions instead of creating extra file scope pointers.
2022-09-17 00:49:57 +00:00
Joakim Karlsson d58897c5d6 NAS-5GS: correction of IE Extended rejected NSSAI 2022-09-17 00:21:34 +00:00
Martin Mathieson 248e19574c ROHC: more comments relating dissector to spec 2022-09-16 17:25:51 +01:00
John Thacker 819d392aff wmem: Add a wmem_map_foreach_remove function
Like wmem_map_remove(), this frees the key/value pair item
in the map but not the key or the value itself (which may
in fact be the same object.) Not generally a problem, as
they'll get freed by the pool. (If someone wants to manage
memory themselves, they should probably be using a GHashTable.)
2022-09-16 07:39:26 -04:00
Martin Mathieson c949c99ad1 ROHC: more fixes 2022-09-16 08:20:50 +00:00
Joakim Andersson 169867aafb Bluetooth: Handle PHY Update procedure with no change
Handle PHY Update procedure where both PHY fields are set to no change.
This procedure is terminated immediately without instant.
The instant field is reserved for future use.

This fixes the Control Procedure validation not marking this procedure
as terminated, and marking all following control procedures as invalid
since the instant has not yet been reached.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-09-15 11:41:22 +00:00
Joakim Andersson 230a2ae16a Bluetooth: Fix reserved field in CTE request control packet
Fix reserved field in CTE request, copy paste mistake from MinCTELenReq
field.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-09-15 11:41:22 +00:00
Michael Tuexen cf36b716b0 BBLog: refactor and update the list of events 2022-09-15 09:16:10 +00:00
Martin Mathieson e3ce838a3e UDPCP: seq-num analysis, and match data and ACKs 2022-09-15 08:19:51 +00:00
Chuck Craft 246e753d69 Qt6: add toInt() to QVariant == Qt::Checked
A change in Qt6 "==" comparison for QVariant for not defined types.

Closes #18336
2022-09-14 20:49:54 +00:00
John Thacker cbb2213021 Qt: Fix memory leak in Decode As
The correct place to delete the dissector_info_t pointers added
to the editor is when destroyEditor is called. Override the
virtual function and delete the pointers for the colProtocol
index before calling the inherited function.

Fix #17127
2022-09-14 12:43:55 +00:00
Martin Mathieson c0ba61fbf2 ROHC: Show profile first in Info column
Also fix summary of "Static RTP chain" summary
(width and format of SSRC).
2022-09-14 11:40:24 +01:00
John Thacker b09a864ef4 tls: Don't update the msp end on a second pass
Don't update the end of the msp on a second pass. (This
can only happen if we had some reassembly that didn't finish
in the first pass and got left dangling needing one more
segment. But that information is only used in the first pass.)
Use the same check as done in the TCP dissector.

Related to #18342.
2022-09-13 20:56:07 -04:00
John Thacker 2762c64010 follow: Have followers register their stream count function
Instead of having the UI have to know about each type of follow
stream, and how to retrieve its total number of streams, have
each follow type register a function that returns the total
number of stream. (The function can be NULL, for protocols like
SIP that do not use this.)

This gets us closer to making follow stream registration generic.
2022-09-14 00:03:07 +00:00
John Thacker 56ea9816d9 tcp: Create new conversations on a SYN after a RST or FIN
If we get a SYN packet with the same sequence number as the current
conversation, but after a RST (or FIN) segment, create a new
conversation.

In such a case, this is probably a peer using the same sequence
number to retry a handshake that failed with a RST due to a half-open
connection. The RST (or ACK that caused a RST) would have an
out-of-window sequence number (or inapplicable ACK for the rest of
the conversation), which can disrupt the follow info, sequence analysis,
desegmentation, etc. unless we create a new conversation.

It could also, less likely, be a new connection after a connection close
that happened to reuse the same sequence number, in which case we also
want to clear out our conversation state.

If we haven't received a RST (or FIN), then consider it a retransmission.

Fix #18333 (also handles the cases of #16944 and #17616 more smoothly).
2022-09-13 23:45:01 +00:00
Guy Harris 8724c249e1 coap, thread: special-case application/octet-stream for CoAP for TMF.
Have a "CoAP for TMF" dissector that the user can use Decode As to
assign to a UDP port.

Have a "coap_tmf_media_type" dissector table in which the TMF code can
register itself for the media type "application/octet-stream".

Have the "CoAP for TMF" dissector pass a "this is for TMF" flag to the
common dissection code.  In the common dissection code, if that flag is
set, first try the media type with the "coap_tmf_media_type" dissector
table before trying it in the regular "media_type" table.

This allows a user to specify UDP ports that 1) should be decoded as
CoAP and 2) should have an application/octet-stream payload dissected as
a TMF message, which should address concerns raised for Thread in issue
2022-09-13 19:47:58 +00:00
Martin Mathieson fd84d481fc RoHC: set correct length for Dynamic IPv4 Chain subtree 2022-09-13 20:05:09 +01:00
Pascal Quantin 60b6fb4484 E1AP: upgrade dissector to v17.1.0 2022-09-13 17:26:32 +02:00
Guy Harris c9342873e5 Clarify dissector description, protocol short name, and protocol ong name.
Rename dissector_handle_get_long_name() and
dissector_handle_get_short_name() to
dissector_handle_get_protocol_long_name() and
dissector_handle_get_protocol_short_name(), to clarify that they fetch
names for the protocol that the dissector dissects, not for the
dissector *itself*.  Leave a deprecated
dissector_handle_get_short_name() wrapper, and export
dissector_handle_get_protocol_long_name(), as it's now used in some
dissectors.

Change some calls to dissector_handle_get_description() back to
dissector_handle_get_protocol_short_name(), as they appear to be made in
order to display a *protocol* name.

Rename some methods, variables, enums, and table column names to reflect
cases where the dissector description is being used.
2022-09-13 00:47:24 -07:00
ismaelrti 623317fe47 RTPS: Added IP to IPv4 locator dissection.
IPv4 locator dissection shows the locator IP as a sepparate field.
2022-09-13 05:58:24 +00:00
Chuck Craft 87a7260bb0 Qt6: migrate obsolete currentIndexChanged(QString)
Similar to work done in !8070 and !8072 to move off a function
that was deprecated in Qt5 and obsoleted in Qt6. Also migrate to
syntax laid out in !4560 and !4565.
2022-09-12 22:10:11 +00:00
Guy Harris d4394de669 Give dissectors a descriptive string.
It defaults to the short name of the protocol dissected by the
descriptor, but it's now possible to register a dissector with an
explicit description.

This is mainly for use in the Decode As UI.  It handles the case where
the same protocol might have different "Decode As..."-specifiable
dissectors for different situations.
2022-09-12 21:05:14 +00:00
Jaap Keuter 5ee9cbe0b6 TLS: fix GREASE extension 2022-09-12 21:04:31 +00:00
Gerald Combs 55de00662d Qt: Clean a couple of context menus.
Set the Qt::WA_DeleteOnClose property on our packet list header and
about dialog context menus.
2022-09-12 20:16:23 +00:00
Guy Harris ede58da465 coap: have different dissectors for different transports.
As noted in the comment for e5951765d8,
mechanisms by which a dissector can attempt to infer the protocol over
which its protocol was transported aren't reliable.

To add to that, another failure case for inferring it from the previous
entry in the pinfo->layers list is a packet transported over TCP using
MPTCP, as the previous entry would be MPTCP, not TCP.

So we provide multiple CoAP dissectors:

 - CoAP over WebSockets;
 - CoAP over TCP, TLS, or other byte-stream protocols;
 - CoAP over other transports;

and have them pass the transport type to a common dissection routine.

We then register the appropriate dissectors in various dissector tables,
and register the CoAP-over-other-transports dissector as the "coap"
dissector.
2022-09-11 19:16:03 -07:00
John Thacker 9954de392b tcp: Don't try to desegment at FIN if we can't desegment the frame
Check pinfo->can_desegment before trying to desegment at FIN.
Fix #18335
2022-09-11 19:40:26 -04:00