5 min read Field note for CluTerm
An Encrypted Session Through a 228-Byte Hole
CluTerm's mesh now runs over LoRa radio with no internet at all. What I measured on real air, what only exists in a simulator, and why most of the bugs were not in the air.
The question was whether two of my machines could hold their normal encrypted session with the internet gone. Not a degraded mode with its own rules. The same handshake, the same trust checks, the same “run this over there,” carried by a radio that moves a few hundred bytes a second on a good day.
They can. This is what it took, and where the honest edges are.
The constraint
LoRa is the long-range, low-power radio on a cheap hobbyist board. A Meshtastic node, the firmware most of those boards run, will carry a packet of at most 231 bytes; I fragment at 228. CluTerm’s post-quantum handshake opens with a frame of 1,357 bytes. So the first message of a session is at least six packets before anyone has said anything, on a channel where each packet has to wait its turn.
The design rule that made this tractable: the radio is a dumb pipe. Nothing above it knows it is there. The session that runs over LoRa is byte-for-byte the session that runs over the relay. If the radio carrier needed its own handshake or its own trust shortcuts, I would have two security systems and the weaker one would be the real one.
So the radio stack is three thin layers under an unchanged session:
- A byte pump. A serial port, nothing more.
- A codec. Whatever framing the attached device speaks. Pure functions, no I/O.
- A reliability layer. Fragment to the packet size, acknowledge in bursts, keep one message in flight each way, estimate the round trip the way TCP does and back off the same way.
And one rule on top that I am fond of: the link refuses work by name. A terminal stream, a file transfer, a sensor feed are not queued on a narrowband link in the hope they will drain. They are refused, immediately, with the reason. A radio that says no in one second is more useful than one that says yes and delivers on Thursday.
What I measured
Two boards on a desk, a private channel, 2 dBm, real air:
| Meshtastic preset | Bulk goodput | 64-byte round trip |
|---|---|---|
| Short Turbo | 4.12 kbps | 1.36 s |
| Short Fast | 2.96 to 3.47 kbps | 1.43 to 1.49 s |
| Long Fast | 0.465 kbps | 6.89 s |
Before tuning, the Short Fast row was 0.98 kbps and 2.24 seconds. The threefold gain came from three unglamorous changes: acknowledging in bursts (acks per 20 KB fell from 106 to 10), pacing sends from the node’s own airtime arithmetic instead of guessing, and addressing by channel rather than direct message, because the firmware’s per-packet public-key step for direct messages cost most of a second on its own.
Half a kilobit per second sounds like nothing. It is uptime on a machine you cannot otherwise reach, an approval prompt, a message to the agent on the other side. For those, seven seconds is fine.
The bugs were in the node, not the air
I expected to fight packet loss. Mostly I fought assumptions.
The backlog dump. Two agents on Long Fast would never finish a handshake. A Meshtastic node, when a client attaches, hands over everything it queued while nobody was listening. The responder was greeting a challenge from the previous attempt as if it were live. Now anything arriving within one packet cycle of attach is dropped, and a counter says how many, so a stuck link stops looking like an idle one.
Half-open by 0.2 milliseconds. About one simulated run in twenty ended with the handset showing “LoRa, connected” while the Mac answered unreachable. The initiator counted the session open when it sent its final message. The responder’s window closed at 43.5875 seconds. The message arrived at 43.5877. Fix: a session that is let go says so with a reset, and liveness listens for session data, never for acknowledgements. An ack proves the radio works. It does not prove anyone is home.
The seeds that weren’t. My “seeded” simulations were not reproducible. Stream identifiers came from the operating system’s randomness, and certain byte values need escaping in one framing, which changes a frame’s length, which changes its airtime, which changes everything after. The simulated air now supplies all randomness, and a test asserts that the same seed is the same run.
Zero is not “default.” A hop limit of 0 does not mean “use the node’s setting.” It means no relays. Naturally.
One codebase, two very different computers
The reliability layer, the codecs and the discovery protocol read no clock, spawn no task and touch no socket. Time and bytes are handed in; decisions are handed back. That style is called sans-IO, and it bought two things.
It made the simulator honest, because the simulator drives exactly the code that ships.
And it meant the same Rust runs on a Mac and on an ESP32 handset with a touchscreen and no operating system to speak of. A test inspects the dependency tree and fails if anything async creeps in. That gate caught a real one before release: five 64-bit atomic counters, which the microcontroller does not have.
Finding each other without saying who you are
A radio channel is public. Announcing “I am Aleks’s laptop” on it is a tracking beacon.
So discovery is blinded. A device asks, in 21 bytes, “is anyone here who can prove membership in this epoch,” and gets a 13-byte answer. Both are keyed tags over a fifteen-minute window. Someone listening learns that two radios exchanged 34 bytes. And because devices carry certificates signed by the owner’s root key, a handset can verify a machine it has never met with no server to ask. That is the property that makes “no internet” real instead of “no internet after you logged in.”
The honest edges
Measured on real radios: the table above, two boards, one desk.
Tested on simulated lossy air only: the handset holding a full session over LoRa, one radio serving many peers at once, the glasses-tap-to-message path. At ten percent loss with three parties, sessions hold. At six parties on Long Fast, some sessions stall out, and that is tracked, not fixed.
Not measured at all: range in metres, and anything across multiple hops. I have a procedure for both and no numbers, so I am not going to give you any.
The part I would defend without caveats is the shape. The radio got no special treatment from the security model, and the security model got no special treatment from the radio. Each was allowed to be exactly as limited as it is.