aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-09-26 20:49:55 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-09-26 21:32:16 +0200
commit31bb98c995e84f1d2174d9e68e95145bc78a5eba (patch)
treea548cf9ce563772a0e47be5ddebed96a6ff856de
parentfcf21ca4cf2840f03f1294eb79c4489d908b2455 (diff)
downloadponymap-31bb98c995e84f1d2174d9e68e95145bc78a5eba.tar.gz
ponymap-31bb98c995e84f1d2174d9e68e95145bc78a5eba.tar.xz
ponymap-31bb98c995e84f1d2174d9e68e95145bc78a5eba.zip
The targets are not always hostnames
If a target specified on the command line equals its IP address string, don't put the string as a hostname in the results.
-rw-r--r--ponymap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ponymap.c b/ponymap.c
index 54b0e75..e11c559 100644
--- a/ponymap.c
+++ b/ponymap.c
@@ -1505,8 +1505,6 @@ generator_make_target (struct app_context *ctx)
target->ref_count = 1;
target->ctx = ctx;
target->ip = g->ip_iter;
- if (g->ip_iter == g->ip_range_iter->original_address)
- target->hostname = xstrdup (g->ip_range_iter->original_name);
uint32_t address = htonl (target->ip);
if (!inet_ntop (AF_INET, &address,
@@ -1516,6 +1514,10 @@ generator_make_target (struct app_context *ctx)
*target->ip_string = '\0';
}
+ if (g->ip_iter == g->ip_range_iter->original_address
+ && strcmp (target->ip_string, g->ip_range_iter->original_name))
+ target->hostname = xstrdup (g->ip_range_iter->original_name);
+
LIST_APPEND_WITH_TAIL (ctx->running_targets, ctx->running_tail, target);
target_update_indicator (ctx->running_targets);