Fragment large V2X_RX messages and decode road-RSU SPATEMs

The firmware dropped every received ITS message over 494 bytes (one link
message), so a road RSU's 888-byte SPATEM and 1198-byte MAPEM never reached
the phone. V2X_RX now goes out in link fragments up to 2300 bytes, best
effort and non-blocking; messages up to 494 bytes are unchanged.

The app's SPATEM decoder then refused those messages because they carry
intersection and movement names and advisory speed lists. It now reads past
both, checked against asn1tools on 718 distinct messages.

Adds the pure fragmenter with host tests and a pcap replay, a Kotlin
cross-check on the firmware's own fragments, tools/rx_size_compare.py,
docs/08-large-message-reception.md and station-link revision 3.
This commit is contained in:
Ashin Walpola
2026-11-23 17:34:56 +01:00
parent 7dd83dba3d
commit ce18a393ea
24 changed files with 3305 additions and 2305 deletions
+6 -3
View File
@@ -30,8 +30,9 @@ public:
using Received = std::function<void()>;
/// RAW_FRAME body (u32 counter, u8 flags, i8 RSSI, ITS5 record) for the link service.
using RawFrame = std::function<void(const link::Bytes&)>;
/// MicrOBU: body of one link V2X_RX message (see link_protocol.hpp).
using RawIts = std::function<void(const link::Bytes&)>;
/// MicrOBU: body of one link V2X_RX message (see link_protocol.hpp). Returns whether a transport took it;
/// a body above one link message goes out in fragments, best effort (a false return is only counted).
using RawIts = std::function<bool(const link::Bytes&)>;
/// DCC_T_GEN_VAM body for the link service (TS 103 300-3 clause 6.2: T_GenVam from management).
using DccUpdate = std::function<void(const link::Bytes&)>;
@@ -283,7 +284,9 @@ private:
bool have_fix_ = false;
link::PotiUpdate last_poti_; // MicrOBU: the GN Source Position Vector of unsecured_request()
std::uint8_t unsecured_mid_[6] = {2, 0, 0, 0, 0, 1}; // MicrOBU: random per configure(); MAC of unsecured frames
std::uint32_t raw_forwarded_ = 0, raw_oversize_ = 0;
// MicrOBU V2X_RX: forwarded in one message, forwarded in fragments (and how many of those no transport took),
// dropped as unusable or beyond v2x_rx_max_forward, and large ones left to the RAW_FRAME copy.
std::uint32_t raw_forwarded_ = 0, raw_fragmented_ = 0, raw_fragment_failed_ = 0, raw_oversize_ = 0, raw_covered_ = 0;
// declared before everything that refers to its keys (security_, pki_pending_), so it is destroyed last
std::unique_ptr<microbu_v2x::security::SecurityModule> module_;
std::unique_ptr<vanetza::ManualRuntime> runtime_;