rustdesk/rustdesk · error

Found no bindable ipv4 addresses

Error message

Found no bindable ipv4 addresses

What it means

RustDesk LAN discovery broadcasts UDP discovery packets over all local IPv4 interfaces. `send_query` first calls `create_broadcast_sockets()` to bind one UDP socket per IPv4 address; if that returns an empty vec, no interface was bindable and discovery cannot proceed, so it bails with this error.

Source

Thrown at src/lan.rs:191

        }
    }
    ipv4s.push(Ipv4Addr::UNSPECIFIED); // for robustness
    let mut sockets = Vec::new();
    for v4_addr in ipv4s {
        // removing v4_addr.is_private() check, https://github.com/rustdesk/rustdesk/issues/4663
        if let Ok(s) = UdpSocket::bind(SocketAddr::from((v4_addr, 0))) {
            if s.set_broadcast(true).is_ok() {
                sockets.push(s);
            }
        }
    }
    sockets
}

fn send_query() -> ResultType<Vec<UdpSocket>> {
    let sockets = create_broadcast_sockets();
    if sockets.is_empty() {
        bail!("Found no bindable ipv4 addresses");
    }

    let mut msg_out = Message::new();
    // We may not be able to get the mac address on mobile platforms.
    // So we need to use the id to avoid discovering ourselves.
    #[cfg(any(target_os = "android", target_os = "ios"))]
    let id = crate::ui_interface::get_id();
    // `crate::ui_interface::get_id()` will cause error:
    // `get_id()` uses async code with `current_thread`, which is not allowed in this context.
    //
    // No need to get id for desktop platforms.
    // We can use the mac address to identify the device.
    #[cfg(not(any(target_os = "android", target_os = "ios")))]
    let id = "".to_owned();
    let peer = PeerDiscovery {
        cmd: "ping".to_owned(),
        id,
        ..Default::default()

View on GitHub (pinned to 91c9fccbb0)

Solutions

  1. Verify the machine has an active network interface with an IPv4 address (check `ip addr` / network settings) and reconnect if needed.
  2. Confirm no firewall/SELinux/container policy blocks binding UDP sockets for the process.
  3. Retry discovery after network re-connection; the address set is enumerated at call time.
  4. If only IPv6 is available, note LAN discovery is IPv4-only; use direct ID/IP connection instead.

Example fix

// caller hardening
match discover() {
    Err(e) if e.to_string().contains("Found no bindable ipv4 addresses") => {
        log::warn!("LAN discovery unavailable: no IPv4 interface, skipping");
    }
    r => r?,
}
Defensive patterns

Strategy: fallback

Validate before calling

let has_ipv4 = local_ipv4_addresses().await.map(|a| !a.is_empty()).unwrap_or(false);
if !has_ipv4 { log::warn!("no IPv4 address; LAN discovery will fail"); }

Try / catch

match discover() {
    Err(e) if e.to_string().contains("Found no bindable ipv4 addresses") => fallback_to_id_connection(),
    r => r?,
}

Prevention

When it happens

Trigger: Calling `discover()` (LAN peer scan) on a machine where `create_broadcast_sockets()` yields zero sockets: no non-loopback IPv4 address, all binds failing (EADDRINUSE/EPERM), or only IPv6/VPN interfaces present.

Common situations: Host with no network connected; environment where binding to UDP ports is blocked (sandboxed CI, restricted container); interfaces that failed to get an IPv4 address after suspend/resume; mobile devices on cellular-only connections.

Related errors


AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10). Data as JSON: /api/errors/276bdb17b50a3b98. Report an issue: GitHub.