#endif
if (name != NULL) {
if (ctl->show_ips)
- printw("%s (%s)", name, strlongip(ctl, addr));
+ printw("%s (%s)", name, strlongip(ctl->af, addr));
else
printw("%s", name);
} else {
- printw("%s", strlongip(ctl, addr));
+ printw("%s", strlongip(ctl->af, addr));
}
attroff(A_BOLD);
#endif
if (name != NULL) {
if (ctl->show_ips)
- printw("%s (%s)", name, strlongip(ctl, addrs));
+ printw("%s (%s)", name, strlongip(ctl->af, addrs));
else
printw("%s", name);
} else {
- printw("%s", strlongip(ctl, addrs));
+ printw("%s", strlongip(ctl->af, addrs));
}
for (k = 0; k < mplss->labels && ctl->enablempls; k++) {
printw("\n [MPLS: Lbl %lu TC %u S %u TTL %u]",
printw(fmt_ipinfo(ctl, addr));
#endif
name = dns_lookup(ctl, addr);
- printw("%s", name ? name : strlongip(ctl, addr));
+ printw("%s", name ? name : strlongip(ctl->af, addr));
} else {
attron(A_BOLD);
printw("(%s)", host_error_to_string(err));
static struct dns_results *results;
char *strlongip(
- struct mtr_ctl *ctl,
+ sa_family_t family,
ip_t * ip)
{
#ifdef ENABLE_IPV6
static char addrstr[INET6_ADDRSTRLEN];
- return (char *) inet_ntop(ctl->af, ip, addrstr, sizeof addrstr);
+ return (char *) inet_ntop(family, ip, addrstr, sizeof addrstr);
#else
return inet_ntoa(*ip);
#endif
hostname, sizeof(hostname), NULL, 0, 0);
if (rv == 0) {
snprintf(result, sizeof(result),
- "%s %s\n", strlongip(ctl, &host), hostname);
+ "%s %s\n", strlongip(ctl->af, &host), hostname);
rv = write(fromdns[1], result, strlen(result));
if (rv < 0)
r->name = NULL;
r->next = results;
results = r;
- snprintf(buf, sizeof(buf), "%s\n", strlongip(ctl, ip));
+ snprintf(buf, sizeof(buf), "%s\n", strlongip(ctl->af, ip));
rv = write(todns[1], buf, strlen(buf));
if (rv < 0)
error(0, errno, "couldn't write to resolver process");
if (!ctl->dns || !ctl->use_dns)
return NULL;
t = dns_lookup2(ctl, ip);
- return t ? t : strlongip(ctl, ip);
+ return t ? t : strlongip(ctl->af, ip);
}
/* XXX check if necessary/exported. */
extern struct hostent *dns_forward(
const char *name);
extern char *strlongip(
- struct mtr_ctl *ctl,
+ sa_family_t family,
ip_t * ip);
extern void addr2ip6arpa(
if ((name = dns_lookup(ctl, addr))) {
if (ctl->show_ips) {
snprintf(str, sizeof(str), "%s (%s)", name,
- strlongip(ctl, addr));
+ strlongip(ctl->af, addr));
name = str;
}
} else
- name = strlongip(ctl, addr);
+ name = strlongip(ctl->af, addr);
}
gtk_list_store_set(ReportStore, iter,
ip_t *ip_addr,
struct mplslen *mpls)
{
- printf("h %d %s\n", host, strlongip(ctl, ip_addr));
+ printf("h %d %s\n", host, strlongip(ctl->af, ip_addr));
if (ctl->enablempls) {
int k;
for (k = 0; k < mpls->labels; k++)
struct hostent *host =
ctl->dns ? addr2host((void *) addr, ctl->af) : NULL;
if (!host)
- return snprintf(dst, dst_len, "%s", strlongip(ctl, addr));
+ return snprintf(dst, dst_len, "%s", strlongip(ctl->af, addr));
else if (ctl->dns && ctl->show_ips)
return snprintf(dst, dst_len, "%s (%s)", host->h_name,
- strlongip(ctl, addr));
+ strlongip(ctl->af, addr));
else
return snprintf(dst, dst_len, "%s", host->h_name);
} else
}
if (z == 1) {
- printf(" | `|-- %s\n", strlongip(ctl, addr2));
+ printf(" | `|-- %s\n", strlongip(ctl->af, addr2));
for (k = 0; k < mplss->labels && ctl->enablempls; k++) {
printf
(" | +-- [MPLS: Lbl %lu TC %u S %u TTL %u]\n",
mplss->ttl[k]);
}
} else {
- printf(" | |-- %s\n", strlongip(ctl, addr2));
+ printf(" | |-- %s\n", strlongip(ctl->af, addr2));
for (k = 0; k < mplss->labels && ctl->enablempls; k++) {
printf
(" | +-- [MPLS: Lbl %lu TC %u S %u TTL %u]\n",
if (addrcmp(addr, &ctl->unspec_addr, ctl->af)) {
char str[256], *name;
if (!(name = dns_lookup(ctl, addr)))
- name = strlongip(ctl, addr);
+ name = strlongip(ctl->af, addr);
if (ctl->show_ips) {
snprintf(str, sizeof(str), "%s %s", name,
- strlongip(ctl, addr));
+ strlongip(ctl->af, addr));
name = str;
}
/* May be we should test name's length */