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

Traceroute bugfix for when the first hop of the first host in a tracegroup (reference trace) times out. The previous patch did not completely solve the issue due to an erronous check on the ttl, now we use a dedicated boolean flag. Thanks to Sebastián García for the bug report and testing.

This commit is contained in:
ejlbell
2008-01-07 14:39:40 +00:00
parent 8e9ca576d2
commit 188442662d
2 changed files with 7 additions and 4 deletions

View File

@@ -202,6 +202,7 @@ Traceroute::Traceroute (const char *device_name, devtype type) {
pd = NULL; pd = NULL;
total_size = 0; total_size = 0;
memset(&ref_ipaddr, '\0', sizeof(struct in_addr)); memset(&ref_ipaddr, '\0', sizeof(struct in_addr));
cp_flag = 0;
if(type == devt_loopback) if(type == devt_loopback)
return; return;
@@ -500,12 +501,15 @@ Traceroute::readTraceResponses () {
tp->ttl > 1 && tg->gotReply && tg->getState () != G_FINISH) { tp->ttl > 1 && tg->gotReply && tg->getState () != G_FINISH) {
tg->setState (G_FINISH); tg->setState (G_FINISH);
tg->consolidation_start = tp->ttl+1; tg->consolidation_start = tp->ttl+1;
cp_flag = 1;
break; break;
} else if (commonPath[tp->ttl] == 0) { } else if (commonPath[tp->ttl] == 0) {
commonPath[tp->ttl] = tp->ipreplysrc.s_addr; commonPath[tp->ttl] = tp->ipreplysrc.s_addr;
/* remember which host is the reference trace */ /* remember which host is the reference trace */
if(tp->ttl == 1) if(!cp_flag) {
ref_ipaddr.s_addr = tg->ipdst; ref_ipaddr.s_addr = tg->ipdst;
cp_flag = 1;
}
} }
break; break;
case IPPROTO_TCP: case IPPROTO_TCP:

View File

@@ -344,12 +344,11 @@ class Traceroute {
* the groups destination IP address */ * the groups destination IP address */
std::map < u32, TraceGroup * >TraceGroups; std::map < u32, TraceGroup * >TraceGroups;
struct scan_info scaninfo; struct scan_info scaninfo;
Target **hops; Target **hops;
pcap_t *pd; pcap_t *pd;
eth_t *ethsd; eth_t *ethsd;
int fd, total_size; int fd, total_size, cp_flag;
struct in_addr ref_ipaddr; struct in_addr ref_ipaddr;
/* called by outputTarget to log XML data */ /* called by outputTarget to log XML data */