|
| 1 | +# Phase 45 - Native SCTP Production Transport |
| 2 | + |
| 3 | +Phase 45 hardens the Linux native SCTP transport path so SDK traffic can carry real stream id and PPID metadata through the kernel SCTP stack and retain evidence from a repeatable Linux sample. |
| 4 | + |
| 5 | +## Goals |
| 6 | + |
| 7 | +- Use Linux SCTP metadata APIs for send and receive. |
| 8 | +- Preserve stream id, PPID, and unordered metadata in `ISctpTransport`. |
| 9 | +- Apply reconnect policy during native SCTP connect. |
| 10 | +- Enforce send backpressure before kernel send. |
| 11 | +- Track cancellation, operation timeout, lifecycle, recovery, queue metrics, and graceful shutdown. |
| 12 | +- Provide a repeatable Linux sample that captures PCAP, SDK trace, logs, reconnect attempts, metadata validation, comparison output, report, and digests. |
| 13 | + |
| 14 | +## Completed Units |
| 15 | + |
| 16 | +| Unit | Capability | Status | |
| 17 | +| --- | --- | --- | |
| 18 | +| 1 | lksctp-backed metadata send and receive | Complete | |
| 19 | +| 2 | `NativeSctpTransportOptions` for metadata, timeout, reconnect, and backpressure policy | Complete | |
| 20 | +| 3 | send queue and receive operation metrics | Complete | |
| 21 | +| 4 | native adapter timeout, cancellation, fault recovery, and diagnostics snapshots | Complete | |
| 22 | +| 5 | graceful shutdown lifecycle events | Complete | |
| 23 | +| 6 | connector retry trace for reconnect validation | Complete | |
| 24 | +| 7 | lab runner metadata validation for stream id and PPID | Complete | |
| 25 | +| 8 | Linux evidence script with PCAP, logs, trace, comparison, report, and digests | Complete | |
| 26 | +| 9 | unit tests for production options and reconnect attempt records | Complete | |
| 27 | +| 10 | README, SCTP docs, roadmap, and phase index alignment | Complete | |
| 28 | + |
| 29 | +## Production Transport Behavior |
| 30 | + |
| 31 | +`NativeSctpSocketAdapter` now sends `SctpOutboundMessage` values through lksctp `sctp_sendmsg`, preserving: |
| 32 | + |
| 33 | +- stream id |
| 34 | +- PPID |
| 35 | +- unordered flag |
| 36 | + |
| 37 | +Receive uses lksctp `sctp_recvmsg`, so `ISctpTransport.ReceiveAsync` returns `SctpReceiveResult` with kernel-provided metadata instead of a synthetic default. |
| 38 | + |
| 39 | +The adapter also exposes: |
| 40 | + |
| 41 | +- `GetQueueMetrics()` |
| 42 | +- `GetDiagnosticsSnapshot()` |
| 43 | +- `ShutdownAsync(...)` |
| 44 | +- latest backpressure and recovery decisions |
| 45 | +- association lifecycle entries |
| 46 | + |
| 47 | +## Linux Sample |
| 48 | + |
| 49 | +Run this from the repository root on a Linux host with kernel SCTP, `libsctp.so.1`, `tcpdump`, `tshark`, and .NET installed: |
| 50 | + |
| 51 | +```bash |
| 52 | +SIGTRAN_ARTIFACT_ROOT="$HOME/sigtran-lab/artifacts/phase45" \ |
| 53 | +SIGTRAN_STREAM_ID=1 \ |
| 54 | +SIGTRAN_PPID=3 \ |
| 55 | +bash scripts/run-phase45-native-sctp-lab.sh |
| 56 | +``` |
| 57 | + |
| 58 | +The script publishes the lab binary, starts `tcpdump`, runs a loopback M3UA exchange over real SCTP, intentionally starts the client before the server to validate reconnect, validates stream/PPID metadata from `sctp_recvmsg`, performs graceful shutdown, generates a TShark decode, writes a Markdown report, and computes SHA-256 digests. |
| 59 | + |
| 60 | +## Completion Criteria |
| 61 | + |
| 62 | +Phase 45 is complete when the code path builds, tests, packs, and the Linux sample produces: |
| 63 | + |
| 64 | +- PCAP under `pcap/` |
| 65 | +- SDK JSONL trace under `trace/` |
| 66 | +- lab and capture logs under `logs/` |
| 67 | +- TShark comparison output under `comparison/` |
| 68 | +- readiness report under `reports/` |
| 69 | +- digest manifest under `digests/` |
| 70 | + |
| 71 | +The report must show metadata validation, stream validation, PPID validation, at least one failed reconnect attempt, one successful reconnect attempt, metrics snapshots, and client/server graceful shutdown events. |
| 72 | + |
| 73 | +## Passing Evidence |
| 74 | + |
| 75 | +Run `phase45-native-sctp-20260701T103951Z` passed on the Linux VM `sigtrannet` with kernel `5.15.0-181-generic`. |
| 76 | + |
| 77 | +- Evidence report: `docs/evidence/PHASE45_NATIVE_SCTP_20260701T103951Z.md` |
| 78 | +- Evidence manifest: `docs/evidence/PHASE45_NATIVE_SCTP_20260701T103951Z.json` |
| 79 | +- Retained artifact root: `/home/ammar/sigtran-phase45-run/artifacts/phase45-native-sctp-20260701T103951Z` |
| 80 | +- PCAP SHA-256: `33c7708b66fba17b7f5e72ed30e06be3e1f8e01d27e60c25d8c7165fe5663f35` |
| 81 | +- SDK trace SHA-256: `abaa2a9153b10db6abd73050c85d26c820d16d892594e781e4ade9559e863c90` |
| 82 | + |
| 83 | +This evidence closes the native Linux SCTP loopback gate for Phase 45. Independent external peer interoperability remains a separate production gate. |
0 commit comments