Count an ACK right after counting a drop for a retransmitted reply.

We count a drop for congestion control purposes if we receive a response
to a retransmitted probe, because that means that the reply to the
original probe was dropped. However, we weren't taking into account that
we are at the same time receiving a positive response, and should
increase the window accordingly. There are now three things that can
happen:

Response to first probe:	ACK
Response to retransmission:	DROP, then ACK
Probe timeout:			DROP
This commit is contained in:
david 2011-12-31 21:59:58 +00:00
parent 8ba1cf6b15
commit 637ba35a28
2 changed files with 20 additions and 12 deletions

View file

@ -1226,15 +1226,20 @@ void HostOsScan::adjust_times(HostOsScanStats *hss, OFProbe *probe, struct timev
hss->timing.num_replies_expected++;
hss->timing.num_updates++;
/* Adjust window */
if (probe->tryno > 0 || !rcvdtime) {
/* Notice a drop if
1. We get a response to a retransmitted probe (meaning the first reply was
dropped), or
2. We get no response after a timeout (rcvdtime == NULL). */
if (probe->tryno > 0 || rcvdtime == NULL) {
if (TIMEVAL_AFTER(probe->sent, hss->timing.last_drop))
hss->timing.drop(hss->numProbesActive(), &perf, &now);
if (TIMEVAL_AFTER(probe->sent, stats->timing.last_drop))
stats->timing.drop_group(stats->num_probes_active, &perf, &now);
} else {
/* Good news -- got a response to first try. Increase window as
appropriate. */
}
/* Increase the window for a positive reply. This can overlap with case (1)
above. */
if (rcvdtime != NULL) {
stats->timing.ack(&perf);
hss->timing.ack(&perf);
}

View file

@ -2183,11 +2183,12 @@ static void ultrascan_adjust_timing(UltraScanInfo *USI, HostScanStats *hss,
hss->timing.num_replies_expected++;
hss->timing.num_updates++;
/* Notice a drop if
1) We get a response to a retransmitted probe (meaning the first reply was
dropped), or
2) We got no response to a timing ping. */
if ((probe->tryno > 0 && rcvdtime != NULL)
|| (probe->isPing() && rcvdtime == NULL)) {
/* We consider it a drop if
1. We get a positive response to a retransmitted probe, or
2. We get no response to a timing ping probe. */
if (o.debugging > 1)
log_write(LOG_PLAIN, "Ultrascan DROPPED %sprobe packet to %s detected\n", probe->isPing()? "PING " : "", hss->target->targetipstr());
// Drops often come in big batches, but we only want one decrease per batch.
@ -2195,13 +2196,15 @@ static void ultrascan_adjust_timing(UltraScanInfo *USI, HostScanStats *hss,
hss->timing.drop(hss->num_probes_active, &USI->perf, &USI->now);
if (TIMEVAL_AFTER(probe->sent, USI->gstats->timing.last_drop))
USI->gstats->timing.drop_group(USI->gstats->num_probes_active, &USI->perf, &USI->now);
} else if (rcvdtime != NULL) {
/* Good news -- got a response to first try. Increase window as
appropriate. */
}
/* If !probe->isPing() and rcvdtime == NULL, do nothing. */
/* Increase the window for a positive reply. This can overlap with case (1)
above. */
if (rcvdtime != NULL) {
USI->gstats->timing.ack(&USI->perf, ping_magnifier);
hss->timing.ack(&USI->perf, ping_magnifier);
}
/* If !probe->isPing() and rcvdtime == NULL, do nothing. */
/* If packet drops are particularly bad, enforce a delay between
packet sends (useful for cases such as UDP scan where responses