Commit Graph

186 Commits

Author SHA1 Message Date
Guy Harris a201387e32 Fix checks for SocketCAN field availability.
For each field in the SocketCAN CAN XL pseudo-header, check if we have
all of the field and, if so, swap it, rather than just checking for the
availability of the complete header, just in case some packet is sliced
in the middle of the header.

Do this all with a bunch of offset/length #definitions, which also
means we don't have to worry about alignment or structure layout.
2024-02-11 13:22:00 -08:00
Guy Harris 8143babe21 Byte-swap CAN XL headers in LINKTYPE_LINUX_SLL/LINKTYPE_LINUX_SLL2 packets.
Pull the CAN byte-swapping into a separate routine, used both for
LINKTYPE_LINUX_SLL and LINKTYPE_LINUX_SLL2, and add CAN XL support to
it.
2024-02-11 11:56:57 -08:00
Stig Bjørlykke 68d85c8032 wtap: Add DLT for DECT_NR
Add DLT for DECT_NR (DECT-2020 New Radio (NR) MAC layer).
2023-12-31 00:28:22 +01:00
Guy Harris a3fd4fd25b pcapng: convert FCS lengths between bytes and bits.
The FCS length in a pcapng IDB is in bits, but the length in an EPB is
in bytes; convert the latter to bits.

The FCS length in the Ethernet pseudo-header is in bytes; convert the
length-in-bits to a length-in-bytes before using it to set the FCS
length in the pseudo-header.

While we're at it, note, in a comment, that we convert the length in
pcap files, which is in units of 16 bits, to bits.

Fixes #19174.
2023-11-01 17:06:32 -07:00
Martin Kaiser c5e00897e9 mdb: use DLT_MDB for the MDB dissector
DLT_MDB (300) has been assigned for the MDB protocol.

Register the DLT with wiretap as WTAP_ENCAP_MDB. Link the mdb dissector
to WTAP_ENCAP_MDB.
2023-08-23 12:50:03 +00:00
Guy Harris c2bb9726b8 Don't include errno.h if we don't use errno or errno value definitions. 2023-06-26 16:07:23 -07:00
Timotej Ecimovic 1db73dad24 Add WTAP bindings for silabs debug channel, DLT 298.
Note: there was a missing entry in the encap_table_base.
Someone (commit 91e8f5db35) added the new WTAP to wtap.h,
but forgot to add it to the encap_table_base, so I added it in, otherwise the mapping for
silabs debug channel protocol didn't work correctly.
2023-05-08 19:16:37 +00:00
Henri Chataing 91e8f5db35 uci: Implement UCI packet dissector
Implement the dissector for Ultra-wideband controller
interface packets, based on the protocol description
on the FiRa consortium website:
  https://groups.firaconsortium.org/wg/members/document/1679

The dissector recognizes packets with PCAP identifier 293,
or TCP packets on port 7000 (default).
2023-04-08 08:18:28 +00:00
David Perry 8b4c09283d wiretap dump: automatically increase bytes_dumped
For writing capture files, increment `wdh->bytes_dumped` within
`wtap_dump_file_write()` so the caller doesn't have to manually track
it. Fixes the most common case of writing a file in sequence, leaving
the code clearer.

A small number of file formats effectively leave the header blank, write
the packets, then seek back up to the header to fill it in. In such
cases, save `wdh->bytes_dumped` before filling in the header and restore
it once done, so the value doesn't double-count the size of the header.
2023-03-30 12:00:58 +00:00
Sergey V. Lobanov ff7bab1730 ALP: add dissector for ALP protocol (ATSC3.0 A/330)
This is a port of SiliconDust ALP decoder provided in public repository
https://github.com/silicondust/wireshark

Original Author: Nick Kelsey <nickk@silicondust.com>
2023-01-08 16:09:47 +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
Guy Harris 09c5183878 Linux USB: fix incorrect values for the packet length.
When reading memory-mapped Linux capture files, fix up the "real" length
field, in case the file was written by a program doing a capture done
with a version of libpcap with a bug that causes it to incorrectly set
the "real" length for isochronous transfers.
2022-08-14 22:50:51 -07:00
Tomasz Moń 88c8bb19e5
USBLL: Dissect speed specific linktypes
USB 2.0/1.1/1.0 devices (or 3.x and newer when connected to hosts that
are not Super-Speed capable) operate at one of three speeds:
  * Low-Speed (1.5 Mbps)
  * Full-Speed (12 Mbps)
  * High-Speed (480 Mbps)

Supporting speed specific linktypes allows speed specific dissection
without the need for user to manually set the speed.
2022-06-29 05:56:03 +02:00
Guy Harris c7f84156c0 pcap/pcapng: byte-swap the CAN ID field in CAN pseudo-headers for SLL2.
As for LINUX_SLL, so for LINUX_SLL2.
2022-02-20 10:38:55 -08:00
Guy Harris 0d357951c3 pflog: byte swap UID and PID fields in the header if necessary. 2022-02-01 16:20:21 -08:00
Vladimir Bespalov 5ecb57cb90 Add ZBOSS NCP protocol dissector 2022-01-30 09:34:26 +00:00
João Valverde 0ccd69e530 Replace g_strdup_printf() with ws_strdup_printf()
Use macros from inttypes.h.
2021-12-19 21:21:58 +00:00
Aidan MacDonald 9c322f5b55 Increase max packet size for all USB encapsulation formats
Each "packet" in the USB encapsulation formats for at least
Linux and Darwin corresponds to an OS-level USB request, so
the packets can be much larger than a USB-level packet.

The default max packet length of 256 KiB prevents Wireshark
from loading capture files that contain requests >256 KiB.
(Saving such a capture already works fine.)

Fix this by making the Linux, Darwin, and FreeBSD formats
use the same max packet length as the USBPCap format, which
is 128 MiB.
2021-10-24 22:48:20 +01:00
Joakim Andersson 9728438929 nordic_ble: Update display name of nordic_ble dissector
Replace all instances of "Nordic BLE Sniffer" with
"nRF Sniffer for Bluetooth LE" which is the name used by
nordic semiconductor for the development tool on the homepage.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-06-28 11:52:14 +00:00
Guy Harris 39315979c6 pcap-common: set the time stamp precision correctly for LINKTYPE_ERF.
LINKTYPE_ERF pcap files are really ERF files inside a thin pcap wrapper
(don't even ask what a pcapng file with some or all interfaces being
LINKTYPE_ERF is...), so the time stamp comes from the ERF record, not
from the pcap packet header or pcapng block header.

The time stamp reslution for the record should reflect that, so set it
to WTAP_TSPREC_NSEC (ERF time stamps are fractional-power-of-2, not
fractional-power-of-10, so that's the best we can do).
2021-06-18 17:43:36 -07:00
Guy Harris eb4d68033e Don't cast away upper bits when assigning to a nstime_t's secs field.
The secs field is a time_t, which is not necessarily 32 bits.  If it's
not, casting away the upper bits, by casting to guint32, introduces a
Y2.038K bug.

Either cast to time_t or, if you're assigning a time_t to it, don't
bother with the cast.
2021-04-28 21:31:15 +00:00
Guy Harris 166159f15d wiretap: eliminate the pcap/nspcap/pcapng WTAP_FILE_TYPE_SUBTYPE_ values.
Register the pcap and pcapng file types/subtypes rather than hardwiring
them into the table.

Call the registration routines for them directly, rather than through a
generated table; they're always supposed to be there, as some code in
Wireshark either writes only one of those formats or defaults to writing
one of those formats.  Don't run their source code through the
registration-routine-finder script.

Have the file type/subtype codes for them be directly exported to the
libwiretap core, and provide routines to return each of them, to be used
by the aforementioned code.

When reporting errors with cfile_write_failure_message(), use
wtap_dump_file_type_subtype() to get the file type/subtype value for the
wtap_dumper to which we're writing, rather than hardcoding it.

Have the "export PDU" code capable of supporting arbitrary file
types/subtypes, although we currently only use pcapng.

Get rid of declarations of now-static can_write_encap and
dump_open routines in various headers.
2021-02-23 21:56:20 +00:00
Guy Harris 93a472575d Rename WTAP_ENCAP_ETL to WTAP_ENCAP_ETW.
It corresponds to LINKTYPE_ETW in pcap and pcapng files; the structures
in the record format come from the Event Tracing for Windows (ETW) API
rather than directly from Event Trace Log files.

While we're at it, explain what extcap/etl does.
2021-01-27 14:33:09 -08:00
Odysseus Yang 2a5b34d8b0 MBIM: Update dissector to support DLT_ETW
New link type DLT_ETW is added for write and read Event Trace on Windows.
This change updates MBIM dissector to decode a MBIM message from
a DLT_ETW packet.
2020-12-02 09:05:11 +00:00
Роман Донченко 69e1aa860b Fix many spelling errors 2020-10-11 08:35:55 +00:00
Martin Mathieson d461bf3025 Yet more spelling fixes.
Includes small updates to the script and wireshark dictionary.
Probably the last spelling fixes from me for a while.
2020-09-07 16:35:13 +01:00
Mikhail Gusarov ab4ef189ae wiretap: add Z-Wave Serial API frame type and pcap link-layer header
This header type was added to pcap registry a year ago:
https://lists.sandelman.ca/pipermail/tcpdump-workers/2019-July/001268.html
2020-08-24 19:34:07 +00:00
Guy Harris 86eba21b82 Squelch a Coverity warning.
I guess Coverity gets upset because, the way GUINT32_TO_BE() works when
building with Coverity, there's at least one test done the result of
which is always the same.

Calculate the "native" value of the direction, and then put it into
big-endian order, in two separate statements.

This should squelch Coverity CID 1457345.

Change-Id: I1ccd6fd848e6abc91f16fa375c98efcab9c5bf60
Reviewed-on: https://code.wireshark.org/review/37370
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-02 23:19:29 +00:00
Guy Harris 7e7db3e91c sll: add support for LINKTYPE_LINUX_SLL2.
Different header, with a different size, an additional field, and with
fields being in a different order.

Distinguish between V1 and V2 by giving the version.

That means we can no longer use the "ethertype" dissector as it stands,
because the packet type field isn't at the end of the header, right
before the payload; pull the "add the type field to the protocol tree"
functionality out of the "ethertype" dissector and leave it up to the
dissector calling it.

Change-Id: I72b8a2483c0a539919fbe5d35fd7e60bff4bf75a
Reviewed-on: https://code.wireshark.org/review/37169
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-09 03:14:50 +00:00
Guy Harris 7d95c27de2 ERF: split wiretap/erf.h into three files.
wiretap/erf_record.h has declarations for records in ERF files and in
LINKTYPE_ERF packets in pcap and pcapng files.

wiretap/erf-common.h has declarations of routines to be called by
pcap/pcapng reader code when processing LINKTYPE_ERF packets.

wiretap/erf.h is what's left, for use by wiretap/erf.c and the code with
the tables of file readers and writers.

Change-Id: Ia982e79b14a025a80dcbc7c812fb3b2cdb9c6aaa
Reviewed-on: https://code.wireshark.org/review/37021
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02 04:24:08 +00:00
Guy Harris 303f6f1b39 Boost the maximum packet size for LINKTYPE_USBPCAP in pcap/pcapng.
Bug: 15985
Change-Id: I8e043431bbf874d640d4407335d525a44815ee73
Reviewed-on: https://code.wireshark.org/review/34327
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-08-20 04:57:17 +00:00
Guy Harris 22e7952e06 HTTPS In Even More Places, update some links.
Fall back on the Wayback Machine for some links.

Change-Id: I6a44a2caaeb4fa521c2f08196e7c36069e3bb842
Reviewed-on: https://code.wireshark.org/review/34103
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-28 04:21:18 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Tomasz Moń 53fdec477d USBLL: Initial USB 2.0 Link Layer dissector
Dissect raw USB Packets. The actual USB packets to transaction conversion
(which is needed to pass the data to existing USB URB dissector) is not
implemented yet.

Ping-Bug: 15908
Change-Id: Ia75d58882d770fdd8650622d318241743069ad8f
Reviewed-on: https://code.wireshark.org/review/34006
Reviewed-by: Tomasz Moń <desowin@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-25 08:56:18 +00:00
Guy Harris ed23cfba22 Clean up IPMB/I2C link-layer header types.
209 is LINKTYPE_IPMB_LINUX; add _LINUX/_linux to the WTAP_ENCAP_ name
and function/structure names, to clarify that it's not I2C in general,
it's I2C with a particular pseudo-header.

199 is now LINKTYPE_IPMB_KONTRON, not LINKTYPE_IPMB, as it doesn't have
raw I2C packets, it has I2C packets with a pseudo-header.  Change the
WTAP_ENCAP_ name, and add a dissector for it.

Change-Id: Ie097f4317b03d2b2adfd9b81a4b11caf6268399e
Reviewed-on: https://code.wireshark.org/review/32539
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-23 20:30:00 +00:00
James Ko 6ce7509223 Add IEEE 802.15.4 TAP link type
New link type for IEEE 802.15.4 with pseudo-header and optional
meta-data TLVs, PHY payload exactly as it appears in the spec (no
padding, no nothing), and FCS if specified by FCS Type TLV.
Specification at https://github.com/jkcko/ieee802.15.4-tap

Bug: 15429
Change-Id: I67bd154891ad5818be9a1630aa5cbb863b55509a
Reviewed-on: https://code.wireshark.org/review/32141
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-02-28 17:55:14 +00:00
Pantar Ana 0e151f3987 ebhscr: increasing ebhscr snaplen
Change-Id: Ie033196c099927912b1e7849299e786dc8416923
Reviewed-on: https://code.wireshark.org/review/31554
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-18 07:50:54 +00:00
Dave Barach abd64c9ea2 VPP: add vpp graph dispatch trace dissector
Add a dissector for http://fd.io vpp graph dispatch traces. The file
format is described in detail here:
       https://fdio-vpp.readthedocs.io/en/latest/gettingstarted\
               /developers/vnet.html#graph-dispatcher-pcap-tracing

Fuzz-tested with good results.

Bug: 15411
Change-Id: I3b040bb072ce43fb2fb646a9e473c5486654906a
Signed-off-by: Dave Barach <dave@barachs.net>
Reviewed-on: https://code.wireshark.org/review/31466
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-17 11:31:27 +00:00
Pantar Ana eb8c996108 ebhscr: fixing WTAP_ENCAP_EBHSCR
Change-Id: Ie5ab56f1ee80d14032969cbe7f31e086fb2b4b91
Reviewed-on: https://code.wireshark.org/review/31159
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-12-27 22:32:44 +00:00
Gerald Combs 8c22c5bade Fix some spelling errors found by Lintian.
Change-Id: If6fc3aab7ad4fc634567121f7b9541bc6f6c5766
Reviewed-on: https://code.wireshark.org/review/30926
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-05 18:58:19 +00:00
Guy Harris 854cfe53ef Make the ERF code in pcap_get_phdr_size() more like the reading code.
Change-Id: I6cd17b1ed4b3ed2aa2cc88b3cbae354d36dafead
Reviewed-on: https://code.wireshark.org/review/29880
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 20:05:09 +00:00
Guy Harris c7f4badb8c Sort the pseudo-header routines in the order of the switch statements.
Change-Id: Ia590e90930bbb355900a6d87b22a0418174bbc11
Reviewed-on: https://code.wireshark.org/review/29878
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 19:43:31 +00:00
Guy Harris 275a6e4c36 Move wtap_encap_requires_phdr() amongs the other switch statement routines.
Keeping them together might increase the likelihood that all of them get
updated when a new pcap/pcapng link-layer type whose pseudo-header is
first processed here rather than by a dissector.

Change-Id: Ia6f45c38e9530b7c6a53d006fbc01b3040e9a014
Reviewed-on: https://code.wireshark.org/review/29868
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 18:55:11 +00:00
Guy Harris 0a19ec761d Sort cases in pcap_get_phdr_size(), add a missing one for WTAP_ENCAP_NFC_LLCP.
Sort the cases to match the order in other routines.

That turned up a missing case for WTAP_ENCAP_NFC_LLCP, so add it.

Change-Id: I500731322ae93c6d2efc368f16cf468f589910f3
Reviewed-on: https://code.wireshark.org/review/29858
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 17:53:02 +00:00
Guy Harris 6b904030f6 Put ERF pseudo-header reading and writing into single routines.
Have pcap_read_erf_pseudoheader() do all the work of reading an ERF
pseudo-header.

Add pcap_write_erf_pseudoheader() as a routine to do all the work of
writing an ERF pseudo-header.

Change-Id: If53ae50fcee35a45113ca0f0c64f69848e044cbd
Reviewed-on: https://code.wireshark.org/review/29847
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 07:46:08 +00:00
Guy Harris 9795af4488 Get rid of bogus copied-and-pasted comment.
Change-Id: If9b17b6e05a1bd6a3fcf2348f81837a6ed16761c
Reviewed-on: https://code.wireshark.org/review/29844
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 03:26:28 +00:00
Guy Harris 1302cdb27c Sort cases in pcap_write_phdr() - and add missing NFC LLCP case.
Put the cases in pcap_write_phdr() into the same order as the cases in
pcap_process_pseudo_header().

Doing so revealed that there wasn't a case for WTAP_ENCAP_NFC_LLCP in
pcap_write_phdr(), so NFC LLCP captures wouldn't be saved correctly.
Add pcap_write_llcp_pseudoheader() and use it.

Change-Id: I2728a96e63d2e0606ae0bb480f97fe124ab48d17
Reviewed-on: https://code.wireshark.org/review/29841
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 03:02:36 +00:00
Guy Harris 3ddc3b0761 Put the code for writing pseudo-headers into individual routines.
For each pseudo-header type, put a routine to write the pseudo-header
after the routine to read it.

Change-Id: Iffc010c1bf97acc5eb834a388e328ad3c2310351
Reviewed-on: https://code.wireshark.org/review/29840
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 02:47:54 +00:00
Guy Harris 7e928c8a51 In LINKTYPE_PPP_WITH_DIR files, any non-zero direction value means "sent".
It's not as if 0 means received, 1 means sent, and anything else is
invalid; treat all non-zero values as meaning "sent" when reading, and
write out 1 for "sent".

Change-Id: Iaf5eb327a6b87b893a203475c8730452c51a38e9
Reviewed-on: https://code.wireshark.org/review/29839
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 02:26:42 +00:00
Guy Harris 80160d6181 Shuffle pseudo-header definitions to just before the reader function.
Put all the #defines and structure declarations for a particular
pseudo-header before the function to read the pseudo-header.

Change-Id: I11013ff99d72832f49e9bea56dbc07f5cd8618f3
Reviewed-on: https://code.wireshark.org/review/29838
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 02:19:20 +00:00