log_write(LOG_STDOUT, "Wait time is %dms\n", (ossofttimeout +500)/1000);
flt_srchost = target->host.s_addr;
flt_dsthost = target->source_ip.s_addr;
p = strdup(inet_ntoa(target->host));
snprintf(filter, sizeof(filter), "(icmp and dst host %s) or (tcp and src host %s and dst host %s)", inet_ntoa(target->source_ip), p, inet_ntoa(target->source_ip));
free(p);
set_pcap_filter(target, pd, flt_icmptcp, filter);
target->osscan_performed = 1; /* Let Nmap know that we did try an OS scan */
/* Lets find an open port to used */
openport = (unsigned long) -1;
target->osscan_openport = -1;
target->osscan_closedport = -1;
tport = NULL;
if (target->ports.state_counts_tcp[PORT_OPEN] > 0) {
usleep( MAX(110000, target->to.srtt)); /* Main reason we wait so long is that we need to spend more than .5 seconds to detect 2HZ timestamp sequencing -- this also should make ISN sequencing more regular */
log_write(LOG_STDOUT|LOG_NORMAL|LOG_SKID, "Skipping OS Scan due to absence of open (or perhaps closed) ports\n", target->host);
return 1;
} else {
log_write(LOG_STDOUT|LOG_NORMAL|LOG_SKID,"Warning: OS detection will be MUCH less reliable because we did not find at least 1 open and 1 closed TCP port\n");
}
}
for(itry=0; itry < 3; itry++) {
if (o.host_timeout) {
gettimeofday(&now, NULL);
if (target->timedout || TIMEVAL_MSEC_SUBTRACT(now, target->host_timeout) >= 0)