From 31bb98c995e84f1d2174d9e68e95145bc78a5eba Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Fri, 26 Sep 2014 20:49:55 +0200 Subject: 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. --- ponymap.c | 6 ++++-- 1 file 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); -- cgit v1.2.3-70-g09d2