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
+19 -2
View File
@@ -27,11 +27,11 @@ CFLAGS = -std=c11 -O2 -g -Wall -Wextra -Wpedantic -Werror -I$(FW) -I. \
FW_SRCS = $(FW)/geonet.c dot11p.c $(FW)/gn_unwrap.c
DEPS = test_util.c test_util.h dot11p.h $(FW_SRCS) $(wildcard $(FW)/*.h)
.PHONY: all check chain replay fuzz battery firmware corpus clean
.PHONY: all check chain replay fuzz battery firmware fragments corpus clean
all: check
check: chain replay fuzz battery firmware
check: chain replay fuzz battery firmware fragments
$(BUILD):
mkdir -p $@
@@ -83,6 +83,23 @@ $(BUILD)/test_firmware$(EXE): test_firmware.cpp $(FW_CXX_SRCS) $(wildcard $(FW)/
firmware: $(BUILD)/test_firmware$(EXE)
$(BUILD)/test_firmware$(EXE)
# Recorded traffic through unwrap -> V2X_RX body -> fragments -> reassembly (the large MAPEMs and SPATEMs of a road RSU).
# Needs a capture: the CiT node's 2026-11-23 recording has 1198-byte MAPEMs and 888-byte SPATEMs.
FRAG_PCAPS = $(wildcard ../../../databases/its5_20261123_150746.pcap) $(RECORDINGS)
$(BUILD)/fw_c_test_util.o: test_util.c test_util.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/test_v2x_fragments$(EXE): test_v2x_fragments.cpp $(BUILD)/fw_c_test_util.o $(BUILD)/fw_c_gn_unwrap.o $(FW)/link_protocol.cpp $(wildcard $(FW)/*.hpp) | $(BUILD)
$(CXX) $(CXXFLAGS) -std=c++20 -I. -fsanitize=undefined -fsanitize-undefined-trap-on-error -o $@ test_v2x_fragments.cpp $(FW)/link_protocol.cpp $(BUILD)/fw_c_test_util.o $(BUILD)/fw_c_gn_unwrap.o
fragments: $(BUILD)/test_v2x_fragments$(EXE)
ifeq ($(FRAG_PCAPS),)
@echo "fragments: no captures, skipped"
else
$(BUILD)/test_v2x_fragments$(EXE) $(FRAG_PCAPS)
endif
# Corpus for the app's GnUnwrapTest (the Kotlin port of gn_unwrap.c): recorded frames, cut and corrupted copies of
# them, with the verdict and fields of the firmware's own code. Writes ../../../app/src/test/resources/gn_unwrap_corpus.tsv
CORPUS_OUT = ../../../app/src/test/resources/gn_unwrap_corpus.tsv