1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-24 00:19:01 +00:00

Force a new host group whenever the next host has the same IP address as

one already present in the current group. This is because ultra_scan
does not cope with multiple targets sharing the same IP address. However
this alone isn't enough to force a new host group, because the loop in
nmap.cc concatenates groups that nexthost splits apart, with its own
duplicate logic for breaking up groups.
This commit is contained in:
david
2010-06-07 23:43:07 +00:00
parent a70b8dd5fd
commit 58e1d664a6

View File

@@ -409,9 +409,12 @@ static void massping(Target *hostbatch[], int num_hosts, struct scan_lists *port
group. This happens when:
1. it uses a different interface, or
2. it uses a different source address, or
3. it is directly connected when the other hosts are not, or vice versa.
3. it is directly connected when the other hosts are not, or vice versa, or
4. it has the same IP address as another target already in the group.
These restrictions only apply for raw scans. */
static bool target_needs_new_hostgroup(const HostGroupState *hs, const Target *target) {
int i;
/* We've just started a new hostgroup, so any target is acceptable. */
if (hs->current_batch_sz == 0)
return false;
@@ -435,6 +438,15 @@ static bool target_needs_new_hostgroup(const HostGroupState *hs, const Target *t
if (hs->hostbatch[0]->directlyConnected() != target->directlyConnected())
return true;
/* Is there already a target with this same IP address? ultra_scan doesn't
cope with that, because it uses IP addresses to look up targets from
replies. What happens is one target gets the replies for all probes
referring to the same IP address. */
for (i = 0; i < hs->current_batch_sz; i++) {
if (hs->hostbatch[0]->v4host().s_addr == target->v4host().s_addr)
return true;
}
return false;
}