Print "--" for the RTT of traceroute hops if the RTT is unknown. This

can only happen in the case of a directly connected target with no ping
or port scan responses, like
nmap -PN -sP --send-ip --traceroute <target>
This commit is contained in:
david 2009-09-17 15:11:20 +00:00
parent 06cc9ad4d1
commit 45b783c573

View file

@ -1986,7 +1986,10 @@ static void printtraceroute_normal(Target *currenths) {
/* Normal hop output. */
it->display_name(namebuf, sizeof(namebuf));
Tbl.addItemFormatted(row, RTT_COL, false, "%.2f ms", it->rtt);
if (it->rtt < 0)
Tbl.addItem(row, RTT_COL, false, "--");
else
Tbl.addItemFormatted(row, RTT_COL, false, "%.2f ms", it->rtt);
Tbl.addItemFormatted(row, HOST_COL, false, "%s", namebuf);
row++;
it++;
@ -2029,8 +2032,12 @@ static void printtraceroute_xml(Target *currenths) {
it++) {
if (it->timedout)
continue;
log_write(LOG_XML, "<hop ttl=\"%d\" rtt=\"%.2f\" ipaddr=\"%s\"",
it->ttl, it->rtt, inet_ntop_ez(&it->addr, sizeof(it->addr)));
log_write(LOG_XML, "<hop ttl=\"%d\" ipaddr=\"%s\"",
it->ttl, inet_ntop_ez(&it->addr, sizeof(it->addr)));
if (it->rtt < 0)
log_write(LOG_XML, " rtt=\"--\"");
else
log_write(LOG_XML, " rtt=\"%.2f\"", it->rtt);
if (!it->name.empty())
log_write(LOG_XML, " host=\"%s\"", it->name.c_str());
log_write(LOG_XML, "/>\n");