Skip to main content

resolve_receive_iface

Function resolve_receive_iface 

Source
pub fn resolve_receive_iface(
    iface: Option<&IfaceSelector>,
    camera_ip: Ipv4Addr,
) -> Result<Iface>
Expand description

Resolve the local interface that will receive packets from camera_ip.

Without --iface, ask the OS which local interface routes to the camera instead of refusing to run: list, xml, report, get, set and set-ip all tolerate a missing --iface and fall back to broadcast discovery, and stream, bench and events were the exceptions.

That mattered beyond consistency. viva-camctl stream --ip <IP> is the command our own documentation hands to anyone reporting a camera we cannot open, and it exited before touching the network. Meanwhile Iface::from_remote_ipv4 — the route probe added by #72 for this exact case, and produced by that very issue — had no caller in this crate (backlog DX-08).

Note which side of the split each function serves: the selector names a host interface, while camera_ip is remote, so the fallback must be from_remote_ipv4 and never from_ipv4. Passing a camera address to from_ipv4 is the #70 defect, and viva-service still had a copy of it (backlog SVC-06).