diff --git a/traceroute.cc b/traceroute.cc index 7230a19a6..ebdf2b208 100644 --- a/traceroute.cc +++ b/traceroute.cc @@ -151,8 +151,8 @@ * Hops 1-10 are the same as for X.X.X.X * * Traceroute does not work with connect scans or idle scans and has trouble - * with ICMP_TIMESTAMP and ICMP_ADDRESSMASK scans because so many host filter - * them out. The quickest seems to be SYN scan. + * with ICMP_TSTAMP and ICMP_MASK scans because so many host filter them out. + * The quickest seems to be SYN scan. * * Bugs * ---- @@ -171,6 +171,7 @@ #include "timing.h" #include "utils.h" #include +#include #include using namespace std; @@ -305,7 +306,7 @@ Traceroute::readTraceResponses() { sport = ntohs(icmp->icmp_id); /* Process ICMP replies that encapsulate our original probe */ - if (icmp->icmp_type == ICMP_DEST_UNREACH || icmp->icmp_type == ICMP_TIME_EXCEEDED) { + if (icmp->icmp_type == ICMP_UNREACH || icmp->icmp_type == ICMP_TIMEXCEED) { if ((unsigned) ip->ip_hl * 4 + 28 > bytes) break; ip2 = (struct ip *) (((char *) ip) + 4 * ip->ip_hl + 8); @@ -349,16 +350,16 @@ Traceroute::readTraceResponses() { break; if ((tg->probe.proto == IPPROTO_UDP && (ip2 && ip2->ip_p == IPPROTO_UDP)) || - (icmp->icmp_type == ICMP_DEST_UNREACH)) { + (icmp->icmp_type == ICMP_UNREACH)) { switch (icmp->icmp_code) { /* reply from a closed port */ - case ICMP_PORT_UNREACH: + case ICMP_UNREACH_PORT: /* replies from a filtered port */ - case ICMP_HOST_UNREACH: - case ICMP_PROT_UNREACH: - case ICMP_NET_ANO: - case ICMP_HOST_ANO: - case ICMP_PKT_FILTERED: + case ICMP_UNREACH_HOST: + case ICMP_UNREACH_PROTO: + case ICMP_UNREACH_NET_PROHIB: + case ICMP_UNREACH_HOST_PROHIB: + case ICMP_UNREACH_FILTER_PROHIB: if (tp->probeType() == PROBE_TTL) { tg->setHopDistance(o.ttl - ip2->ip_ttl, 0); tg->start_ttl = tg->ttl = tg->hopDistance; @@ -371,7 +372,7 @@ Traceroute::readTraceResponses() { } /* icmp ping scan replies */ else if (tg->probe.proto == IPPROTO_ICMP && (icmp->icmp_type == ICMP_ECHOREPLY || - icmp->icmp_type == ICMP_ADDRESSREPLY || icmp->icmp_type == ICMP_TIMESTAMPREPLY)) { + icmp->icmp_type == ICMP_MASKREPLY || icmp->icmp_type == ICMP_TSTAMPREPLY)) { if (tp->probeType() == PROBE_TTL) { tg->setHopDistance(get_initial_ttl_guess(ip->ip_ttl), ip->ip_ttl); tg->start_ttl = tg->ttl = tg->hopDistance; diff --git a/traceroute.h b/traceroute.h index 8bd133940..42bc8215f 100644 --- a/traceroute.h +++ b/traceroute.h @@ -118,49 +118,6 @@ #define NAMEIPLEN MAXHOSTNAMELEN+INET6_ADDRSTRLEN -#ifndef ICMP_ECHOREPLY - #define ICMP_ECHOREPLY 0 -#endif -#ifndef ICMP_DEST_UNREACH - #define ICMP_DEST_UNREACH 3 -#endif -#ifndef ICMP_ECHO - #define ICMP_ECHO 8 -#endif -#ifndef ICMP_TIME_EXCEEDED - #define ICMP_TIME_EXCEEDED 11 -#endif -#ifndef ICMP_TIMESTAMP - #define ICMP_TIMESTAMP 13 -#endif -#ifndef ICMP_TIMESTAMPREPLY - #define ICMP_TIMESTAMPREPLY 14 -#endif -#ifndef ICMP_ADDRESS - #define ICMP_ADDRESS 17 -#endif -#ifndef ICMP_ADDRESSREPLY - #define ICMP_ADDRESSREPLY 18 -#endif -#ifndef ICMP_HOST_UNREACH - #define ICMP_HOST_UNREACH 1 -#endif -#ifndef ICMP_PROT_UNREACH - #define ICMP_PROT_UNREACH 2 -#endif -#ifndef ICMP_PORT_UNREACH - #define ICMP_PORT_UNREACH 3 -#endif -#ifndef ICMP_NET_ANO - #define ICMP_NET_ANO 9 -#endif -#ifndef ICMP_HOST_ANO - #define ICMP_HOST_ANO 10 -#endif -#ifndef ICMP_PKT_FILTERED - #define ICMP_PKT_FILTERED 13 -#endif - class NmapOutputTable; /* Keeps track of each probes timing state */