From 4b0aa1edf2a9e3fae0db129cddac0917e3a55610 Mon Sep 17 00:00:00 2001 From: Olivier Date: Mon, 18 May 2026 14:40:19 +0200 Subject: [PATCH] fix: handle ping output with hostname when DNS resolves scan target When the Docker container's DNS can resolve a target IP to a hostname, ping formats the reply line as "from hostname (ip):" instead of the plain "from ip:" format. The proxy-ARP source-IP guard only checked for the plain format, causing those hosts to be incorrectly reported as unreachable despite a valid ICMP response. Co-Authored-By: Claude Sonnet 4.6 --- backend/routers/discovery.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/routers/discovery.py b/backend/routers/discovery.py index ecc562a..46e9e8b 100644 --- a/backend/routers/discovery.py +++ b/backend/routers/discovery.py @@ -71,7 +71,8 @@ def _ping(ip: str) -> bool: # Guard against proxy-ARP / gateway false positives: verify the ICMP # reply actually came from the target IP and not an intermediate node. stdout = r.stdout.decode(errors="ignore") - return f"from {ip}:" in stdout or f"from {ip} " in stdout + # Also handles "from hostname (ip):" format when DNS resolves the target + return f"from {ip}:" in stdout or f"from {ip} " in stdout or f"({ip}):" in stdout except Exception: return False