Skip to content

Rewrite Zenoh layer against the 1.x wire format - #5084

Draft
polybassa wants to merge 8 commits into
secdev:masterfrom
polybassa:pr-5043
Draft

polybassa wants to merge 8 commits into
secdev:masterfrom
polybassa:pr-5043

Conversation

@polybassa

Copy link
Copy Markdown
Contributor

No description provided.

polybassa and others added 7 commits July 14, 2026 20:54
AI-Assisted: no
AI-Assisted: yes (Cursor AI)
AI-Assisted: yes (Cursor AI)
The dissector did not match the protocol as implemented by zenohd, so it
could not decode real traffic: transport and network message IDs were
outside their actual ranges, header flags sat at the wrong bit offsets,
the Zenoh ID was length prefixed instead of packed into the zid_len
nibble, timestamps were read as a single opaque buffer rather than a zint
counter plus a source ID, extensions had no TLV or chaining support, and
stream links were missing the 16 bit little endian batch length prefix.

Rework every layer (scouting, transport, network with its declarations,
and the Put/Del/Query/Reply/Err bodies) following commons/zenoh-protocol
and commons/zenoh-codec, add the zint, zbuf, encoding, timestamp and
consolidation field types, chain extensions through their more bit, and
split batches into ZenohBatch for datagram links and ZenohStreamBatch for
stream links. Optional fields announced by a header flag are now emitted
as soon as they are given a value, and the flag is computed while
building.

Validated against zenohd 1.9.0: every captured payload of a pub/sub,
query, liveliness and delete session dissects without undecoded bytes and
rebuilds byte for byte. Those payloads are kept as regression vectors in
the test file, which now covers the field codecs, each message type
against spec derived bytes, batch framing, port bindings and the
behaviour on fuzzed and truncated input.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the removed orb helper with byte indexing.

AI-Assisted: yes (OpenCode, GPT-6.1)
Reassemble complete TCP batches, decode Shm payload slices, and retain nested edits and explicit extension bits. Set scouting destination ports for concrete message builders.

AI-Assisted: yes (OpenCode, GPT-6.1)
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.66284% with 221 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.50%. Comparing base (57dd077) to head (db0a788).

Files with missing lines Patch % Lines
scapy/contrib/zenoh.py 57.66% 221 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (57dd077) and HEAD (db0a788). Click for more details.

HEAD has 10 uploads less than BASE
Flag BASE (57dd077) HEAD (db0a788)
12 2
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5084       +/-   ##
===========================================
- Coverage   80.55%   47.50%   -33.05%     
===========================================
  Files         375      376        +1     
  Lines       98399    98887      +488     
===========================================
- Hits        79261    46974    -32287     
- Misses      19138    51913    +32775     
Files with missing lines Coverage Δ
scapy/contrib/zenoh.py 57.66% <57.66%> (ø)

... and 282 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Track child wire bytes alongside field state for packet-list cache invalidation. Read conditional slices once when summarizing fuzzed Put messages.

AI-Assisted: yes (OpenCode, GPT-6.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant