From bc32baff984882d7e7b6385a0d7609812165e85d Mon Sep 17 00:00:00 2001 From: david Date: Fri, 26 Dec 2008 22:26:17 +0000 Subject: [PATCH] Destroy connect scan probes that aren't otherwise handled (thereby closing the socket). It's possible to get an EHOSTUNREACH or EHOSTDOWN (and possibly other errors) against a nonexistent LAN host and formerly the socket wasn't closed. This allowed Nmap's internal count of sockets to be less that the true count of open sockets. It would eventually try to open too many sockets and quit with the message Socket creation in sendConnectScanProbe: Too many open files (24) Be aware that in this message 24 is the errno, not the number of open files. --- scan_engine.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scan_engine.cc b/scan_engine.cc index 43a51e495..29361e963 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -2798,6 +2798,8 @@ static UltraProbe *sendConnectScanProbe(UltraScanInfo *USI, HostScanStats *hss, hss->destroyAllOutstandingProbes(); } else if (!USI->ping_scan && port_state != PORT_UNKNOWN) { ultrascan_port_probe_update(USI, hss, probeI, port_state, &USI->now); + } else { + hss->destroyOutstandingProbe(probeI); } probe = NULL; }