Commit graph

20 commits

Author SHA1 Message Date
hackerman-kl
5bc1eafd3e milan-avb: streams: seperate legacy-avb and milan-avb 2026-04-27 10:56:44 +00:00
hackerman-kl
b2e45b8151 module-avb: milan: es_builder: ensure that the created for the milan differently than for the legacy-avb 2026-04-27 10:56:44 +00:00
hackerman-kl
45a94f58bd milan-avb: stream: initialisation of the msrp/mrp stream components 2026-04-27 10:56:44 +00:00
hackerman-kl
2746898e9a milan-avb: rework mrp join/begin:
* join/begin mrp protocol for attributes of mvrp and msrp within stream_activate.
 * Creation of the attribute done on stream creation during es_buidler
2026-04-27 10:56:44 +00:00
hackerman-kl
e9a51bd84f milan-avb: rename msrp attribute to stream_attr 2026-04-27 10:56:44 +00:00
hackerman-kl
4856f85de2 first draft for ACMP/ timeout handling, and communication between SRP/ADP and the ACMP state machine 2026-04-27 10:56:44 +00:00
Wim Taymans
931505a0e4 security: validate packet length in AVB IEC 61883 stream handler
Input Validation: High

The on_socket_data() handler only checked that the received packet was
at least avb_packet_header size before casting to avb_packet_iec61883,
which is larger. A packet between these two sizes would cause
out-of-bounds reads when accessing iec61883 fields like data_len.

Additionally, handle_iec61883_packet() used the data_len field from the
packet to determine how many bytes to copy into the ring buffer without
checking that the claimed data_len didn't exceed the actual received
data. A crafted packet with an inflated data_len could cause an
out-of-bounds read from the receive buffer.

Fix by requiring the minimum packet size to cover both the ethernet
header and the iec61883 header, and by validating that the claimed
payload size doesn't exceed the received data length.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-27 12:37:54 +02:00
Wim Taymans
e01ca8919e security: fix integer underflow in AVB stream packet handling
Memory Safety: Critical

In handle_iec61883_packet(), the data_len field from an incoming network
packet is converted via ntohs() and then unconditionally has 8 subtracted
from it. If an attacker sends a malformed AVB packet with data_len < 8,
the subtraction wraps the uint32_t n_bytes to a very large value
(~4 billion). This corrupted size is then passed to
spa_ringbuffer_write_data(), which can overwrite the ring buffer and
adjacent heap memory with attacker-controlled network data.

Add a bounds check to verify data_len >= 8 before the subtraction,
returning early on malformed packets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 15:55:35 +02:00
Christian F.K. Schaller
14310e66fe module-avb: extend transport abstraction to stream data path
Add stream_setup_socket and stream_send ops to avb_transport_ops so the
stream data plane can use the same pluggable transport backend as the
control plane. Move the raw AF_PACKET socket setup from stream.c into
avdecc.c as raw_stream_setup_socket(), and add a raw_stream_send()
wrapper around sendmsg().

Add a stream list (spa_list) to struct server so streams can be iterated
after creation, and add stream_activate_virtual() for lightweight
activation without MRP/MAAP network operations.

Implement loopback stream ops: eventfd-based dummy sockets and no-op
send that discards audio data. This enables virtual AVB nodes that work
without network hardware or privileges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
hackerman-kl
b60623df4d module-avb: internal: destroy internal descriptors 2025-12-01 09:08:26 +00:00
hackerman-kl
a3ce0f3e28 module-avb: avdecc: destroy stream 2025-12-01 09:08:26 +00:00
hackerman-kl
875dd91bc2 module-avb: Introduce changes in the mechanisms how the stream are
built:
* es_builder: create stream with state variables and counters
* acmp: do not use the stream list, go through the descriptor to find
  the index
* stream: do not store redundant information such as the index and
  descriptor
* internal: removing the stream server and function associated to it

module-avb: internal, stream: removing server_find_stream
2025-11-27 17:47:28 +00:00
Shengjiu Wang
ef7d4a3fc3 avb: fix frame header of listener
The vlan tag has been stripped by the kernel, the header should be
avb_ethernet_header.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2025-11-04 15:22:55 +08:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Demi Marie Obenour
c1920163d5 Fix calls to sendmsg()
Align cmsg buffers properly and use MSG_NOSIGNAL.
2022-09-23 16:33:36 +00:00
Wim Taymans
00d18217a6 avb: remove unused line
Probably a leftover from earlier merge..
2022-07-12 15:53:51 +02:00
Wim Taymans
10e54dc0ee avb: fill in some more values 2022-07-12 12:27:22 +02:00
Wim Taymans
9bfb23f3f8 avb: don't include ethernet header in in packets
Move vlan_id and prio to the stream.
2022-07-12 12:27:22 +02:00
Wim Taymans
f043922b24 avb: implement maap
Implement the maap state machine.
Use maap for the destination address of talker streams.
2022-07-12 12:27:22 +02:00
Wim Taymans
e0d6b2bb4f avb: implement streams
Add in input/output stream, setup the talker/listeners.
Implement IEC61883 audio packets, send and receive data.
Implement talker encoding.

With this, audio can be sent and received from MOTU M64.
2022-07-12 12:27:22 +02:00