[packages/mtr] - rel 3; try SOCK_RAW IPPROTO_ICMP to work under linux vserver

arekm arekm at pld-linux.org
Tue Jun 5 15:58:46 CEST 2018


commit 0d3b3367f18c76f0b469bae9dce587002c48f4fc
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue Jun 5 15:58:39 2018 +0200

    - rel 3; try SOCK_RAW IPPROTO_ICMP to work under linux vserver

 ...try-SOCK_RAW-IPPROTO_ICMP-when-other-fail.patch | 47 ++++++++++++++++++++++
 mtr.spec                                           |  6 +--
 2 files changed, 50 insertions(+), 3 deletions(-)
---
diff --git a/mtr.spec b/mtr.spec
index c4de6fc..d2c4df7 100644
--- a/mtr.spec
+++ b/mtr.spec
@@ -10,7 +10,7 @@ Summary(ru.UTF-8):	Matt's Traceroute - утилита для диагности
 Summary(uk.UTF-8):	Matt's Traceroute - утиліта для діагностики мережі
 Name:		mtr
 Version:	0.92
-Release:	2
+Release:	3
 Epoch:		1
 License:	GPL v2
 Group:		Networking/Utilities
@@ -19,7 +19,7 @@ Source0:	https://github.com/traviscross/mtr/archive/v%{version}.tar.gz
 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
@@ -154,7 +154,7 @@ Pakiet ten dostarcza bashowe uzupełnianie nazw dla mtra.
 %prep
 %setup -q
 %patch0 -p1
-
+%patch1 -p1
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
diff --git a/0001-Also-try-SOCK_RAW-IPPROTO_ICMP-when-other-fail.patch b/0001-Also-try-SOCK_RAW-IPPROTO_ICMP-when-other-fail.patch
new file mode 100644
index 0000000..3d3cd6b
--- /dev/null
+++ b/0001-Also-try-SOCK_RAW-IPPROTO_ICMP-when-other-fail.patch
@@ -0,0 +1,47 @@
+From 455ad8a2b11fea8a5f5ab1c8885860eea92d0c9c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= <arekm at 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(&param, 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
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/mtr.git/commitdiff/0d3b3367f18c76f0b469bae9dce587002c48f4fc



More information about the pld-cvs-commit mailing list