From: Aaron Lipinski Date: Sat, 3 Apr 2021 22:14:52 +0000 (+1200) Subject: accept only value used in structure X-Git-Tag: v0.95~7^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd60554d3b71954af66641b47a9a24a1105f6a04;p=thirdparty%2Fmtr.git accept only value used in structure --- diff --git a/ui/curses.c b/ui/curses.c index ca5e8fe..207b272 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -436,11 +436,11 @@ static void mtr_curses_hosts( #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); @@ -489,11 +489,11 @@ static void mtr_curses_hosts( #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]", @@ -653,7 +653,7 @@ static void mtr_curses_graph( 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)); diff --git a/ui/dns.c b/ui/dns.c index 642590e..a38113b 100644 --- a/ui/dns.c +++ b/ui/dns.c @@ -52,13 +52,13 @@ struct dns_results { 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 @@ -182,7 +182,7 @@ void dns_open( 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) @@ -270,7 +270,7 @@ char *dns_lookup2( 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"); @@ -288,7 +288,7 @@ char *dns_lookup( 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. */ diff --git a/ui/dns.h b/ui/dns.h index c04d184..6668335 100644 --- a/ui/dns.h +++ b/ui/dns.h @@ -44,7 +44,7 @@ extern char *dns_lookup2( 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( diff --git a/ui/gtk.c b/ui/gtk.c index 0fd8339..e23abf2 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -512,11 +512,11 @@ static void update_tree_row( 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, diff --git a/ui/raw.c b/ui/raw.c index 0735131..85e87e8 100644 --- a/ui/raw.c +++ b/ui/raw.c @@ -70,7 +70,7 @@ void raw_rawhost( 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++) diff --git a/ui/report.c b/ui/report.c index b39f186..c540717 100644 --- a/ui/report.c +++ b/ui/report.c @@ -65,10 +65,10 @@ static size_t snprint_addr( 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 @@ -235,7 +235,7 @@ void report_close( } 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", @@ -243,7 +243,7 @@ void report_close( 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", diff --git a/ui/split.c b/ui/split.c index d300404..1755452 100644 --- a/ui/split.c +++ b/ui/split.c @@ -95,10 +95,10 @@ void split_redraw( 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 */