Commit graph

2728 commits

Author SHA1 Message Date
John Thacker
23ccf8c9a0 codecs: Pass in fmtp, decode bandwidth efficient AMR
Pass the wmem_map of format parameters. Use this to decide whether
we have octet-aligned or bandwidth-efficient AMR, and decode
accordingly.

If we don't have a map of format parameters, because the conversation
wasn't set up by SDP but by Decode As, use the default preferences
from the dissector

Fix #17608
2023-07-14 17:58:19 -04:00
John Thacker
d871c6c6af codecs: Change interface, use SDP information for dynamic codecs
RTP static registered payload types fully describe the codec,
including clock rate and channels. For the payload formats that
use dynamic payload type number assignment, while some formats
have a fixed (or normal) clock rate and number of audio channels,
there are some codecs that can accept several possible values.

Change the codec plugin interface to accept these parameters,
and move the codec-specific state to a member of a new struct.

As an example, use this to implement the L16 media type for other
clock rates and number of audio channels, both the standard PT=10
stereo type as well as other clock rates negotiated via a dynamic
type. (See sip-rtp-l16.pcap on the SampleCaptures wiki page for
an example.)

Note that RTP Player doesn't support codecs returning output with
more than one channel currently, so downmix to mono.

The next step is adding the format parameters from fmtp to this.
(See #17608)
2023-07-09 21:16:28 +00:00
John Thacker
4ce5571cfd opus: Decode Opus packets with more than one frame
https://datatracker.ietf.org/doc/html/rfc7587#section-4.2

    "Further, an arbitrary number of frames can be combined into a packet,
    up to a maximum packet duration representing 120 ms of speech or audio
    data.  The grouping of one or more Opus frames into a single Opus packet
    is defined in Section 3 of [RFC6716]."

Handle opus packets with more than one frame in the packet by asking
the Opus decoder for the number of samples in the packet.
2023-07-05 17:21:02 -04:00
Gerald Combs
c8accef14c Falcodump + Falco bridge: libsinsp API updates
Update to match recent libsinsp 0.11 API changes.
2023-07-04 14:42:29 +00:00
John Thacker
e94e29efcd G729 codec: Support Annex B SID/CN frames
The bcg729 library interface supports decoding SID frames, so do
so.

rtp_audio_stream would have to be reworked a bit to allow processing
of missing frames by a decoder (which bcg729 supports, but not all
decoders do) instead of generating our own silence, but this change
reduces the number of silence samples we generate.

Fix #14343
2023-06-29 19:40:19 +00:00
Nardi Ivan
bc20791882 Add missing include of errno.h
```
FAILED: plugins/epan/mate/CMakeFiles/mate.dir/mate_grammar.c.o
/usr/bin/cc -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DPLUGIN_VERSION=\"1.0.1\" -DWS_DEBUG -DWS_DEBUG_UTF_8 -Dmate_EXPORTS -I. -I../ -I../include -I../plugins/epan/mate -Iplugins/epan/mate -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -fvisibility=hidden  -Wall -Wextra -Wpointer-arith -Wformat-security -fno-strict-overflow -fexcess-precision=fast -Wvla -Wattributes -Wpragmas -Wredundant-decls -Wunreachable-code -Wlogical-op -Wno-error=stringop-overflow= -Wno-error=deprecated-declarations -Wframe-larger-than=32768 -Wno-format-truncation -fdiagnostics-color=always -Wshadow -Wold-style-definition -Wstrict-prototypes -Wno-pointer-sign  -fmacro-prefix-map=/home/ivan/svnrepos/wireshark/= -fmacro-prefix-map=/home/ivan/svnrepos/wireshark/wireshark-master/= -fmacro-prefix-map=../= -O2 -g -DNDEBUG -fPIC   -std=gnu11 -Wno-unused-parameter -MD -MT plugins/epan/mate/CMakeFiles/mate.dir/mate_grammar.c.o -MF plugins/epan/mate/CMakeFiles/mate.dir/mate_grammar.c.o.d -o plugins/epan/mate/CMakeFiles/mate.dir/mate_grammar.c.o   -c plugins/epan/mate/mate_grammar.c
/home/ivan/svnrepos/wireshark/plugins/epan/mate/mate_grammar.lemon: In function ‘yy_reduce’:
/home/ivan/svnrepos/wireshark/plugins/epan/mate/mate_grammar.lemon:272:127: error: ‘errno’ undeclared (first use in this function)
  272 | dbgfile_default ::= FILENAME_KW QUOTED(Filename) SEMICOLON. { mc->dbg_facility = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); }
      |                                                                                                                               ^~~~~
/home/ivan/svnrepos/wireshark/plugins/epan/mate/mate_grammar.lemon:272:1: note: ‘errno’ is defined in header ‘<errno.h>’; did you forget to ‘#include <errno.h>’?
  271 |
  +++ |+#include <errno.h>
  272 | dbgfile_default ::= FILENAME_KW QUOTED(Filename) SEMICOLON. { mc->dbg_facility = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); }
/home/ivan/svnrepos/wireshark/plugins/epan/mate/mate_grammar.lemon:272:127: note: each undeclared identifier is reported only once for each function it appears in
  272 | dbgfile_default ::= FILENAME_KW QUOTED(Filename) SEMICOLON. { mc->dbg_facility = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); }
```
2023-06-29 18:23:48 +00:00
John Thacker
1d3aed32b1 AMR: Support RTP payloads with multiple frames
OpenCORE-AMR doesn't really support RTP payloads with multiple
frames (the F bit set), so this is a bit of a chore.

Test the payload to see if there are multiple frames contained in
it. If there are, then we have to copy things around so that
the corresponding TOC byte is adjacent to the speech bytes for
passing to the decoder. (Just wait until bandwidth-efficient mode.)

See the pcap attached to #9477 for an example with multiple AMR
speech frames in one RTP payload.
2023-06-28 23:34:37 +00:00
John Thacker
9a72f9bb1b Include errno.h in a few files
errno.h was removed from some common headers. A few files use
errno and need to include it. On at least some Linux distributions
(Rocky 8), it doesn't get pulled in by other headers.
2023-06-28 18:41:42 -04: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
Stig Bjørlykke
f72d93ce94 wimax: Avoid warnings from fix-encoding-args.pl
Change hf_dcd_h_arq_ack_delay to hf_dcd_h_arq_ack_delay_dl and
hf_dcd_h_arq_ack_delay_ul to show the difference. Removed some
unused and duplicate hf entries to avoid duplicate warning from
the check tool.
2023-06-23 11:07:16 +00:00
John Thacker
a623339466 wimaxsncp: Fixup last commit
Fixup typo in fd39ea9981

Fix #19139
2023-06-15 13:19:36 -04:00
John Thacker
fd39ea9981 wimaxasncp: Check for zero byte lengths
Check for zero byte lengths. Also prefer tvb_ functions that use
bounds checking instead of tvb_get_ptr.

Fix #18987.
2023-06-14 18:43:18 -04:00
Gerald Combs
12b5e4fdfc Falco bridge: Add a missing include
Include wsutil/inet_addr.h.
2023-06-08 20:49:33 +00:00
Martin Mathieson
6840d00309 Fix some filters not matching labels 2023-06-02 11:19:59 +00:00
Martin Mathieson
c17c11eeb8 Label vs filter checking 2023-05-28 21:42:40 +00:00
Martin Mathieson
da5af61092 tools/check_spelling.py: Add another lookahead when matching // 2023-05-11 19:12:43 +00:00
Bartłomiej Nóżka
12a711401d PROFINET: Add CIMSNMPAdjust dissection.
Adds new CIMSNMPAdjust block to Read/Write IO request dissection according to 2.43 pnio version.

CIMSNMPAdjust block is made of BlockHeader, SNMPControl, SNMPReadOnlyCommunityName, SNMPReadWriteCommunityName, Padding.

SNMPReadOnlyCommunityName and SNMPReadWriteOnlyCommunityName is made of 1 byte of length and length bytes of community name.
2023-05-10 08:17:06 +00:00
Martin Mathieson
417a10799b Fix more 'type_item_calls' warnings 2023-05-04 00:46:17 +01:00
David Perry
55db118c0f Use register_dissector() in plugins
Within `plugins/epan/`, change calls of `create_dissector_handle()` to
instead call `register_dissector()` with a name for the dissector.

This change allows affected dissectors to be findable by calls to
`find_dissector()`. In turn, this opens up more command-line use for
these protocols, including fuzzshark and rawshark, as well as lua use
via `Dissector.get()`.

Most changes are to sub-dissectors of the wimax plugin. For these I kept
the naming convention for dissector names used by e.g.
`wimax/msg_aas_beam.c` even though it's unwieldy.

Some of the plugins did use `register_dissector()` but with `-1` as the
protocol ID argument. I changed those to pass the actual protocol ID.

Partially addresses #5612
2023-05-02 13:48:36 -04:00
Martin Mathieson
571f2961cf tools/check_val_to_str.py: Scan plugin dissectors too 2023-04-25 17:06:18 +01:00
Gerald Combs
d7391c629c Falco bridge: Fix a switch block 2023-04-21 18:55:01 +00:00
David Perry
7bc9ff3135 OpcUa: ExtensionObject.TypeId is NodeId
As per #18868, the ExtensionObject.TypeId should be parsed as a NodeId,
not as an ExpandedNodeId.
2023-04-20 08:12:38 +00:00
João Valverde
7595af96a0 ftypes: Hide fvalue implementation
Exposing the fvalue_t implementation is exposing internal
details of the implementation. Fix that by making the fvalue_t
internal to the ftypes implementation and using setters/getters
where necessary.
2023-04-19 15:12:25 +00:00
Gerald Combs
3110d44a4c epan: Add user data to conversation filters
Add user data to conversation filters. Use it to provide necessary data
in the Falco Bridge dissector.
2023-04-12 02:11:41 +00:00
Chuck Craft
654b667329 ifdemo plugin: Compiler errors; support Qt5/Qt6 builds
Run through gitlab pipelines then disable ENABLE_PLUGIN_IFDEMO
Build with Qt5 or Qt6
Fix -Wdangling-gsl, -Wshorten-64-to-32
2023-04-06 05:57:17 +00:00
Martin Mathieson
1a29060159 Address more warnings from check_typed_item_calls.py 2023-03-23 11:53:53 +00:00
01c51aad3e Add AMR codec support 2023-03-21 12:26:05 +00:00
David Perry
1f59c18769 Change some wmem_packet_scope() to pinfo->pool
As requested [here][1] by @eapache, help with removing calls to
`wmem_packet_scope()` in favour of references to `pinfo->pool`.

* Plugins chosen semi-randomly.
* When a calling function already has a `pinfo` argument, use that.
    * Remove `_U_` from its signature if it was there.
* If a function seems narrowly focused on getting and (possibly)
  returning memory, change the function signature to take a
  `wmem_allocator_t *`.
* If it seems more focused on packet-based operations, pass in a
  `packet_info *` instead and use `pinfo->pool` within.
    * If there are several functions defined with the same call
      signature, add `pinfo _U_` to the argument list of similar
      functions in order to maintain clarity/symmetry.

[1]: https://www.wireshark.org/lists/wireshark-dev/202107/msg00052.html
2023-02-25 05:32:48 +00:00
Guy Harris
a4b61bc069 gryphon: fix handling the ioctl code in a response.
It's not in the response message, it's taken from the request message,
so display it with a zero offset and length, so it doesn't match any
bytes in the packet.

It's a 32-bit field, so make it an FT_UINT32.
2023-02-21 00:34:05 -08:00
Martin Mathieson
f4e9b9d4a8 Check that value_string values fit into field width 2023-02-20 08:33:34 +00:00
Alexis La Goutte
144de50d41 profinet: fix conflict 2023-02-17 19:06:18 +00:00
Martin Mathieson
8812c5ed20 Fix some spelling errors 2023-02-09 19:37:20 +00:00
John Thacker
e8db896c62 PROFINET: Add strings with proto_tree_add_item
Add strings with proto_tree_add_item instead of tvb_memcpy,
appending a null, and a proto_tree_add_string so that the
strings are validated for encoding, trailing nulls, etc.

Fix #18847
2023-02-07 07:20:27 -05:00
Martin Mathieson
ed8ee831fd More fussing with items and calls. 2023-01-31 17:32:05 +00:00
Gerald Combs
24ab9c0aaa Falco bridge+falcodump: Scan for personal plugins 2023-01-19 00:17:08 +00:00
John Thacker
058400d8e0 ECATMB: Get filename with encoding when adding to column
When retrieving a string, don't just use tvb_memcpy, even if
expected to be ASCII (because it might have errors.)

This doesn't get truncated, even if all replacement characters,
because the eventual returned buffer is 200 octets long and the
max filename is 49.

Fix #18800
2023-01-17 12:41:58 +00:00
Martin Mathieson
4dd78f11c9 Fix various issues seen with tools/check_typed_item_calls.py 2023-01-16 15:35:04 +00:00
Gerald Combs
de16040021 CMake: Rename SINSP_PLUGINS to FALCO_PLUGINS 2023-01-12 02:21:15 +00:00
Gerald Combs
640c44f24e CMake: Specify Falco plugins manually.
Falco plugins don't yet have a standard installation location, and even
when they do we might not want to install all of them. Remove plugin
detection from FindSinsp.cmake and note that you should just pass the
paths to your plugins in SINSP_PLUGINS.
2023-01-11 15:37:46 -08:00
Matthias Isele
ddb187fe0c fixes #18777 wrong decoding order in parseDiagnosticInfo 2023-01-04 10:31:24 +00:00
Martin Mathieson
d17c018013 tools/check_typed_item_calls: check FT_BOOLEAN mask length 2022-12-15 13:28:05 +00:00
João Valverde
79c3a77752 Add macros to control lemon diagnostics
Rename flex macros using parenthesis (mostly a style issue):

DIAG_OFF_FLEX -> DIAG_OFF_FLEX()
DIAG_ON_FLEX  -> DIAG_ON_FLEX()

Use the same kind of construct with lemon generated code using
DIAG_OFF_LEMON() and DIAG_ON_LEMON(). Use %include and %code
directives to enforce the desired order with generated code
in the middle in between pragmas.

Fix a clang-specific pragma to use DIAG_OFF_CLANG().

DIAG_OFF(unreachable-code) -> DIAG_OFF_CLANG(unreachable-code).

Apparently GCC is ignoring the -Wunreachable flag, that's why
it did not trigger an unknown pragma warning. From [1}:

  The -Wunreachable-code has been removed, because it was unstable: it
  relied on the optimizer, and so different versions of gcc would warn
  about different code.  The compiler still accepts and ignores the
  command line option so that existing Makefiles are not broken.  In some
  future release the option will be removed entirely. - Ian

[1] https://gcc.gnu.org/legacy-ml/gcc-help/2011-05/msg00360.html
2022-11-20 10:11:27 +00:00
Martin Mathieson
709d65883f Fix some cppcheck issues 2022-11-18 10:07:57 +00:00
João Valverde
cfbe898dcc CMake: Disable -Werror for flex generated files 2022-11-17 10:23:12 +00:00
João Valverde
09718fb9b3 CMake: Move clang warnings
Move clang warnings to normal set. Let the CMake compatibility
check control the warning.

Fix or work-around -Wunreachable warnings in the code.
2022-11-17 01:35:16 +00:00
John Thacker
1a04473ca8 opcua: Quiet a Coverity warning
It really shouldn't be possible to have a fragment head with
no fragment items here, but quiet Coverity CID 1516904 here.
2022-11-15 17:08:53 -05:00
John Thacker
4f3b028d94 epan: Separate fragment_head and fragment_item
Separate fragment_head and fragment_item into two
different types of structs.

Remove "offset" from fragment_head, which was unused,
making fragment heads 4 bytes smaller.

Remove fragment_nr_offset, datalen, reassembled_in,
reas_in_layer_num, and error from fragment_item,
making them 24 bytes smaller.

Change a few dissectors which were using fragment_head
and fragment_item indistinguishably.

Ping #17311
2022-11-14 01:18:11 +00:00
Tim Potter
b484c41811 wimaxasncp: Fix dissection of message type in packet header
It looks like there was a cut&paste error a long time ago resulting
in the wimaxasncp.message_type field being incorrectly detected as
unused and commented out. Closes #18424.
2022-10-13 14:51:03 +00:00
Dirk Ziegelmeier
8f7d0b2af5 Fix issue #18391
Profinet PNIO-CM Connect Response Error Decode Incorrect
2022-10-11 11:28:54 +00:00
Guy Harris
3db17dab82 transum: expert infos are not Boolean fields.
They're of type FT_NONE, meaning that they do not have values, they're
just present or not.

Handle the TCP analysis fields "tcp.analysis.retransmission" and
"tcp.analysis.keep_alive", both of which are expert infos, by just
seeing if they're present or not.

Fixes a problem mentioned in a comment in merge request !8412.
2022-10-10 16:00:53 -07:00