From 338b1913d84ca0c2e3201774ab99dfa766c2bd4a Mon Sep 17 00:00:00 2001 From: david Date: Thu, 23 Aug 2007 20:23:57 +0000 Subject: [PATCH] Fix some switch-case logic in massping that made all connection-refused responses look like syn-acks when doing TCP connect ping scan. --- targets.cc | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/targets.cc b/targets.cc index b27b539a8..69fc65ae0 100644 --- a/targets.cc +++ b/targets.cc @@ -1181,19 +1181,20 @@ while(pt->block_unaccounted) { int sock_err = socket_errno(); switch(sock_err) { case ECONNREFUSED: - foundsomething = 1; - newstate = HOST_UP; - hostbatch[hostindex]->reason.reason_id = ER_CONREFUSED; - case EAGAIN: -#ifdef WIN32 - case WSAENOTCONN: -#endif - if (sock_err == EAGAIN && o.verbose) { - log_write(LOG_STDOUT, "Machine %s MIGHT actually be listening on probe port %d\n", hostbatch[hostindex]->targetipstr(), o.ping_synprobes[p]); - } foundsomething = 1; - newstate = HOST_UP; - hostbatch[hostindex]->reason.reason_id = ER_CONACCEPT; + newstate = HOST_UP; + hostbatch[hostindex]->reason.reason_id = ER_CONREFUSED; + break; + case EAGAIN: + if (o.verbose) + log_write(LOG_STDOUT, "Machine %s MIGHT actually be listening on probe port %d\n", hostbatch[hostindex]->targetipstr(), o.ping_synprobes[p]); + /* Fall through. */ +#ifdef WIN32 + case WSAENOTCONN: +#endif + foundsomething = 1; + newstate = HOST_UP; + hostbatch[hostindex]->reason.reason_id = ER_CONACCEPT; break; case ENETDOWN: case ENETUNREACH: