diff --git a/mtr-0.94-gtk.patch b/mtr-0.94-gtk.patch deleted file mode 100644 index c32a304..0000000 --- a/mtr-0.94-gtk.patch +++ /dev/null @@ -1,1504 +0,0 @@ -Upstream mtr patches (not yet in any release) to fix various xmtr issues: - - - https://github.com/traviscross/mtr/commit/4c3b0b188670a873795f720eaaf68edfc29b461a - - https://github.com/traviscross/mtr/commit/943b2ff88975499e0813fa7a54f244968b8672df - - https://github.com/traviscross/mtr/commit/21bf582e2c95b7b7c7844cfe26dd417322c5d518 - - https://github.com/traviscross/mtr/commit/a7342019a57bf3fbf476e98f314e7ed321bbd720 - -See also: https://bugzilla.redhat.com/show_bug.cgi?id=1488417 - - -From 4c3b0b188670a873795f720eaaf68edfc29b461a Mon Sep 17 00:00:00 2001 -From: Zenithal -Date: Sat, 17 Oct 2020 23:03:51 +0800 -Subject: [PATCH] Add display of destination with resolved addr under curses - mode - ---- - ui/curses.c | 2 +- - ui/net.c | 11 +++++++++++ - ui/net.h | 2 ++ - 3 files changed, 14 insertions(+), 1 deletion(-) - -diff --git a/ui/curses.c b/ui/curses.c -index 34bf30d..a7ee718 100644 ---- a/ui/curses.c -+++ b/ui/curses.c -@@ -698,7 +698,7 @@ void mtr_curses_redraw( - pwcenter(buf); - attroff(A_BOLD); - -- mvprintw(1, 0, "%s (%s) -> %s", ctl->LocalHostname, net_localaddr(), ctl->Hostname); -+ mvprintw(1, 0, "%s (%s) -> %s (%s)", ctl->LocalHostname, net_localaddr(), ctl->Hostname, net_remoteaddr()); - t = time(NULL); - mvprintw(1, maxx - 25, iso_time(&t)); - printw("\n"); -diff --git a/ui/net.c b/ui/net.c -index f684b3e..e4752b7 100644 ---- a/ui/net.c -+++ b/ui/net.c -@@ -97,11 +97,13 @@ static ip_t *remoteaddress; - - #ifdef ENABLE_IPV6 - static char localaddr[INET6_ADDRSTRLEN]; -+static char remoteaddr[INET6_ADDRSTRLEN]; - #else - #ifndef INET_ADDRSTRLEN - #define INET_ADDRSTRLEN 16 - #endif - static char localaddr[INET_ADDRSTRLEN]; -+static char remoteaddr[INET_ADDRSTRLEN]; - #endif - - static int batch_at = 0; -@@ -523,6 +525,13 @@ char *net_localaddr( - } - - -+char *net_remoteaddr( -+ void) -+{ -+ return remoteaddr; -+} -+ -+ - void net_end_transit( - void) - { -@@ -756,6 +765,8 @@ int net_open( - net_find_local_address(); - } - -+ inet_ntop(remotesockaddr->sa_family, sockaddr_addr_offset(remotesockaddr), remoteaddr, sizeof(remoteaddr)); -+ - return 0; - } - -diff --git a/ui/net.h b/ui/net.h -index 8a0d775..d5262bd 100644 ---- a/ui/net.h -+++ b/ui/net.h -@@ -90,6 +90,8 @@ extern ip_t *net_addrs( - int i); - extern char *net_localaddr( - void); -+extern char *net_remoteaddr( -+ void); - - extern int net_send_batch( - struct mtr_ctl *ctl); -From 3d176ea1f0f45e0c715dd1d7ef545edb9b6abc19 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sat, 3 Apr 2021 15:00:45 +1300 -Subject: [PATCH 1/5] move net_send_batch call to its caller - ---- - ui/gtk.c | 1 + - ui/net.c | 1 - - 2 files changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ui/gtk.c b/ui/gtk.c -index dd79efc..0fd8339 100644 ---- a/ui/gtk.c -+++ b/ui/gtk.c -@@ -249,6 +249,7 @@ static gint Host_activate( - addr = dns_forward(gtk_entry_get_text(GTK_ENTRY(entry))); - if (addr) { - net_reopen(ctl, addr); -+ net_send_batch(ctl); - /* If we are "Paused" at this point it is usually because someone - entered a non-existing host. Therefore do the go-ahead... */ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Pause_Button), 0); -diff --git a/ui/net.c b/ui/net.c -index e4752b7..3160195 100644 ---- a/ui/net.c -+++ b/ui/net.c -@@ -785,7 +785,6 @@ void net_reopen( - memcpy(remoteaddress, addr->h_addr, sockaddr_addr_size(remotesockaddr)); - memcpy(sockaddr_addr_offset(remotesockaddr), addr->h_addr, sockaddr_addr_size(remotesockaddr)); - net_reset(ctl); -- net_send_batch(ctl); - } - - - -From 69933c309082d2ef25815613c59a7a744a914b16 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sat, 3 Apr 2021 15:05:01 +1300 -Subject: [PATCH 2/5] addr -> hostent for consistency - ---- - ui/net.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/ui/net.c b/ui/net.c -index 3160195..f7aa088 100644 ---- a/ui/net.c -+++ b/ui/net.c -@@ -773,7 +773,7 @@ int net_open( - - void net_reopen( - struct mtr_ctl *ctl, -- struct hostent *addr) -+ struct hostent *hostent) - { - int at; - -@@ -781,9 +781,9 @@ void net_reopen( - memset(&host[at], 0, sizeof(host[at])); - } - -- remotesockaddr->sa_family = addr->h_addrtype; -- memcpy(remoteaddress, addr->h_addr, sockaddr_addr_size(remotesockaddr)); -- memcpy(sockaddr_addr_offset(remotesockaddr), addr->h_addr, sockaddr_addr_size(remotesockaddr)); -+ remotesockaddr->sa_family = hostent->h_addrtype; -+ memcpy(remoteaddress, hostent->h_addr, sockaddr_addr_size(remotesockaddr)); -+ memcpy(sockaddr_addr_offset(remotesockaddr), hostent->h_addr, sockaddr_addr_size(remotesockaddr)); - net_reset(ctl); - } - - -From 6c3b1bd36624609f83c6ce3563c3bcfb98d824ae Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sat, 3 Apr 2021 15:07:17 +1300 -Subject: [PATCH 3/5] re-init source too - ---- - ui/net.c | 35 ++++++++++++++++------------------- - 1 file changed, 16 insertions(+), 19 deletions(-) - -diff --git a/ui/net.c b/ui/net.c -index f7aa088..866879b 100644 ---- a/ui/net.c -+++ b/ui/net.c -@@ -747,6 +747,22 @@ int net_open( - return err; - } - -+ net_reopen(ctl, hostent); -+ -+ return 0; -+} -+ -+ -+void net_reopen( -+ struct mtr_ctl *ctl, -+ struct hostent *hostent) -+{ -+ int at; -+ -+ for (at = 0; at < MaxHost; at++) { -+ memset(&host[at], 0, sizeof(host[at])); -+ } -+ - net_reset(ctl); - - remotesockaddr->sa_family = sourcesockaddr->sa_family = hostent->h_addrtype; -@@ -766,25 +782,6 @@ int net_open( - } - - inet_ntop(remotesockaddr->sa_family, sockaddr_addr_offset(remotesockaddr), remoteaddr, sizeof(remoteaddr)); -- -- return 0; --} -- -- --void net_reopen( -- struct mtr_ctl *ctl, -- struct hostent *hostent) --{ -- int at; -- -- for (at = 0; at < MaxHost; at++) { -- memset(&host[at], 0, sizeof(host[at])); -- } -- -- remotesockaddr->sa_family = hostent->h_addrtype; -- memcpy(remoteaddress, hostent->h_addr, sockaddr_addr_size(remotesockaddr)); -- memcpy(sockaddr_addr_offset(remotesockaddr), hostent->h_addr, sockaddr_addr_size(remotesockaddr)); -- net_reset(ctl); - } - - - -From 54d91ea2f04966e1d4cdf6a080c6b80857ee7bd6 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sat, 3 Apr 2021 15:25:09 +1300 -Subject: [PATCH 4/5] additional call from net_reopen - ---- - ui/net.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/ui/net.c b/ui/net.c -index 866879b..e47cbcf 100644 ---- a/ui/net.c -+++ b/ui/net.c -@@ -770,6 +770,7 @@ void net_reopen( - - sourceaddress = sockaddr_addr_offset(sourcesockaddr); - remoteaddress = sockaddr_addr_offset(remotesockaddr); -+ memcpy(remoteaddress, hostent->h_addr, sockaddr_addr_size(remotesockaddr)); - - if (ctl->InterfaceAddress) { - net_validate_interface_address(ctl->af, ctl->InterfaceAddress); - -From e486335d7552c2a87b4a14bdf04394a590be3441 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sat, 3 Apr 2021 15:34:31 +1300 -Subject: [PATCH 5/5] refactor - group local, remote inits - ---- - ui/net.c | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/ui/net.c b/ui/net.c -index e47cbcf..a44a81e 100644 ---- a/ui/net.c -+++ b/ui/net.c -@@ -766,23 +766,22 @@ void net_reopen( - net_reset(ctl); - - remotesockaddr->sa_family = sourcesockaddr->sa_family = hostent->h_addrtype; -- memcpy(sockaddr_addr_offset(remotesockaddr), hostent->h_addr, sockaddr_addr_size(remotesockaddr)); -- -- sourceaddress = sockaddr_addr_offset(sourcesockaddr); - remoteaddress = sockaddr_addr_offset(remotesockaddr); - memcpy(remoteaddress, hostent->h_addr, sockaddr_addr_size(remotesockaddr)); -+ inet_ntop(remotesockaddr->sa_family, remoteaddress, remoteaddr, sizeof(remoteaddr)); -+ -+ sourceaddress = sockaddr_addr_offset(sourcesockaddr); - - if (ctl->InterfaceAddress) { - net_validate_interface_address(ctl->af, ctl->InterfaceAddress); - } else if (ctl->InterfaceName) { - net_find_interface_address_from_name( - &sourcesockaddr_struct, ctl->af, ctl->InterfaceName); -- inet_ntop(sourcesockaddr->sa_family, sockaddr_addr_offset(sourcesockaddr), localaddr, sizeof(localaddr)); -+ inet_ntop(sourcesockaddr->sa_family, sourceaddress, localaddr, sizeof(localaddr)); - } else { - net_find_local_address(); - } - -- inet_ntop(remotesockaddr->sa_family, sockaddr_addr_offset(remotesockaddr), remoteaddr, sizeof(remoteaddr)); - } - - -From a0b00e233f2d613b6e8dc453fe192d51c4cd548b Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sun, 4 Apr 2021 08:02:38 +1200 -Subject: [PATCH 1/4] reset ctl address family at net_reopen - ---- - ui/net.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ui/net.c b/ui/net.c -index 6b06d29..60d33e0 100644 ---- a/ui/net.c -+++ b/ui/net.c -@@ -764,7 +764,7 @@ void net_reopen( - - net_reset(ctl); - -- remotesockaddr->sa_family = sourcesockaddr->sa_family = hostent->h_addrtype; -+ ctl->af = remotesockaddr->sa_family = sourcesockaddr->sa_family = hostent->h_addrtype; - remoteaddress = sockaddr_addr_offset(remotesockaddr); - memcpy(remoteaddress, hostent->h_addr, sockaddr_addr_size(remotesockaddr)); - inet_ntop(remotesockaddr->sa_family, remoteaddress, remoteaddr, sizeof(remoteaddr)); - -From a0a91e4962716bf86d6edae157e3449627a270f7 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sun, 4 Apr 2021 10:08:00 +1200 -Subject: [PATCH 2/4] accept only value used in structure - ---- - ui/dns.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/ui/dns.c b/ui/dns.c -index 7dc8885..642590e 100644 ---- a/ui/dns.c -+++ b/ui/dns.c -@@ -114,12 +114,12 @@ static struct dns_results *findip( - } - - static void set_sockaddr_ip( -- struct mtr_ctl *ctl, -+ sa_family_t family, - struct sockaddr_storage *sa, - ip_t * ip) - { - memset(sa, 0, sizeof(struct sockaddr_storage)); -- sa->ss_family = ctl->af; -+ sa->ss_family = family; - memcpy(sockaddr_addr_offset(sa), ip, sockaddr_addr_size(sa)); - } - -@@ -174,7 +174,7 @@ void dns_open( - buf[strlen(buf) - 1] = 0; /* chomp newline. */ - - longipstr(buf, &host, ctl->af); -- set_sockaddr_ip(ctl, &sa, &host); -+ set_sockaddr_ip(ctl->af, &sa, &host); - salen = (ctl->af == AF_INET) ? sizeof(struct sockaddr_in) : - sizeof(struct sockaddr_in6); - - -From fd60554d3b71954af66641b47a9a24a1105f6a04 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sun, 4 Apr 2021 10:14:52 +1200 -Subject: [PATCH 3/4] accept only value used in structure - ---- - ui/curses.c | 10 +++++----- - ui/dns.c | 10 +++++----- - ui/dns.h | 2 +- - ui/gtk.c | 4 ++-- - ui/raw.c | 2 +- - ui/report.c | 8 ++++---- - ui/split.c | 4 ++-- - 7 files changed, 20 insertions(+), 20 deletions(-) - -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 */ - -From 02ded71c1cad62b5717a2f998f0f3288f8f48622 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sun, 4 Apr 2021 10:19:29 +1200 -Subject: [PATCH 4/4] accept only value used in structure - ---- - ui/dns.c | 10 +++++----- - ui/dns.h | 2 +- - ui/mtr.c | 2 +- - 3 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/ui/dns.c b/ui/dns.c -index a38113b..94af8b7 100644 ---- a/ui/dns.c -+++ b/ui/dns.c -@@ -124,7 +124,7 @@ static void set_sockaddr_ip( - } - - void dns_open( -- struct mtr_ctl *ctl) -+ sa_family_t family) - { - int pid; - -@@ -173,16 +173,16 @@ void dns_open( - - buf[strlen(buf) - 1] = 0; /* chomp newline. */ - -- longipstr(buf, &host, ctl->af); -- set_sockaddr_ip(ctl->af, &sa, &host); -- salen = (ctl->af == AF_INET) ? sizeof(struct sockaddr_in) : -+ longipstr(buf, &host, family); -+ set_sockaddr_ip(family, &sa, &host); -+ salen = (family == AF_INET) ? sizeof(struct sockaddr_in) : - sizeof(struct sockaddr_in6); - - rv = getnameinfo((struct sockaddr *) &sa, salen, - hostname, sizeof(hostname), NULL, 0, 0); - if (rv == 0) { - snprintf(result, sizeof(result), -- "%s %s\n", strlongip(ctl->af, &host), hostname); -+ "%s %s\n", strlongip(family, &host), hostname); - - rv = write(fromdns[1], result, strlen(result)); - if (rv < 0) -diff --git a/ui/dns.h b/ui/dns.h -index 6668335..b15d6ad 100644 ---- a/ui/dns.h -+++ b/ui/dns.h -@@ -23,7 +23,7 @@ - /* Prototypes for dns.c */ - - extern void dns_open( -- struct mtr_ctl *ctl); -+ sa_family_t family); - extern int dns_waitfd( - void); - extern void dns_ack( -diff --git a/ui/mtr.c b/ui/mtr.c -index b33a136..b959919 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -858,7 +858,7 @@ int main( - } - - lock(stdout); -- dns_open(&ctl); -+ dns_open(ctl.af); - display_open(&ctl); - - display_loop(&ctl); -From a7a8985a914509351cb590ccae8cf3574f42f628 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sun, 4 Apr 2021 12:16:26 +1200 -Subject: [PATCH 01/17] tell dns process if we want 4 or 6 - ---- - ui/dns.c | 10 ++++++---- - ui/dns.h | 2 +- - ui/mtr.c | 2 +- - 3 files changed, 8 insertions(+), 6 deletions(-) - -diff --git a/ui/dns.c b/ui/dns.c -index 94af8b7..902aa67 100644 ---- a/ui/dns.c -+++ b/ui/dns.c -@@ -124,7 +124,7 @@ static void set_sockaddr_ip( - } - - void dns_open( -- sa_family_t family) -+ void) - { - int pid; - -@@ -173,7 +173,8 @@ void dns_open( - - buf[strlen(buf) - 1] = 0; /* chomp newline. */ - -- longipstr(buf, &host, family); -+ sa_family_t family = (buf[0] == '4') ? AF_INET : AF_INET6; -+ longipstr(buf +1, &host, family); - set_sockaddr_ip(family, &sa, &host); - salen = (family == AF_INET) ? sizeof(struct sockaddr_in) : - sizeof(struct sockaddr_in6); -@@ -256,7 +257,7 @@ char *dns_lookup2( - ip_t * ip) - { - struct dns_results *r; -- char buf[INET6_ADDRSTRLEN + 1]; -+ char buf[INET6_ADDRSTRLEN + 2]; // af_byte + addr + null - int rv; - - r = findip(ctl, ip); -@@ -270,7 +271,8 @@ char *dns_lookup2( - r->name = NULL; - r->next = results; - results = r; -- snprintf(buf, sizeof(buf), "%s\n", strlongip(ctl->af, ip)); -+ char ip4or6 = (ctl->af == AF_INET) ? '4' : '6'; -+ snprintf(buf, sizeof(buf), "%c%s\n", ip4or6, strlongip(ctl->af, ip)); - rv = write(todns[1], buf, strlen(buf)); - if (rv < 0) - error(0, errno, "couldn't write to resolver process"); -diff --git a/ui/dns.h b/ui/dns.h -index b15d6ad..921110e 100644 ---- a/ui/dns.h -+++ b/ui/dns.h -@@ -23,7 +23,7 @@ - /* Prototypes for dns.c */ - - extern void dns_open( -- sa_family_t family); -+ void); - extern int dns_waitfd( - void); - extern void dns_ack( -diff --git a/ui/mtr.c b/ui/mtr.c -index b959919..91773f4 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -858,7 +858,7 @@ int main( - } - - lock(stdout); -- dns_open(ctl.af); -+ dns_open(); - display_open(&ctl); - - display_loop(&ctl); - -From d9116f22d273de98a8f15758eaaa6e8fa1df4fab Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Sun, 4 Apr 2021 13:02:54 +1200 -Subject: [PATCH 02/17] resolve ipv6 only if we have ipv6 - ---- - test/probe.py | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/test/probe.py b/test/probe.py -index b1f0fff..88739cb 100755 ---- a/test/probe.py -+++ b/test/probe.py -@@ -268,9 +268,10 @@ class TestProbeICMPv6(mtrpacket.MtrPacketTest): - '''Test sending probes using IP version 6''' - - def __init__(self, *args): -- google_addr = resolve_ipv6_address(mtrpacket.IPV6_TEST_HOST) -+ if mtrpacket.HAVE_IPV6: -+ google_addr = resolve_ipv6_address(mtrpacket.IPV6_TEST_HOST) - -- self.google_addr = google_addr # type: str -+ self.google_addr = google_addr # type: str - - super(TestProbeICMPv6, self).__init__(*args) - - -From 571004f8544ee638a2667c4f39bc9022a503915d Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 12:25:12 +1200 -Subject: [PATCH 03/17] remove wrapper only function - ---- - ui/dns.c | 12 ------------ - ui/dns.h | 2 -- - ui/gtk.c | 2 +- - 3 files changed, 1 insertion(+), 15 deletions(-) - -diff --git a/ui/dns.c b/ui/dns.c -index 902aa67..8f47316 100644 ---- a/ui/dns.c -+++ b/ui/dns.c -@@ -87,18 +87,6 @@ static int longipstr( - } - - --struct hostent *dns_forward( -- const char *name) --{ -- struct hostent *host; -- -- if ((host = gethostbyname(name))) -- return host; -- else -- return NULL; --} -- -- - static struct dns_results *findip( - struct mtr_ctl *ctl, - ip_t * ip) -diff --git a/ui/dns.h b/ui/dns.h -index 921110e..918bc51 100644 ---- a/ui/dns.h -+++ b/ui/dns.h -@@ -41,8 +41,6 @@ extern char *dns_lookup( - extern char *dns_lookup2( - struct mtr_ctl *ctl, - ip_t * address); --extern struct hostent *dns_forward( -- const char *name); - extern char *strlongip( - sa_family_t family, - ip_t * ip); -diff --git a/ui/gtk.c b/ui/gtk.c -index e23abf2..a98154a 100644 ---- a/ui/gtk.c -+++ b/ui/gtk.c -@@ -246,7 +246,7 @@ static gint Host_activate( - struct mtr_ctl *ctl = (struct mtr_ctl *) data; - struct hostent *addr; - -- addr = dns_forward(gtk_entry_get_text(GTK_ENTRY(entry))); -+ addr = gethostbyname(gtk_entry_get_text(GTK_ENTRY(entry))); - if (addr) { - net_reopen(ctl, addr); - net_send_batch(ctl); - -From 78301a8026500b584b22d27151edc746ccd7b673 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 13:23:14 +1200 -Subject: [PATCH 04/17] init structures correctly wired up - ---- - ui/mtr.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/ui/mtr.c b/ui/mtr.c -index 91773f4..ef567f6 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -766,9 +766,9 @@ int main( - int argc, - char **argv) - { -- struct hostent *host = NULL; -- struct hostent trhost; - char *alptr[2]; -+ struct hostent trhost; -+ struct hostent *host = &trhost; - names_t *names_head = NULL; - names_t *names_walk; - -@@ -837,7 +837,6 @@ int main( - sizeof(ctl.LocalHostname)); - } - -- host = &trhost; - if (get_hostent_from_name(&ctl, host, ctl.Hostname, alptr) != 0) { - if (ctl.Interactive) - exit(EXIT_FAILURE); - -From 14ec0550ab9e1e86025b5913e415f239b7d44260 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 13:25:10 +1200 -Subject: [PATCH 05/17] prepare host with h_addr_list - ---- - ui/mtr.c | 15 ++++++--------- - 1 file changed, 6 insertions(+), 9 deletions(-) - -diff --git a/ui/mtr.c b/ui/mtr.c -index ef567f6..a8ccc0a 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -706,8 +706,7 @@ static void init_rand( - static int get_hostent_from_name( - struct mtr_ctl *ctl, - struct hostent *host, -- const char *name, -- char **alptr) -+ const char *name) - { - int gai_error; - struct addrinfo hints, *res; -@@ -732,22 +731,20 @@ static int get_hostent_from_name( - } - - /* Convert the first addrinfo into a hostent. */ -- memset(host, 0, sizeof(struct hostent)); - host->h_name = res->ai_canonname; - host->h_aliases = NULL; - host->h_addrtype = res->ai_family; - ctl->af = res->ai_family; - host->h_length = res->ai_addrlen; -- host->h_addr_list = alptr; - switch (ctl->af) { - case AF_INET: - sa4 = (struct sockaddr_in *) res->ai_addr; -- alptr[0] = (void *) &(sa4->sin_addr); -+ host->h_addr_list[0] = (void *) &(sa4->sin_addr); - break; - #ifdef ENABLE_IPV6 - case AF_INET6: - sa6 = (struct sockaddr_in6 *) res->ai_addr; -- alptr[0] = (void *) &(sa6->sin6_addr); -+ host->h_addr_list[0] = (void *) &(sa6->sin6_addr); - break; - #endif - default: -@@ -756,7 +753,7 @@ static int get_hostent_from_name( - errno = EINVAL; - return -1; - } -- alptr[1] = NULL; -+ host->h_addr_list[1] = NULL; - - return 0; - } -@@ -767,7 +764,7 @@ int main( - char **argv) - { - char *alptr[2]; -- struct hostent trhost; -+ struct hostent trhost = { .h_addr_list = alptr }; - struct hostent *host = &trhost; - names_t *names_head = NULL; - names_t *names_walk; -@@ -837,7 +834,7 @@ int main( - sizeof(ctl.LocalHostname)); - } - -- if (get_hostent_from_name(&ctl, host, ctl.Hostname, alptr) != 0) { -+ if (get_hostent_from_name(&ctl, host, ctl.Hostname) != 0) { - if (ctl.Interactive) - exit(EXIT_FAILURE); - else { - -From 92569b381b4f974bd3fdda0524b2b0bd2ce322e6 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 13:49:08 +1200 -Subject: [PATCH 06/17] remove temporaries - ---- - ui/mtr.c | 10 ++-------- - 1 file changed, 2 insertions(+), 8 deletions(-) - -diff --git a/ui/mtr.c b/ui/mtr.c -index a8ccc0a..554264a 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -710,10 +710,6 @@ static int get_hostent_from_name( - { - int gai_error; - struct addrinfo hints, *res; -- struct sockaddr_in *sa4; --#ifdef ENABLE_IPV6 -- struct sockaddr_in6 *sa6; --#endif - - /* gethostbyname2() is deprecated so we'll use getaddrinfo() instead. */ - memset(&hints, 0, sizeof hints); -@@ -738,13 +734,11 @@ static int get_hostent_from_name( - host->h_length = res->ai_addrlen; - switch (ctl->af) { - case AF_INET: -- sa4 = (struct sockaddr_in *) res->ai_addr; -- host->h_addr_list[0] = (void *) &(sa4->sin_addr); -+ host->h_addr_list[0] = (char*)&((struct sockaddr_in *)res->ai_addr)->sin_addr; - break; - #ifdef ENABLE_IPV6 - case AF_INET6: -- sa6 = (struct sockaddr_in6 *) res->ai_addr; -- host->h_addr_list[0] = (void *) &(sa6->sin6_addr); -+ host->h_addr_list[0] = (char*)&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr; - break; - #endif - default: - -From b1f0f03a3a545695809183925fb259b44f2f2396 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 15:09:29 +1200 -Subject: [PATCH 07/17] extract convert_addrinfo_to_hostent function - ---- - ui/mtr.c | 49 ++++++++++++++++++++++++++----------------------- - 1 file changed, 26 insertions(+), 23 deletions(-) - -diff --git a/ui/mtr.c b/ui/mtr.c -index 554264a..de32215 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -696,6 +696,30 @@ static void init_rand( - srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); - } - -+static int convert_addrinfo_to_hostent(struct hostent *host, struct addrinfo *res) -+{ -+ host->h_name = res->ai_canonname; -+ host->h_aliases = NULL; -+ host->h_addrtype = res->ai_family; -+ host->h_length = res->ai_addrlen; -+ switch (res->ai_family) { -+ case AF_INET: -+ host->h_addr_list[0] = (char*)&((struct sockaddr_in *)res->ai_addr)->sin_addr; -+ break; -+#ifdef ENABLE_IPV6 -+ case AF_INET6: -+ host->h_addr_list[0] = (char*)&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr; -+ break; -+#endif -+ default: -+ error(0, 0, "unknown address type"); -+ -+ errno = EINVAL; -+ return -1; -+ } -+ host->h_addr_list[1] = NULL; -+ return 0; -+} - - /* - For historical reasons, we need a hostent structure to represent -@@ -726,30 +750,9 @@ static int get_hostent_from_name( - return -1; - } - -- /* Convert the first addrinfo into a hostent. */ -- host->h_name = res->ai_canonname; -- host->h_aliases = NULL; -- host->h_addrtype = res->ai_family; - ctl->af = res->ai_family; -- host->h_length = res->ai_addrlen; -- switch (ctl->af) { -- case AF_INET: -- host->h_addr_list[0] = (char*)&((struct sockaddr_in *)res->ai_addr)->sin_addr; -- break; --#ifdef ENABLE_IPV6 -- case AF_INET6: -- host->h_addr_list[0] = (char*)&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr; -- break; --#endif -- default: -- error(0, 0, "unknown address type"); -- -- errno = EINVAL; -- return -1; -- } -- host->h_addr_list[1] = NULL; -- -- return 0; -+ /* Convert the first addrinfo into a hostent. */ -+ return convert_addrinfo_to_hostent(host, res); - } - - - -From 5fd5c2b59d0bf1517492d88e672e8d6e69df657d Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 15:39:57 +1200 -Subject: [PATCH 08/17] move conversion call to caller - ---- - ui/mtr.c | 16 +++++++++------- - 1 file changed, 9 insertions(+), 7 deletions(-) - -diff --git a/ui/mtr.c b/ui/mtr.c -index de32215..ff1d995 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -729,17 +729,17 @@ static int convert_addrinfo_to_hostent(struct hostent *host, struct addrinfo *re - */ - static int get_hostent_from_name( - struct mtr_ctl *ctl, -- struct hostent *host, -+ struct addrinfo **res, - const char *name) - { - int gai_error; -- struct addrinfo hints, *res; -+ struct addrinfo hints; - - /* gethostbyname2() is deprecated so we'll use getaddrinfo() instead. */ - memset(&hints, 0, sizeof hints); - hints.ai_family = ctl->af; - hints.ai_socktype = SOCK_DGRAM; -- gai_error = getaddrinfo(name, NULL, &hints, &res); -+ gai_error = getaddrinfo(name, NULL, &hints, res); - if (gai_error) { - if (gai_error == EAI_SYSTEM) - error(0, 0, "Failed to resolve host: %s", name); -@@ -750,9 +750,8 @@ static int get_hostent_from_name( - return -1; - } - -- ctl->af = res->ai_family; -- /* Convert the first addrinfo into a hostent. */ -- return convert_addrinfo_to_hostent(host, res); -+ ctl->af = (*res)->ai_family; -+ return 0; - } - - -@@ -831,7 +830,10 @@ int main( - sizeof(ctl.LocalHostname)); - } - -- if (get_hostent_from_name(&ctl, host, ctl.Hostname) != 0) { -+ struct addrinfo *res = NULL; -+ if (get_hostent_from_name(&ctl, &res, ctl.Hostname) != 0 || -+ /* Convert the first addrinfo into a hostent. */ -+ convert_addrinfo_to_hostent(host, res) != 0) { - if (ctl.Interactive) - exit(EXIT_FAILURE); - else { - -From 6e2e4674a3c4c3ff7fb477bc7cf38ec9ccf8d4d3 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 16:00:41 +1200 -Subject: [PATCH 09/17] use addrinfo - ---- - ui/mtr.c | 2 +- - ui/net.c | 10 +++++----- - ui/net.h | 4 ++-- - 3 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/ui/mtr.c b/ui/mtr.c -index ff1d995..253861b 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -842,7 +842,7 @@ int main( - } - } - -- if (net_open(&ctl, host) != 0) { -+ if (net_open(&ctl, res) != 0) { - error(0, 0, "Unable to start net module"); - if (ctl.Interactive) - exit(EXIT_FAILURE); -diff --git a/ui/net.c b/ui/net.c -index 60d33e0..1df3503 100644 ---- a/ui/net.c -+++ b/ui/net.c -@@ -736,7 +736,7 @@ static void net_find_local_address( - - int net_open( - struct mtr_ctl *ctl, -- struct hostent *hostent) -+ struct addrinfo *res) - { - int err; - -@@ -746,7 +746,7 @@ int net_open( - return err; - } - -- net_reopen(ctl, hostent); -+ net_reopen(ctl, res); - - return 0; - } -@@ -754,7 +754,7 @@ int net_open( - - void net_reopen( - struct mtr_ctl *ctl, -- struct hostent *hostent) -+ struct addrinfo *res) - { - int at; - -@@ -764,9 +764,9 @@ void net_reopen( - - net_reset(ctl); - -- ctl->af = remotesockaddr->sa_family = sourcesockaddr->sa_family = hostent->h_addrtype; -+ ctl->af = remotesockaddr->sa_family = sourcesockaddr->sa_family = res->ai_family; - remoteaddress = sockaddr_addr_offset(remotesockaddr); -- memcpy(remoteaddress, hostent->h_addr, sockaddr_addr_size(remotesockaddr)); -+ memcpy(remoteaddress, sockaddr_addr_offset(res->ai_addr), sockaddr_addr_size(remotesockaddr)); - inet_ntop(remotesockaddr->sa_family, remoteaddress, remoteaddr, sizeof(remoteaddr)); - - sourceaddress = sockaddr_addr_offset(sourcesockaddr); -diff --git a/ui/net.h b/ui/net.h -index 38718fe..b323c25 100644 ---- a/ui/net.h -+++ b/ui/net.h -@@ -33,10 +33,10 @@ - - extern int net_open( - struct mtr_ctl *ctl, -- struct hostent *host); -+ struct addrinfo *res); - extern void net_reopen( - struct mtr_ctl *ctl, -- struct hostent *address); -+ struct addrinfo *res); - extern void net_reset( - struct mtr_ctl *ctl); - extern void net_close( - -From 5a45ca9cc2fb5d1e0d85b7421b938ee01204ab7e Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 16:12:36 +1200 -Subject: [PATCH 10/17] remove conversion function - ---- - ui/mtr.c | 32 +------------------------------- - 1 file changed, 1 insertion(+), 31 deletions(-) - -diff --git a/ui/mtr.c b/ui/mtr.c -index 253861b..8edca64 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -696,31 +696,6 @@ static void init_rand( - srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); - } - --static int convert_addrinfo_to_hostent(struct hostent *host, struct addrinfo *res) --{ -- host->h_name = res->ai_canonname; -- host->h_aliases = NULL; -- host->h_addrtype = res->ai_family; -- host->h_length = res->ai_addrlen; -- switch (res->ai_family) { -- case AF_INET: -- host->h_addr_list[0] = (char*)&((struct sockaddr_in *)res->ai_addr)->sin_addr; -- break; --#ifdef ENABLE_IPV6 -- case AF_INET6: -- host->h_addr_list[0] = (char*)&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr; -- break; --#endif -- default: -- error(0, 0, "unknown address type"); -- -- errno = EINVAL; -- return -1; -- } -- host->h_addr_list[1] = NULL; -- return 0; --} -- - /* - For historical reasons, we need a hostent structure to represent - our remote target for probing. The obsolete way of doing this -@@ -759,9 +734,6 @@ int main( - int argc, - char **argv) - { -- char *alptr[2]; -- struct hostent trhost = { .h_addr_list = alptr }; -- struct hostent *host = &trhost; - names_t *names_head = NULL; - names_t *names_walk; - -@@ -831,9 +803,7 @@ int main( - } - - struct addrinfo *res = NULL; -- if (get_hostent_from_name(&ctl, &res, ctl.Hostname) != 0 || -- /* Convert the first addrinfo into a hostent. */ -- convert_addrinfo_to_hostent(host, res) != 0) { -+ if (get_hostent_from_name(&ctl, &res, ctl.Hostname) != 0) { - if (ctl.Interactive) - exit(EXIT_FAILURE); - else { - -From 6a8471e48d33a9017ed226d2f6084e655421a793 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 16:52:18 +1200 -Subject: [PATCH 11/17] switch gui to addrinfo - ---- - ui/gtk.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/ui/gtk.c b/ui/gtk.c -index a98154a..aa07324 100644 ---- a/ui/gtk.c -+++ b/ui/gtk.c -@@ -244,11 +244,11 @@ static gint Host_activate( - gpointer data) - { - struct mtr_ctl *ctl = (struct mtr_ctl *) data; -- struct hostent *addr; -+ struct addrinfo *res = NULL; - -- addr = gethostbyname(gtk_entry_get_text(GTK_ENTRY(entry))); -- if (addr) { -- net_reopen(ctl, addr); -+ ctl->Hostname = gtk_entry_get_text(GTK_ENTRY(entry)); -+ if (get_hostent_from_name(ctl, &res, ctl->Hostname) == 0) { -+ net_reopen(ctl, res); - net_send_batch(ctl); - /* If we are "Paused" at this point it is usually because someone - entered a non-existing host. Therefore do the go-ahead... */ - -From cf1b9bc7e7e9d46153b91021ca1f102dc0c79ac5 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Thu, 8 Apr 2021 07:46:26 +1200 -Subject: [PATCH 12/17] export DEFAULT_AF - ---- - ui/mtr.c | 7 ------- - ui/mtr.h | 2 ++ - 2 files changed, 2 insertions(+), 7 deletions(-) - -diff --git a/ui/mtr.c b/ui/mtr.c -index 8edca64..23411cb 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -63,13 +63,6 @@ - #include "portability/getopt.h" - #endif - --#ifdef ENABLE_IPV6 --#define DEFAULT_AF AF_UNSPEC --#else --#define DEFAULT_AF AF_INET --#endif -- -- - char *myname; - - const struct fields data_fields[MAXFLD] = { -diff --git a/ui/mtr.h b/ui/mtr.h -index 01536f5..92dd8a1 100644 ---- a/ui/mtr.h -+++ b/ui/mtr.h -@@ -32,8 +32,10 @@ - - /* Typedefs */ - #ifdef ENABLE_IPV6 -+#define DEFAULT_AF AF_UNSPEC - typedef struct in6_addr ip_t; - #else -+#define DEFAULT_AF AF_INET - typedef struct in_addr ip_t; - #endif - - -From fd29a7e6306743c04171decff08334cc3fca6e8e Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Tue, 6 Apr 2021 16:57:59 +1200 -Subject: [PATCH 13/17] reset addr family before searching again - ---- - ui/gtk.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/ui/gtk.c b/ui/gtk.c -index aa07324..6e3a376 100644 ---- a/ui/gtk.c -+++ b/ui/gtk.c -@@ -246,6 +246,7 @@ static gint Host_activate( - struct mtr_ctl *ctl = (struct mtr_ctl *) data; - struct addrinfo *res = NULL; - -+ ctl->af = DEFAULT_AF; // should this obey the cmd line option? - ctl->Hostname = gtk_entry_get_text(GTK_ENTRY(entry)); - if (get_hostent_from_name(ctl, &res, ctl->Hostname) == 0) { - net_reopen(ctl, res); - -From e956e556217fcdd1865d21dea1cfb87a96550046 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Wed, 7 Apr 2021 13:08:36 +1200 -Subject: [PATCH 14/17] freeaddrinfo - ---- - ui/gtk.c | 1 + - ui/mtr.c | 2 ++ - 2 files changed, 3 insertions(+) - -diff --git a/ui/gtk.c b/ui/gtk.c -index 6e3a376..8ad0bbd 100644 ---- a/ui/gtk.c -+++ b/ui/gtk.c -@@ -250,6 +250,7 @@ static gint Host_activate( - ctl->Hostname = gtk_entry_get_text(GTK_ENTRY(entry)); - if (get_hostent_from_name(ctl, &res, ctl->Hostname) == 0) { - net_reopen(ctl, res); -+ freeaddrinfo(res); - net_send_batch(ctl); - /* If we are "Paused" at this point it is usually because someone - entered a non-existing host. Therefore do the go-ahead... */ -diff --git a/ui/mtr.c b/ui/mtr.c -index 23411cb..9586780 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -815,6 +815,8 @@ int main( - } - } - -+ freeaddrinfo(res); -+ - lock(stdout); - dns_open(); - display_open(&ctl); - -From 6521dc4fb0a0aa6baff11af20b066b2f713edbf8 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Wed, 7 Apr 2021 13:11:55 +1200 -Subject: [PATCH 15/17] export get_hostent_from_name - ---- - ui/mtr.c | 4 ++-- - ui/mtr.h | 6 ++++++ - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/ui/mtr.c b/ui/mtr.c -index 9586780..a044d1e 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -38,7 +38,6 @@ - #include - #endif - --#include - #include - #include - #include -@@ -695,11 +694,12 @@ static void init_rand( - would be to use gethostbyname(). We'll use getaddrinfo() instead - to generate the hostent. - */ --static int get_hostent_from_name( -+int get_hostent_from_name( - struct mtr_ctl *ctl, - struct addrinfo **res, - const char *name) - { -+ printf("get_hostent_from_name: %x %s\n", ctl->af, name); - int gai_error; - struct addrinfo hints; - -diff --git a/ui/mtr.h b/ui/mtr.h -index 92dd8a1..5de5d9f 100644 ---- a/ui/mtr.h -+++ b/ui/mtr.h -@@ -23,6 +23,7 @@ - #include "config.h" - - #include -+#include - #include - #include - -@@ -148,4 +149,9 @@ struct mplslen { - #define running_as_root() (getuid() == 0) - #endif - -+int get_hostent_from_name( -+ struct mtr_ctl *ctl, -+ struct addrinfo **res, -+ const char *name); -+ - #endif /* MTR_MTR_H */ - -From a351f650537e09f93738e3c76c06ebfa51552561 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Wed, 7 Apr 2021 13:15:05 +1200 -Subject: [PATCH 16/17] make Hostname as const - ---- - ui/mtr.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ui/mtr.h b/ui/mtr.h -index 5de5d9f..46c7a18 100644 ---- a/ui/mtr.h -+++ b/ui/mtr.h -@@ -85,7 +85,7 @@ struct mtr_ctl { - int MaxPing; - float WaitTime; - float GraceTime; -- char *Hostname; -+ const char *Hostname; - char *InterfaceName; - char *InterfaceAddress; - char LocalHostname[128]; - -From 9e01af2ac2e4bd6520ea41e453e770e092050c23 Mon Sep 17 00:00:00 2001 -From: Aaron Lipinski -Date: Thu, 8 Apr 2021 08:14:00 +1200 -Subject: [PATCH 17/17] rename function - ---- - ui/gtk.c | 2 +- - ui/mtr.c | 5 ++--- - ui/mtr.h | 2 +- - 3 files changed, 4 insertions(+), 5 deletions(-) - -diff --git a/ui/gtk.c b/ui/gtk.c -index 8ad0bbd..7c4a9fd 100644 ---- a/ui/gtk.c -+++ b/ui/gtk.c -@@ -248,7 +248,7 @@ static gint Host_activate( - - ctl->af = DEFAULT_AF; // should this obey the cmd line option? - ctl->Hostname = gtk_entry_get_text(GTK_ENTRY(entry)); -- if (get_hostent_from_name(ctl, &res, ctl->Hostname) == 0) { -+ if (get_addrinfo_from_name(ctl, &res, ctl->Hostname) == 0) { - net_reopen(ctl, res); - freeaddrinfo(res); - net_send_batch(ctl); -diff --git a/ui/mtr.c b/ui/mtr.c -index a044d1e..6fd0d70 100644 ---- a/ui/mtr.c -+++ b/ui/mtr.c -@@ -694,12 +694,11 @@ static void init_rand( - would be to use gethostbyname(). We'll use getaddrinfo() instead - to generate the hostent. - */ --int get_hostent_from_name( -+int get_addrinfo_from_name( - struct mtr_ctl *ctl, - struct addrinfo **res, - const char *name) - { -- printf("get_hostent_from_name: %x %s\n", ctl->af, name); - int gai_error; - struct addrinfo hints; - -@@ -796,7 +795,7 @@ int main( - } - - struct addrinfo *res = NULL; -- if (get_hostent_from_name(&ctl, &res, ctl.Hostname) != 0) { -+ if (get_addrinfo_from_name(&ctl, &res, ctl.Hostname) != 0) { - if (ctl.Interactive) - exit(EXIT_FAILURE); - else { -diff --git a/ui/mtr.h b/ui/mtr.h -index 46c7a18..9297be7 100644 ---- a/ui/mtr.h -+++ b/ui/mtr.h -@@ -149,7 +149,7 @@ struct mplslen { - #define running_as_root() (getuid() == 0) - #endif - --int get_hostent_from_name( -+int get_addrinfo_from_name( - struct mtr_ctl *ctl, - struct addrinfo **res, - const char *name); diff --git a/mtr.spec b/mtr.spec index f6b139b..7bd58fc 100644 --- a/mtr.spec +++ b/mtr.spec @@ -2,17 +2,14 @@ Summary: Network diagnostic tool combining 'traceroute' and 'ping' Name: mtr -Version: 0.94 -Release: 4%{?dist} +Version: 0.95 +Release: 1%{?dist} Epoch: 2 License: GPLv2 URL: https://www.bitwizard.nl/mtr/ Source0: https://github.com/traviscross/mtr/archive/v%{version}/%{name}-%{version}.tar.gz Source1: net-x%{name}.desktop -# https://bugzilla.redhat.com/show_bug.cgi?id=1488417 -Patch0: mtr-0.94-gtk.patch - BuildRequires: gcc make ncurses-devel libcap-devel jansson-devel BuildRequires: autoconf automake libtool git @@ -50,7 +47,6 @@ about each machine. %prep %setup -q -%patch0 -p1 -b .gtk %build ./bootstrap.sh @@ -82,6 +78,9 @@ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1} %{_datadir}/applications/net-x%{name}.desktop %changelog +* Thu Jan 13 2022 Robert Scheck - 2:0.95-1 +- Rebase to 0.95 (#2039260) + * Thu Jul 22 2021 Fedora Release Engineering - 2:0.94-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index ac7d4ff..d817615 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (mtr-0.94.tar.gz) = 0e58bd79562ff80f9308135562ab22aa1f1eea686aefd3aef07bac05e661e34b60fde7c66c96bf4f0919f546376fbd6106ecd8fa92328c24f6f903097496bf11 +SHA512 (mtr-0.95.tar.gz) = a7d69e0c551a10ae80a650a34588119e6c6b124a8c2c93d3de29e5daa6ef99f9217d875529d443c3760cd6fd7bd04d1e9abe33ef12635826c66a98bd776c1690