+++ /dev/null
-From 455ad8a2b11fea8a5f5ab1c8885860eea92d0c9c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= <arekm@maven.pl>
-Date: Tue, 5 Jun 2018 15:54:44 +0200
-Subject: [PATCH] Also try SOCK_RAW/IPPROTO_ICMP when other fail.
-
-Under Linux Vserver SOCK_RAW is quite limited. Only IPPROTO_ICMP works,
-so try to use it.
-
-check_length_order() also doesn't work because sendto is also limited.
-Fortunately under linux check_length_order is not needed as described
-in comment around check_length_order.
----
- packet/probe_unix.c | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/packet/probe_unix.c b/packet/probe_unix.c
-index 56b670e..2804ecb 100644
---- a/packet/probe_unix.c
-+++ b/packet/probe_unix.c
-@@ -128,6 +128,12 @@ void check_length_order(
- ssize_t bytes_sent;
- int packet_size;
-
-+#ifdef __linux__
-+ /* Linux will accept either byte order and check below fails to work
-+ * in some cases due to sendto() returning EPERM. */
-+ return;
-+#endif
-+
- memset(¶m, 0, sizeof(struct probe_param_t));
- param.ip_version = 4;
- param.protocol = IPPROTO_ICMP;
-@@ -230,7 +236,10 @@ int open_ip4_sockets_raw(
-
- send_socket = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
- if (send_socket == -1) {
-- return -1;
-+ send_socket = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
-+ if (send_socket == -1) {
-+ return -1;
-+ }
- }
-
- /*
---
-2.17.1
-
+++ /dev/null
-From 240725528c5a756ee9aaff247e3731f4b8517c06 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= <arekm@maven.pl>
-Date: Tue, 5 Jun 2018 17:38:08 +0200
-Subject: [PATCH] mtr to a unreachable host is possible again.
-
-In mtr 0.87 it was possible to start mtr against unreachable
-host (that local kernel already knew that it is unreachable).
-Later it was broken. Make such tracing possible again.
----
- packet/probe.c | 28 +++++++++++++++++++++++-----
- ui/net.c | 10 ++++++++++
- 2 files changed, 33 insertions(+), 5 deletions(-)
-
-diff --git a/packet/probe.c b/packet/probe.c
-index 27bf138..cf95f8a 100644
---- a/packet/probe.c
-+++ b/packet/probe.c
-@@ -356,14 +356,32 @@ int find_source_addr(
- return -1;
- }
-
-- if (connect(sock, (struct sockaddr *) &dest_with_port, len)) {
-- close(sock);
-- return -1;
-- }
-+ if (connect(sock, (struct sockaddr *) &dest_with_port, len) == 0) {
-+ if (getsockname(sock, (struct sockaddr *) srcaddr, &len)) {
-+ close(sock);
-+ return -1;
-+ }
-+ } else {
-+#ifdef __linux__
-+ /* Linux doesn't require source address, so we can support
-+ * a case when mtr is run against unreachable host (that can become
-+ * reachable) */
-+ if (errno != EHOSTUNREACH) {
-+ close(sock);
-+ return -1;
-+ }
-
-- if (getsockname(sock, (struct sockaddr *) srcaddr, &len)) {
-+ if (destaddr->ss_family == AF_INET6) {
-+ srcaddr6 = (struct sockaddr_in6 *) srcaddr;
-+ srcaddr6->sin6_addr = in6addr_any;
-+ } else {
-+ srcaddr4 = (struct sockaddr_in *) srcaddr;
-+ srcaddr4->sin_addr.s_addr = INADDR_ANY;
-+ }
-+#else
- close(sock);
- return -1;
-+#endif
- }
-
- close(sock);
-diff --git a/ui/net.c b/ui/net.c
-index 69d4477..11dd4c8 100644
---- a/ui/net.c
-+++ b/ui/net.c
-@@ -720,6 +720,16 @@ static void net_find_local_address(
-
- if (connect
- (udp_socket, (struct sockaddr *) &remote_sockaddr, addr_length)) {
-+#ifdef __linux__
-+ /* Linux doesn't require source address, so we can support
-+ * a case when mtr is run against unreachable host (that can become
-+ * reachable) */
-+ if (errno == EHOSTUNREACH) {
-+ close(udp_socket);
-+ localaddr[0] = '\0';
-+ return;
-+ }
-+#endif
- error(EXIT_FAILURE, errno, "udp socket connect failed");
- }
-
---
-2.17.1
-
+++ /dev/null
-diff -ruNp mtr-0.92.orig/packet/construct_unix.c mtr-0.92/packet/construct_unix.c
---- mtr-0.92.orig/packet/construct_unix.c 2017-06-02 10:54:58.000000000 +0200
-+++ mtr-0.92/packet/construct_unix.c 2018-04-02 23:40:33.993584361 +0200
-@@ -491,6 +491,9 @@ int construct_ip4_packet(
- {
- int send_socket = net_state->platform.ip4_send_socket;
- bool is_stream_protocol = false;
-+ bool bind_send_socket = true;
-+ struct sockaddr_storage current_sockaddr;
-+ int current_sockaddr_len;
-
- if (param->protocol == IPPROTO_TCP) {
- is_stream_protocol = true;
-@@ -528,6 +531,31 @@ int construct_ip4_packet(
- }
-
- /*
-+ Check the current socket address, and if it is the same
-+ as the source address we intend, we will skip the bind.
-+ This is to accomodate Solaris, which, as of Solaris 11.3,
-+ will return an EINVAL error on bind if the socket is already
-+ bound, even if the same address is used.
-+ */
-+ current_sockaddr_len = sizeof(struct sockaddr_in);
-+ if (getsockname(send_socket, (struct sockaddr *) ¤t_sockaddr,
-+ ¤t_sockaddr_len) == 0) {
-+
-+ if (memcmp(¤t_sockaddr,
-+ src_sockaddr, sizeof(struct sockaddr_in)) == 0) {
-+ bind_send_socket = false;
-+ }
-+ }
-+
-+ /* Bind to our local address */
-+ if (bind_send_socket) {
-+ if (bind(send_socket, (struct sockaddr *) src_sockaddr,
-+ sizeof(struct sockaddr_in))) {
-+ return -1;
-+ }
-+ }
-+
-+ /*
- The routing mark requires CAP_NET_ADMIN, as opposed to the
- CAP_NET_RAW which we are sometimes explicitly given.
- If we don't have CAP_NET_ADMIN, this will fail, so we'll
Summary(ru.UTF-8): Matt's Traceroute - утилита для диагностики сети
Summary(uk.UTF-8): Matt's Traceroute - утиліта для діагностики мережі
Name: mtr
-Version: 0.92
-Release: 4
+Version: 0.93
+Release: 1
Epoch: 1
License: GPL v2
Group: Networking/Utilities
Source0: https://github.com/traviscross/mtr/archive/v%{version}.tar.gz
-# Source0-md5: f764793302a6cee2bf1573b95db6f295
+# Source0-md5: f68c397310ec2275736e2e19727c22c0
Source1: %{name}.desktop
Source2: %{name}.png
Patch0: %{name}-Makefile.patch
-Patch1: 0001-Also-try-SOCK_RAW-IPPROTO_ICMP-when-other-fail.patch
-Patch2: %{name}-mtr6.patch
-Patch3: %{name}-display.patch
-Patch4: %{name}-curses-clear_colors.patch
-Patch5: %{name}-sourceaddr_ipv4.patch
-Patch6: 0001-mtr-to-a-unreachable-host-is-possible-again.patch
-Patch7: %{name}-completion.patch
+Patch1: %{name}-mtr6.patch
+Patch2: %{name}-display.patch
+Patch3: %{name}-curses-clear_colors.patch
+Patch4: %{name}-completion.patch
URL: http://www.bitwizard.nl/mtr/
BuildRequires: autoconf >= 2.59
BuildRequires: automake >= 1:1.7.9
%patch2 -p1
%patch3 -p1
%patch4 -p1
-%patch5 -p1
-%patch6 -p1
-%patch7 -p1
echo %{version} > .tarball-version
%files
%defattr(644,root,root,755)
-%doc AUTHORS NEWS README SECURITY
+%doc AUTHORS FORMATS NEWS README.md SECURITY TODO
%attr(755,root,root) %{_bindir}/mtr
%attr(755,root,root) %{_bindir}/mtr6
%attr(4755,root,root) %{_bindir}/mtr-packet