A Rust implementation of the Dynamic Link Exchange Protocol (DLEP, RFC 8175), covering both the router and modem sides from a single workspace.
DLEP is an event-driven protocol that lets a router obtain timely link-state and link-quality information from a co-located modem (typically a wireless or radio modem) over a single Layer-2 segment. Discovery happens over UDP multicast; the session itself is a long-lived TCP (or TLS) connection over which the modem reports destinations, advertises and updates per-destination metrics (data rate, latency, link quality, MTU, …) and exchanges heartbeats.
Status: core implementation with remaining conformance gaps. Wire codec, both state machines, TCP + TLS (mutual TLS supported) transport, UDP multicast discovery with GTSM, destinations & metrics,
Session Update,Destination Announce, andLink Characteristics Request/Response, the extension plug-in API, and deployable CLI binaries with reconnect-on-drop. See §9 ofdoc/architecture.mdfor the milestone log and remaining follow-ups, anddoc/deployment.mdfor deployment.The modem binary integrates a radio through an external adapter process that reports destinations and session addresses and answers Link Characteristics Requests. Embedders can register a link-control backend directly. Busy commands return explicit acceptance errors.
The router binary can run a router adapter to consume retained session/destination snapshots and submit targeted session address, announce, withdrawal, and link-characteristic commands. Routing policy belongs to the adapter.
- Implement both sides of the protocol from a single tree, so end-to-end tests can run on loopback.
- Expose the daemon as a library (
dlep-daemon) so a third party can embed DLEP into their own networking stack without taking the bundled binaries. - Keep wire format and state machines fully tested in isolation (no I/O), so logic bugs are caught without spinning up sockets.
- Provide a stable plug-in API for DLEP extensions (RFC 8175 §13.6 reserves a Private Use range for them).
- Support TLS as a first-class transport, per the RFC's security guidance.
crates/
├── dlep-core wire types, data items, byte-level codec
├── dlep-fsm state machines (no I/O, no tokio)
├── dlep-net transport: UDP multicast, TCP, TLS, framing
├── dlep-ext extension plug-in trait + registry
├── dlep-daemon integration layer + public library API
├── dlep-router router-side daemon binary
└── dlep-modem modem-side daemon binary
The dependency DAG is acyclic; dlep-core is the leaf and has no internal
dependencies. See doc/architecture.md for per-crate
responsibilities and the design rationale.
Requires Rust 1.85 or newer (edition 2024). Linux supports the full transport,
including strict TCP GTSM. Experimental macOS and FreeBSD paths require explicitly setting
[network].gtsm_enforce = false; TCP/TLS and discovery retain outbound TTL/hop
limit 255, and discovery still checks received TTLs. The core, FSM, and extension
API are portable. See macOS setup and
FreeBSD setup.
cargo build --workspace --locked
cargo clippy --workspace --all-targets --locked -- -D warningsRun network tests using the isolated namespace command below. CI also checks Rust 1.85, protocol crates and opt-out transport on macOS/FreeBSD, coverage, workflow syntax, and dependency advisories. See CI documentation for job scope, local commands, coverage artifacts, and the guarded audit exception.
Version 0.3.0 provides a combined launcher and separate role-specific CLIs:
cargo install dlep --version 0.3.0 --locked
dlep router --help
dlep modem --help
# Alternatively:
cargo install dlep-router dlep-modem --version 0.3.0 --lockedFor a source checkout, cargo build --release --workspace --locked builds all
three commands. dlep router and dlep modem run the same implementations as
the standalone binaries, with identical flags. The published 0.1.0 dlep
command was a placeholder; see release notes and the
release validation commands.
Provision certificates and install the binaries with the capabilities described in the deployment guide before using the example configs. Both binaries take a TOML configuration file:
dlep-router --config /etc/dlep/router.toml
dlep-modem --config /etc/dlep/modem.tomlNetwork settings can also be overridden with --bind-addr, --discovery-port,
and the modem's --tcp-port; see the deployment guide.
See the feature backlog for remaining
product work and its scope.
Routers can filter unsolicited destinations with a [destinations] allow/deny
policy; see destination admission.
Modems can advertise RF-medium access control using top-level secured_medium;
routers expose it in peer metadata and adapter snapshots, independently of TLS.
CLI flags shared by both binaries:
| Flag | Purpose |
|---|---|
--config |
Path to the TOML config file. |
--interface |
Select the discovery interface (overrides config). |
--dual-stack-discovery |
Enable IPv4 and IPv6 discovery together; requires an interface. |
--bind-addr |
Override the local discovery address; also the modem's TCP listen address. |
--discovery-port |
Override the discovery destination/listen port. |
--log-level |
Override the DLEP_LOG filter (info, debug, …). |
--log-format |
Select text (default) or JSON Lines; overrides DLEP_LOG_FORMAT. |
--no-tls |
Force plain TCP regardless of config. |
--cert, --key |
Override the TLS identity files. |
--ca-bundle |
Override the trusted CA bundle. |
--check-config |
Validate configuration and TLS material, then exit. |
--generate-completions SHELL |
Print shell completions and exit. |
--help / -h |
Show options without starting networking. |
--version / -V |
Show the installed version. |
Logging precedence is --log-level, then DLEP_LOG, then info; RUST_LOG
is not read. Set --log-format json or DLEP_LOG_FORMAT=json for structured
tracing records on stdout, with timestamp, level, target, and nested fields.
Help, completions, configuration-check output, and stderr diagnostics keep their
normal formats. --config also accepts -c and the role-specific
DLEP_ROUTER_CONFIG / DLEP_MODEM_CONFIG environment variable; an explicit flag
wins. Router-only --peer ADDR is repeatable and selects static connections.
It accepts modem.example:854, IPv4 192.0.2.10:854, or bracketed IPv6
[2001:db8::10]:854; the port is required. TOML static_peers accepts the same
forms, including link-local peers such as [fe80::1%eth0]:854. Named interfaces
are resolved on every connection attempt; numeric scope IDs still work. Zones
select the route while TLS verifies the IPv6 address. DNS peers use the requested hostname for TLS verification and SNI, and
each retry calls the system resolver again. --check-config validates names
without resolving them.
Modem-only --tcp-port PORT overrides its listener; zero selects an allocated
port. Routers use the TCP port supplied by each peer endpoint or offer.
See the deployment guide for details.
Generate completions for Bash, Elvish, Fish, PowerShell, or Zsh from the installed CLI definitions. For example, enable Bash completion in the current shell:
source <(dlep --generate-completions bash)
# For standalone installations:
source <(dlep-router --generate-completions bash)
source <(dlep-modem --generate-completions bash)The launcher script includes both roles and their options. Generation exits before loading configuration or starting networking; see completion installation for persistent setup.
A minimal plaintext development configuration for either role (select an interface present on your host):
[network]
interface = "eth0"
discovery_v4_group = "224.0.0.117"
discovery_v6_group = "ff02::1:7"
discovery_port = 854
use_tls = false
gtsm_enforce = true
[timers]
heartbeat_interval_ms = 60000
discovery_interval_ms = 5000The full schema (network, TLS, timers, plus router/modem-specific keys) is
documented in §6 of doc/architecture.md.
Unknown keys and sections are rejected, including at the top level. Run
--check-config after editing. Heartbeat and discovery intervals must be at
least 1000 ms; initialization and termination timeouts must be positive.
Daemon builders enforce the same timer limits for programmatic configuration.
The modem binds UDP and TCP port 854 and normally needs
CAP_NET_BIND_SERVICE. The router uses ephemeral source ports and does not need that capability. Both roles needCAP_NET_RAWfor strict TCP GTSM; the supplied systemd units grant the capabilities for each role.
use std::sync::Arc;
use dlep_daemon::{DaemonEvent, RouterDaemon, RouterConfig};
use dlep_ext::DlepExtension;
let daemon = RouterDaemon::builder()
.config(RouterConfig::default())
.register_extension(my_extension as Arc<dyn DlepExtension>)
.with_rustls_client(my_client_tls_config)
.spawn()
.await?;
let mut events = daemon.subscribe(); // broadcast::Receiver<DaemonEvent>
daemon.start_discovery().await?;
while let Ok(event) = events.recv().await {
match event {
DaemonEvent::PeerDiscovered(offer) => {
daemon.connect_discovered(&offer).await?;
}
_ => { /* react to SessionUp, Destination { .. }, Metrics { .. }, etc. */ }
}
}
daemon.shutdown().await?;This setup sketch omits application shutdown and event-loss recovery. Discovery
only reports offers; the application chooses when to connect. The router binary
adds concurrent scheduling and reconnection using the retained connection-state
feed described below. Library applications must supply their own policy and
handle broadcast::error::RecvError::Lagged if they need to continue after event
loss. If discovery stops unexpectedly (for example, a socket failure or a
failed family in dual-stack mode), both daemons log an error and publish
DaemonEvent::DiscoveryStopped; sessions continue, and a router can call
start_discovery again.
Negotiated extensions can request termination of their current session through
ExtensionCtx::terminate_session(reason). The runtime uses the existing FSM
termination exchange, response deadline, snapshot cleanup, and lifecycle events.
The first accepted request wins and discards queued extension messages; existing
protocol-error/closing transitions take precedence. Session-down hooks reject
new requests, and custom contexts default to Unsupported. See the
extension API example. Reconnect policy remains with
the application or CLI.
Embedders can register named extension factories on either daemon builder with
register_extension_factory(name, factory), or share an ExtensionCatalog via
extension_catalog(catalog). Each factory receives its [extensions.NAME] TOML
table from SharedConfig.extensions, validates it, and constructs a plugin
before networking starts. Missing tables supply empty settings for plugin
defaults. Prebuilt register_extension instances retain their existing behavior.
Use check_router_config_with_extensions / check_modem_config_with_extensions
to validate with the same catalog. See configured plugins.
Plugins can explicitly opt in to pre-session discovery through
supports_discovery(). Separate send, data-item, and whole-signal hooks attach
and inspect extension TLVs in Peer Discovery/Peer Offer signals. They receive
datagram metadata and share bounded item/byte budgets; core fields and packet
validation remain under the runtime. Discovery input is unauthenticated and does
not activate negotiated TCP callbacks. See discovery hooks.
For direct connections, connect_named("modem.example", 854) resolves the host
with the system resolver and verifies TLS against that hostname. It tries up to
16 distinct addresses in resolver order within a shared 15-second deadline and
returns the connected SocketAddr. Each call resolves afresh. Events and
snapshots retain numeric endpoints, and the caller owns reconnect policy.
One connection/session slot covers resolution and all fallback attempts.
connect_static_with_server_name(addr, "modem.example") connects to a numeric
endpoint with an explicit certificate identity, without DNS lookup.
connect_static(addr) continues to verify the endpoint IP. All three return
after transport registration, before DLEP initialization; wait for SessionUp
before sending session commands. RouterConfig.static_peers retains its numeric
Rust type; programmatic callers add DNS entries through named_peers using
NamedPeer::new(host, port). Serialization combines both into static_peers.
Both daemons expose state(), a retained watch::Receiver<DaemonSnapshot> for
late or slow consumers. Read its initial value and subsequent changes; clone the
snapshot and release the watch borrow before awaiting. It contains a monotonic
generation and sessions keyed by SessionId, with peer identity, negotiated
extensions, session metrics, peer addresses, and destinations with effective
metrics and addresses. Destination phases distinguish pending Up/Down, Up, and
modem knowledge retained after a router withdraws interest. Established sessions
remain visible while terminating and are removed when they end, including task
cancellation. Initializing sessions are absent.
Snapshots come directly from each session's FSM before public events and command acceptance receipts. They are authoritative local state, not confirmation of peer delivery. Changes can coalesce: reconcile from the latest snapshot instead of applying older broadcast events over it. Transient command outcomes, extension payloads, and termination reasons remain events and are not recovered by this feed. The connection-state feed below remains the source for reconnect policy.
The modem-side API is symmetric, with
add_destination / update_destination / drop_destination in place of
start_discovery / connect_static.
DestinationEvent::UpResponse tells the modem whether a router accepted or
declined its Destination Up, preserving the peer's status and text. The event
follows retained-state publication: the destination is Up on success or
Withdrawn on a nonfatal refusal, with its latest metrics and addresses kept.
A refusal affects only that router; the physical destination remains available
to other routers and for a later Announce.
ModemDaemon::update_session_metrics sends session-wide metric changes via
Session Update (RFC 8175 §12.7). The router compatibility method returns an
error: routers may report Layer 3 changes but cannot originate metric items.
announce_destination is router-side only. The modem denies destinations it
does not know; successful responses create destinations at the router.
DestinationEvent::AnnounceResponse reports each validated, nonfatal reply's
status and text, including denials. Success publishes the destination and emits
DestinationEvent::Up before this completion event. Both events carry the peer
and session identity in their enclosing DaemonEvent::Destination.
RouterDaemon::announce_destination_with_addresses(session_id, destination, changes) targets one modem with IPv4/IPv6 address hints in AddressChanges.
Attached subnets, duplicate/conflicting entries, and oversized Announce messages
are rejected locally. Hints do not change retained addresses; the modem responds
with its actual destination data. Router adapters expose these hints as optional
add/remove objects on destination_announce, and radio adapters receive them
on destination_announced, including denied requests. Empty hints still request
a response. The existing MAC-only Announce API remains available.
Set ModemConfig.metrics (the TOML [metrics] section) to the initial
session-wide values. Rates use bits/second and latency_us uses microseconds.
The mandatory rates and latency default to zero; configure them for the actual
link before deployment. Optional resources, rlq_rx, rlq_tx, and mtu
default to unsupported and are omitted from the wire. Only configure optional
metrics that the modem can supply. Percentages must be 0–100; configured current
rates must not exceed their corresponding maximum rates. Invalid configuration
fails --check-config and daemon startup.
API change: the four optional LinkMetrics fields now use Option:
write mtu: Some(1500) to supply a value. Some(0) is an explicit zero.
For destination creation, None inherits the session value; for updates, it
preserves the existing value. Events expose effective values, with None for
unsupported metrics. Support is fixed at session initialization: the modem API
rejects attempts to introduce undeclared metrics, and the router terminates a
peer that sends them. Session metric updates apply supplied values to all
existing destinations and the defaults for future destinations in that session.
ModemDaemon::queue_session_metrics accepts and coalesces updates while the
session transaction is busy. Retained modem state includes the queued values
immediately. Once the preceding response arrives, the modem sends the combined
Session Update and any Destination Updates needed to preserve later destination
reports or link answers. Routers may observe the defaults before those corrections.
The radio adapter uses this path; update_session_metrics still returns Busy
when a session transaction is pending.
Both roles emit DaemonEvent::SessionUpdateResponse with session, peer, status,
and text for each validated, nonfatal reply to a locally sent Session Update.
This covers metrics and address changes, including refusals. Events correspond
to wire replies: coalesced calls do not each receive an outcome, and an address
no-op sends no update. A refusal preserves effective local state. The modem emits
completion before writing any queued next update, whose transaction may already
be pending when a consumer handles the event. Fatal or invalid replies terminate
the session instead; retained snapshots cannot recover lost response outcomes.
To change a session's defaults while preserving its existing destination
metrics, use send_command_to(session_id, SessionCommand::SessionDefaults { metrics })
on the modem. The session reads its current destination values and sends the
Session Update plus any needed corrections in one command. It returns Busy
while a session transaction is pending. Initial radio replay uses this operation
so an older membership snapshot cannot overwrite newer destination values.
Layer 3 changes use AddressChanges { added, removed }; each side contains a
DestinationAddrs set with IPv4/IPv6 addresses and attached subnets.
ModemDaemon::add_destination_with_addresses supplies the initial destination
snapshot, and update_destination_addresses sends later changes. Both daemons
provide update_session_addresses(session_id, changes) for local peer addresses
on one session, using address-only Session Update messages. Router adapters expose
this API as session_addresses with optional add/remove address objects;
session_update_response reports peer completion for each wire update. Locally
advertised addresses are scoped to that session and must be advertised again
after reconnecting. Router adapter snapshots contain remote modem addresses;
radio session_sync snapshots contain remote router addresses and refresh when
those addresses change.
For modem applications maintaining a complete desired address set,
set_session_addresses(session_id, addresses) accepts a replacement even while
the session transaction is busy. Omitted addresses are removed, and an empty set
clears all local addresses. Only the latest desired set is retained; repeating
unchanged state sends nothing. validate_session_addresses(&addresses) checks
uniqueness, canonical subnet identity, and the size limit before an application
caches state for replay, including when no routers are connected. Each desired
set must fit one address-only Session Update when advertised from empty.
Replacing one large set with another can require multiple Session Updates. Removals precede additions, each message waits for its own reply, and subsequent messages are recomputed from the latest desired set. Queued session metrics share available space in the next update, with destination corrections retaining later reports and link grants. A new replacement supersedes unsent changes. Nonfatal refusals preserve local state; fatal replies or session termination stop delivery. Completion notices still correspond to wire replies, so one replacement can produce several notices or none. This API applies to one existing session; applications must replay desired state to new sessions.
Radio adapters use this reconciliation through session_addresses reports
with optional add/remove address objects. The bridge retains the modem's
complete address set, sends it to every connected router, and replays it after
new connections, including reports received with no routers connected. Duplicate
or conflicting entries and oversized resulting sets reject the whole report.
Repeated additions and absent removals are no-ops. These reports take no session
or request ID; the radio's session_sync addresses remain remote router data.
Library SessionSnapshot.local_addresses exposes effective desired local
addresses, including queued modem replacements. It does not confirm peer
acceptance. peer_addresses continues to describe the remote peer; adapter
snapshots retain their existing remote-address meaning. The added snapshot
field and SessionCommand::SetSessionAddresses /
FsmEvent::AppSetSessionAddresses variants require updating exhaustive Rust
struct literals or matches.
Embedders retaining destinations for replay can use
ModemDaemon::validate_destination_snapshot(id, &metrics, &addresses) before
caching a complete snapshot. Supply effective metrics, including supported
optional values. It checks metric declarations, address consistency, and the
Destination Up wire limit without sending a command; session state and MAC-format
policy are still checked when commands are dispatched.
Applications receive DestinationEvent::AddressesChanged or
DaemonEvent::SessionAddresses, with effective changes and the resulting full
snapshot, plus peer/session attribution. Initialization addresses and Announce
Response addresses are retained. DestinationEvent::Announced now also carries
requested_addresses; existing exhaustive patterns need that field or ...
Address-only updates preserve metrics. Destination changes made before Up is
acknowledged are coalesced; changes made while a router has withdrawn interest
are retained for a later Announce. The delta-based update_session_addresses
method returns an explicit Busy error when another session transaction is in
progress; the modem's complete-set set_session_addresses method coalesces.
Large effective destination address changes are sent in multiple Destination Update messages when necessary. Each carries the destination MAC; removals precede additions across messages, and deferred metrics are included once. Receivers can observe intermediate address snapshots as these messages arrive. Individual API batches and complete destination snapshots still undergo normal validation. Near-limit Destination Announce responses similarly carry remaining addresses in follow-up updates after the successful response. Consumers can observe partial address sets during this sequence.
RouterDaemon::drop_destination(session_id, destination) withdraws interest
from one modem. The modem acknowledges with Destination Down Response, stops
reporting that destination on this session, and emits a DestinationEvent::Down.
The radio adapter receives a destination_withdrawn notice with the session and
MAC; its physical destination cache and reports to other routers are preserved.
The router emits its own Down event when the response arrives. The session stays
active; a later Destination Announce can restore reports using the modem's
latest local metrics and addresses. Busy/unknown destinations and stale session
IDs return explicit errors as described below.
Both roles expose replies to locally sent Destination Down messages through
DestinationEvent::DownResponse, with peer status and text. Removal is published
first for every validated, nonfatal reply, including a nonzero status. Routers
emit their existing Down event before completion; modems emit completion only.
A modem can remove an already withdrawn destination locally without sending
Down, so that operation has no reply event. Invalid or fatal replies terminate
the session instead. A delayed completion may describe an earlier incarnation
of a MAC; use retained state for its current presence and metrics.
RouterDaemon::request_link_characteristics(session_id, destination, requested)
requests rate or latency changes from one modem. LinkCharacteristics has
optional receive rate, transmit rate, and latency fields; supply at least one.
Listen for DestinationEvent::LinkCharacteristicsResponse to obtain the status,
status text, and current metrics. A response must include every core metric the
peer declared during initialization. Requests remain pending until a response
arrives or the session resets; RFC 8175 §8 does not permit independent
transaction deadlines. Peer silence is detected by the session heartbeat
mechanism. The former [timers].link_characteristics_timeout_ms setting has
been removed and is rejected if present in a configuration file.
On the modem, ModemBuilder::link_control(backend) registers a
dlep_daemon::LinkControl backend that decides each request. It receives a
LinkRequest (session, peer, destination, requested values, and current
metrics) and returns a LinkResponse: granted(metrics) for an applied change
or denied() when it cannot be met, optionally with_text(..). The request
holds that destination's transaction slot, so the router's further requests and
the modem's drop_destination for it return Busy until the answer. The runtime
therefore drops a backend future that has not answered within 30 seconds and
replies Request Denied ("link-control backend timed out");
ModemBuilder::link_control_timeout(Some(duration)) changes the deadline and
None waits indefinitely. Destination updates remain available. Granted
metrics merge into the destination like update_destination and are reported
only on the requesting session. Undeclared metrics, session-terminating
statuses, oversized responses, and backend panics produce Request Denied with
current metrics. The backend future is dropped if the session ends first. A closure works:
let modem = ModemDaemon::builder()
.config(config)
.link_control(Arc::new(|request: LinkRequest| async move {
match apply_to_radio(&request).await {
Ok(metrics) => LinkResponse::granted(metrics),
Err(reason) => LinkResponse::denied().with_text(reason.to_string()),
}
}))
.spawn()
.await?;To check an answer's content before dispatch, embedders can call
ModemDaemon::validate_link_response(id, &response, ¤t) with the
destination's latest effective metrics. It checks the status, metric declarations,
and complete response encoding, including status text and inherited optional
metrics. Session state and pending-request checks still occur when dispatching.
Backends that retain granted values can override LinkControl::request_with_receipt
and return a LinkControlReply with a Tokio oneshot sender in receipt.
Ok(()) means the session accepted the reply, completed the local response write,
and published its state; it does not acknowledge receipt by the peer. Err
describes rejection of the original answer, even if the daemon sends a fallback
denial. A dropped sender means the outcome is unknown, for example after
cancellation or a write failure. Wait for the receipt outside the returned
future, which must finish first, and retain a grant only after Ok(()).
Existing implementations and closures use the default method unchanged.
Without a backend, the modem returns Request Denied with current destination
metrics, keeping the session alive. The dlep-modem binary uses its
radio adapter as the backend when [radio] is
configured and denies requests otherwise. Either way, the modem application receives
DestinationEvent::LinkCharacteristicsRequested for each request.
When the radio bridge loses daemon events, it sends event_gap followed by a
fresh session_sync, including when membership is unchanged. This recovers the
session list and router addresses while preserving existing withdrawals and
link grants. Lost completion outcomes and destination interest notices remain
unknown. Link requests use a separate delivery path; continue answering
outstanding requests.
Adapters can also send {"type":"resync"} to request current session membership
and router addresses at any time. This refresh preserves existing session state
and does not recover lost completion or destination interest history.
Command methods now await local acceptance by the session task. Ok(()) means
the command was applied, sent, or retained as a pending Up or queued session
metric update; peer responses still arrive as protocol events.
DaemonError::CommandRejected(report) contains
accepted session IDs and per-session rejections (Busy, NotReady,
UnknownDestination, AlreadyExists, Unsupported, or InvalidInput).
NoMatchingSession covers stale IDs and an empty session list. FSM rejections
also produce DaemonEvent::CommandRejected with the command kind, destination,
and peer/session context.
Commands rejected as Busy are not queued or replayed. Retry after the outstanding response,
using application-controlled backoff when no completion event is available.
Broadcasts can partially succeed: inspect the report and use
send_command_to(session_id, SessionCommand::...) on either daemon to retry
only the rejected sessions. undelivered counts channels closed before enqueue;
unknown counts sessions that ended without an acceptance receipt, where the
command may already have taken effect. Canceling an API future after enqueue
also does not cancel the protocol operation. Shutdown bypasses busy checks.
For direct run_session users, command channels now carry SessionRequest;
SessionCommand::... .into() constructs a request without a receipt.
Discovery events carry a PeerOffer containing ordered connection points.
Use RouterDaemon::connect_discovered(&offer) to try compatible endpoints;
TLS-required configurations never fall back to plaintext. Discovery continues
while sessions are active, allowing additional modems to be found. A modem
silently ignores discovery from a router address with an accepted TCP
connection, including during TLS and DLEP initialization. Offers resume after
the last connection from that address closes.
Modems can retry Peer Offers after the immediate reply by setting
[discovery].offer_retries (default 0, maximum 5) and
offer_retry_interval_ms (default/minimum 1000). This can recover a lost
offer without waiting for another router probe. Retries retain the original
UDP endpoint and interface; a connected router cancels its pending burst.
See offer retries for limits.
The termination-response timeout defaults to four local heartbeat intervals
(240 seconds with the default heartbeat). Omit [timers].termination_timeout_ms
to retain this automatic behavior, or set a positive explicit override.
For Rust callers, TimersConfig::termination_timeout_ms and
SessionConfig::termination_timeout now use Option: None selects the
automatic deadline, and Some(...) supplies an override.
The router binary retries dropped sessions with exponential backoff (1 second,
doubling to a 30-second cap). TCP connection success preserves that retry
history while DLEP initialization is pending; only SessionUp resets it.
Repeated discovery offers for a queued endpoint do not bypass the delay.
Static startup, discovered modems, and retries share at most eight concurrent
connection attempts; named static configurations include resolution in this
bound and use the session budget to limit admission. Slow peers leave other connections and event
handling responsive. Unavailable static peers stay queued for retry; queued
peers wait when all slots are occupied, and discovery can retry on later offers.
Reconnect decisions use RouterDaemon::connection_states(), a retained state
feed independent of the lossy public event broadcast. Missing SessionUp or
SessionDown events therefore cannot prevent reconnection or backoff reset
while a peer remains retained. Router limits default to 64 connections/sessions,
256 discovered endpoints, and 300 seconds of inactive discovery history. Static
peers stay eligible for retries; expired/evicted discovered peers require a fresh
offer or explicit connection request. See router limits
for configuration and snapshot-consumer requirements.
DNS retries keep the configured hostname as their key, try at most 16 distinct answers in resolver order, and share a 15-second resolution/connection deadline. Changing answers can move a session between IPv4 and IPv6 without changing the TLS identity. Duplicate entries and aliases cannot open concurrent sessions to the same numeric endpoint; an alias whose address is occupied stays queued. Resolved numeric history remains subject to the discovered-endpoint budget, while each configured hostname stays eligible for retry after that history expires.
[network].interface / --interface selects discovery group membership,
multicast egress, unicast reply source, and accepted ingress interface. For
example, interface = "eth1" with bind_addr = "0.0.0.0" discovers peers on
eth1 while the modem's TCP listener still binds all addresses. A specific IPv4
bind_addr must belong to the selected interface and serves as the preferred
source address. With several addresses and no preference, the lowest IPv4
address is selected. Without an interface name, a specific IPv4 bind_addr
selects its interface; a wildcard lets the routing table choose.
The interface must exist, be up, and have an address in the selected family
plus multicast support (loopback is also supported for IPv4 testing). --check-config and startup validate an explicit
name against the current host. Failure to create discovery on a named interface
fails startup instead of silently disabling discovery. The setting does not bind
TCP connections to a device.
By default, the bind_addr family selects one discovery transport per daemon. For IPv6,
set bind_addr = "::" and interface = "eth1" on both peers; this uses
discovery_v6_group (default ff02::1:7). A wildcard IPv6 bind requires an
interface because multicast needs a link scope. A concrete IPv6 address can
identify its interface without a name, provided it belongs to only one link.
With no preferred address, discovery prefers a link-local address on that
interface. Wildcard TCP listeners advertise that unicast address; discovered
link-local connection points retain their interface scope for TCP. IPv4
remains the default.
DiscoverySocket::recv_with_local now returns IpAddr for the local address.
Enable [network].discovery_dual_stack = true or pass
--dual-stack-discovery --interface eth1 to run both discovery families together.
The interface must have usable IPv4 and IPv6 addresses and support multicast.
bind_addr still selects the modem's single TCP listener; both UDP transports
advertise a concrete address in that listener's family. Both discovery sockets
start and stop together. The default remains single-family discovery.
SessionUp, SessionDown, Destination, and Metrics events carry a
session_id; destination and metric events also carry peer and event
fields. Consumers of the earlier tuple variants must update their matches:
DaemonEvent::Destination { session_id, peer, event }. Metric event values are
effective merged values, including defaults received during initialization.
On Linux, TCP sends use TTL/hop limit 255, including the connection handshake.
With gtsm_enforce = true, the kernel filters lower-TTL traffic and a packet
monitor immediately resets the affected connection. This requires CAP_NET_RAW;
missing privileges fail explicitly. The supplied systemd units grant it.
Setting gtsm_enforce = false disables TCP receive enforcement for development;
outbound TTL remains 255 and discovery still checks inbound TTL before decoding.
Malformed discovery packets are discarded without a per-packet retry delay.
The network tests exercise strict enforcement. On Linux, build first, then run
in an isolated network namespace (requires unprivileged user namespaces and
iproute2):
cargo build --workspace --all-targets --locked
unshare --user --map-root-user bash .github/scripts/test-network.sh \
cargo test --workspace --locked --offlineThis grants capabilities only inside the temporary namespace, without changing binary capabilities or the host network. See the CI workflow for the privileged namespace alternative on systems that restrict user namespaces.
The standalone daemons handle SIGTERM (systemctl stop) and SIGINT (Ctrl-C)
with a graceful DLEP Session Termination exchange. Pending connection attempts
and incomplete TLS handshakes are cancelled during shutdown.
doc/architecture.md— full architecture document: per-crate responsibilities, design decisions, configuration schema, public API shape, testing strategy, milestone status and open questions. Read this before contributing.doc/deployment.md— PKI, privileges, firewall, and systemd, launchd, and FreeBSD rc.d deployment. Native service examples inexamples/launchd/andexamples/rc.d/use the experimental transport configurations inexamples/native/.doc/radio-adapter.md— the JSON Lines protocol betweendlep-modemand an external radio adapter.- RFC 8175 — the protocol specification.
MIT — see LICENSE.