Skip to content

Feature: mDNS Discovery Support #31

@IoanAndrasi

Description

@IoanAndrasi

Motivation:
SOVD deployments in automotive and embedded environments often operate on local networks without centralized service registries. mDNS-SD (DNS-Based Service Discovery over multicast DNS) allows SOVD servers to advertise themselves and discover peers on the local network with zero configuration, making it ideal for workshop tools, prototype setups, and multi-ECU environments.


Proposed Design

A new mdns feature flag (opt-in) in opensovd-providers exposes an MdnsDiscoveryProvider that implements the existing DiscoveryProvider trait. A thin MdnsWrapper owns the underlying mDNS daemon and is shared via Arc between the advertiser and the discovery provider so only one daemon per process is needed.

Service type: _sovd._tcp.local.

TXT records per service:

Key Value
identification VIN or device identifier
accessurl Base HTTP URL, e.g. http://192.168.1.10:7690/sovd

API

A server registers itself and wires up discovery through ServerBuilder:

// Advertise this server on the local network
let wrapper = Arc::new(MdnsWrapper::new()?);
wrapper.register("my-ecu", "VIN123", "http://192.168.1.10:7690/sovd", ip, port)?;

// Share the same daemon with the discovery provider
let provider = MdnsDiscoveryProvider::from_wrapper(Arc::clone(&wrapper));

let server = Server::builder()
    .discovery(Box::new(provider))
    // ...
    .build()?;

CLI / Gateway Integration

The opensovd-gateway binary gains a --mdns flag group (feature-gated):

Flag Env var Description
--mdns Enable mDNS advertisement and discovery
--mdns-name NAME mDNS instance name (default: opensovd)
--mdns-host IP SOVD_MDNS_HOST IP to advertise (required when host cannot be inferred from the bind address)
--mdns-identification ID SOVD_MDNS_ID VIN / device ID for the TXT record (defaults to --mdns-name)

Example:

opensovd-gateway --mdns --mdns-host 192.168.1.10

Example

An mdns example under examples/server/mdns/ demonstrates how two instances on the same LAN register themselves and discover each other:

cargo run -p opensovd-examples-server --example mdns --features mdns -- \
    --addr 192.168.1.10:7690 --name server-a

cargo run -p opensovd-examples-server --example mdns --features mdns -- \
    --addr 192.168.1.10:7691 --name server-b

Note: mDNS requires a routable LAN IP — 127.0.0.1 will not work.

Discovery can be verified independently with:

avahi-browse _sovd._tcp --resolve --terminate

Acceptance Criteria

  • opensovd-providers exposes MdnsWrapper and MdnsDiscoveryProvider behind a mdns feature flag
  • MdnsDiscoveryProvider correctly implements the DiscoveryProvider trait and streams discovered SOVD peers
  • TXT records include identification and accessurl fields
  • opensovd-gateway supports --mdns, --mdns-name, --mdns-host, --mdns-identification flags (feature-gated)
  • Example server under examples/server/mdns/ demonstrates registration and peer discovery on a real LAN interface
  • A single MdnsWrapper daemon is shared between advertiser and discovery provider per process

Metadata

Metadata

Assignees

Labels

needs-triageReport received, not yet confirmed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions