1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

traceroute finish() bugfix patch from Eddie

This commit is contained in:
fyodor
2007-03-15 22:44:01 +00:00
parent 528bec100a
commit 799599279c
2 changed files with 5 additions and 7 deletions

View File

@@ -398,9 +398,9 @@ Traceroute::readTraceResponses () {
ip = (struct ip *) readip_pcap (pd, &bytes, 10000, &rcvdtime, &linkhdr); ip = (struct ip *) readip_pcap (pd, &bytes, 10000, &rcvdtime, &linkhdr);
if (ip == NULL) if (ip == NULL)
return finished (ip); return finished ();
if ((unsigned) ip->ip_hl * 4 + 20 > bytes) if ((unsigned) ip->ip_hl * 4 + 20 > bytes)
return finished (ip); return finished ();
switch (ip->ip_p) { switch (ip->ip_p) {
case IPPROTO_ICMP: case IPPROTO_ICMP:
@@ -581,7 +581,7 @@ Traceroute::readTraceResponses () {
default: default:
; ;
} }
return finished (ip); return finished ();
} }
/* Estimate how many hops away a host is by actively probing it. /* Estimate how many hops away a host is by actively probing it.
@@ -768,14 +768,12 @@ Traceroute::sendProbe (TraceProbe * tp) {
/* true if all groups have finished or failed */ /* true if all groups have finished or failed */
bool bool
Traceroute::finished (struct ip *ips) { Traceroute::finished () {
map < u32, TraceGroup * >::iterator it = TraceGroups.begin (); map < u32, TraceGroup * >::iterator it = TraceGroups.begin ();
for (; it != TraceGroups.end (); ++it) { for (; it != TraceGroups.end (); ++it) {
if (it->second->getState () == G_OK || it->second->getRemaining ()) if (it->second->getState () == G_OK || it->second->getRemaining ())
return false; return false;
} }
if(ips)
free(ips);
return true; return true;
} }

View File

@@ -335,6 +335,6 @@ class Traceroute {
* returns finished(), which returns true * returns finished(), which returns true
* when all groups have finished or failed */ * when all groups have finished or failed */
bool readTraceResponses (); bool readTraceResponses ();
bool finished (struct ip *ips); bool finished ();
}; };