{"record":{"id":"276bdb17b50a3b98","repo":"rustdesk/rustdesk","slug":"found-no-bindable-ipv4-addresses","errorCode":null,"errorMessage":"Found no bindable ipv4 addresses","messagePattern":"Found no bindable ipv4 addresses","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lan.rs","lineNumber":191,"sourceCode":"        }\n    }\n    ipv4s.push(Ipv4Addr::UNSPECIFIED); // for robustness\n    let mut sockets = Vec::new();\n    for v4_addr in ipv4s {\n        // removing v4_addr.is_private() check, https://github.com/rustdesk/rustdesk/issues/4663\n        if let Ok(s) = UdpSocket::bind(SocketAddr::from((v4_addr, 0))) {\n            if s.set_broadcast(true).is_ok() {\n                sockets.push(s);\n            }\n        }\n    }\n    sockets\n}\n\nfn send_query() -> ResultType<Vec<UdpSocket>> {\n    let sockets = create_broadcast_sockets();\n    if sockets.is_empty() {\n        bail!(\"Found no bindable ipv4 addresses\");\n    }\n\n    let mut msg_out = Message::new();\n    // We may not be able to get the mac address on mobile platforms.\n    // So we need to use the id to avoid discovering ourselves.\n    #[cfg(any(target_os = \"android\", target_os = \"ios\"))]\n    let id = crate::ui_interface::get_id();\n    // `crate::ui_interface::get_id()` will cause error:\n    // `get_id()` uses async code with `current_thread`, which is not allowed in this context.\n    //\n    // No need to get id for desktop platforms.\n    // We can use the mac address to identify the device.\n    #[cfg(not(any(target_os = \"android\", target_os = \"ios\")))]\n    let id = \"\".to_owned();\n    let peer = PeerDiscovery {\n        cmd: \"ping\".to_owned(),\n        id,\n        ..Default::default()","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/rustdesk/rustdesk/blob/91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540/src/lan.rs#L173-L209","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the machine has an active network interface with an IPv4 address (check `ip addr` / network settings) and reconnect if needed.","Confirm no firewall/SELinux/container policy blocks binding UDP sockets for the process.","Retry discovery after network re-connection; the address set is enumerated at call time.","If only IPv6 is available, note LAN discovery is IPv4-only; use direct ID/IP connection instead."],"exampleFix":"// caller hardening\nmatch discover() {\n    Err(e) if e.to_string().contains(\"Found no bindable ipv4 addresses\") => {\n        log::warn!(\"LAN discovery unavailable: no IPv4 interface, skipping\");\n    }\n    r => r?,\n}","handlingStrategy":"fallback","validationCode":"let has_ipv4 = local_ipv4_addresses().await.map(|a| !a.is_empty()).unwrap_or(false);\nif !has_ipv4 { log::warn!(\"no IPv4 address; LAN discovery will fail\"); }","typeGuard":null,"tryCatchPattern":"match discover() {\n    Err(e) if e.to_string().contains(\"Found no bindable ipv4 addresses\") => fallback_to_id_connection(),\n    r => r?,\n}","preventionTips":["Check for an active IPv4 interface before offering LAN discovery in the UI.","Disable VPN-only configurations when scanning LAN, or warn the user.","Log interface enumeration results to diagnose empty bind sets."],"tags":["network","udp","discovery","no-network-interface"],"backgroundTag":"network-request-failed","analyzedSha":"91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540","analyzedAt":"2026-09-10T19:53:44.083Z","contentChangedAt":"2026-09-10T19:53:44.083Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}