From f56ab8fddd19e86fb3d63ed151444b5f61eaa6dd Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 8 Nov 2022 01:54:06 -0500 Subject: [PATCH] import iputils-20180629-10.el8 --- ...iputils-rh.patch => 0000-iputils-rh.patch} | 0 ...ave.patch => 0001-iputils-ifenslave.patch} | 0 ....patch => 0002-iputils-freeaddrinfo.patch} | 0 ...ch => 0003-fix-incorrect-statistics.patch} | 0 ...path-fix-copying-input-ipv6-address.patch} | 0 ...-avoid-colliding-with-function-name.patch} | 0 ...unwanted-bell-on-unreachable-address.patch | 113 ++++++++++++++++++ SPECS/iputils.spec | 19 +-- 8 files changed, 125 insertions(+), 7 deletions(-) rename SOURCES/{iputils-rh.patch => 0000-iputils-rh.patch} (100%) rename SOURCES/{iputils-ifenslave.patch => 0001-iputils-ifenslave.patch} (100%) rename SOURCES/{iputils-freeaddrinfo.patch => 0002-iputils-freeaddrinfo.patch} (100%) rename SOURCES/{fix-incorrect-statistics.patch => 0003-fix-incorrect-statistics.patch} (100%) rename SOURCES/{tracepath-fix-copying-input-ipv6-address.patch => 0004-tracepath-fix-copying-input-ipv6-address.patch} (100%) rename SOURCES/{ninfod-change-variable-name-to-avoid-colliding-with-function-name.patch => 0005-ninfod-change-variable-name-to-avoid-colliding-with-function-name.patch} (100%) create mode 100644 SOURCES/0006-ping-Fix-unwanted-bell-on-unreachable-address.patch diff --git a/SOURCES/iputils-rh.patch b/SOURCES/0000-iputils-rh.patch similarity index 100% rename from SOURCES/iputils-rh.patch rename to SOURCES/0000-iputils-rh.patch diff --git a/SOURCES/iputils-ifenslave.patch b/SOURCES/0001-iputils-ifenslave.patch similarity index 100% rename from SOURCES/iputils-ifenslave.patch rename to SOURCES/0001-iputils-ifenslave.patch diff --git a/SOURCES/iputils-freeaddrinfo.patch b/SOURCES/0002-iputils-freeaddrinfo.patch similarity index 100% rename from SOURCES/iputils-freeaddrinfo.patch rename to SOURCES/0002-iputils-freeaddrinfo.patch diff --git a/SOURCES/fix-incorrect-statistics.patch b/SOURCES/0003-fix-incorrect-statistics.patch similarity index 100% rename from SOURCES/fix-incorrect-statistics.patch rename to SOURCES/0003-fix-incorrect-statistics.patch diff --git a/SOURCES/tracepath-fix-copying-input-ipv6-address.patch b/SOURCES/0004-tracepath-fix-copying-input-ipv6-address.patch similarity index 100% rename from SOURCES/tracepath-fix-copying-input-ipv6-address.patch rename to SOURCES/0004-tracepath-fix-copying-input-ipv6-address.patch diff --git a/SOURCES/ninfod-change-variable-name-to-avoid-colliding-with-function-name.patch b/SOURCES/0005-ninfod-change-variable-name-to-avoid-colliding-with-function-name.patch similarity index 100% rename from SOURCES/ninfod-change-variable-name-to-avoid-colliding-with-function-name.patch rename to SOURCES/0005-ninfod-change-variable-name-to-avoid-colliding-with-function-name.patch diff --git a/SOURCES/0006-ping-Fix-unwanted-bell-on-unreachable-address.patch b/SOURCES/0006-ping-Fix-unwanted-bell-on-unreachable-address.patch new file mode 100644 index 0000000..f750efc --- /dev/null +++ b/SOURCES/0006-ping-Fix-unwanted-bell-on-unreachable-address.patch @@ -0,0 +1,113 @@ +From dc4f836759887a6edf141aa55adbdb9bc63f5e69 Mon Sep 17 00:00:00 2001 +From: Jan Macku +Date: Tue, 22 Mar 2022 12:59:21 +0100 +Subject: [PATCH] ping: Fix unwanted bell on unreachable address + +Commit 4471ac629cf2603f4b8b45e042e072c992ce25a5 caused regression for IPv6 +that ping -a IP6_ADDR beeps also on wrong address (i.e. when "Address +unreachable"): + + $ ping -a -c1 fd00:1:1:1::15 + PING fd00:1:1:1::15(fd00:1:1:1::15) 56 data bytes + From fd00:1:1:1::2 icmp_seq=1 Destination unreachable: Address unreachable + + --- fd00:1:1:1::15 ping statistics --- + 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0m + +It should only bell when ping returns correctly. + +Another (fixed) regression was that ping after exit printed error "pipe N", +where N is number of counts. Error was result of code from ping_common.c: +printf("%spipe %d", comma, pipesize); + +4471ac6 was wrong that code for sock->working_recverr == 1 should stay, +sock->working_recverr should be removed. + +Thus changes: +* ping.c: put back "stronger filter" for raw socket but (unlike before + 4471ac6) exit with 2 if setsockopt(ICMP_FILTER) fails +* ping6_common.c: put back setsockopt(IPV6_RECVERR), but (unlike before + 4471ac6) exit with 2 if it fails +* ping6_common.c: remove ICMP6_FILTER_SETPASS calls. These caused error "pipe N". +* ping6_common.c: return 0 after acknowledge() in ping6_parse_reply + +Fixes: 4471ac6 ("ping: Remove workaround for bug in IP_RECVERR on raw sockets") +Fixes: https://github.com/iputils/iputils/issues/182 +Reported-by: Luiz Angelo Daros de Luca +Signed-off-by: Petr Vorel +Reviewed-by: Sami Kerola + +--- +Patch has been adjusted to be applicable to RHEL8 codebase + +Resolves: #2057570 +--- + ping.c | 11 +++++++++++ + ping6_common.c | 15 +++------------ + 2 files changed, 14 insertions(+), 12 deletions(-) + +diff --git a/ping.c b/ping.c +index d9a3f5d..c870390 100644 +--- a/ping.c ++++ b/ping.c +@@ -949,6 +949,17 @@ int ping4_receive_error_msg(socket_st *sock) + + acknowledge(ntohs(icmph.un.echo.sequence)); + ++ if (sock->socktype == SOCK_RAW) ++ { ++ struct icmp_filter filt; ++ ++ filt.data = ~((1 << ICMP_SOURCE_QUENCH) | ++ (1 << ICMP_REDIRECT) | ++ (1 << ICMP_ECHOREPLY)); ++ if (setsockopt(sock->fd, SOL_RAW, ICMP_FILTER, (const void *)&filt, ++ sizeof(filt)) == -1) ++ error(2, errno, "setsockopt(ICMP_FILTER)"); ++ } + net_errors++; + nerrors++; + if (options & F_QUIET) +diff --git a/ping6_common.c b/ping6_common.c +index 5991c2a..1181341 100644 +--- a/ping6_common.c ++++ b/ping6_common.c +@@ -879,6 +879,8 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock + } + + hold = 1; ++ if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_RECVERR, (const void *)&hold, sizeof hold)) ++ error(2, errno, "IPV6_RECVERR"); + + /* Estimate memory eaten by single packet. It is rough estimate. + * Actually, for small datalen's it depends on kernel side a lot. */ +@@ -906,11 +908,6 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock + + ICMP6_FILTER_SETBLOCKALL(&filter); + +- ICMP6_FILTER_SETPASS(ICMP6_DST_UNREACH, &filter); +- ICMP6_FILTER_SETPASS(ICMP6_PACKET_TOO_BIG, &filter); +- ICMP6_FILTER_SETPASS(ICMP6_TIME_EXCEEDED, &filter); +- ICMP6_FILTER_SETPASS(ICMP6_PARAM_PROB, &filter); +- + if (niquery_is_enabled()) + ICMP6_FILTER_SETPASS(ICMPV6_NI_REPLY, &filter); + else +@@ -1437,13 +1434,7 @@ ping6_parse_reply(socket_st *sock, struct msghdr *msg, int cc, void *addr, struc + !is_ours(sock, icmph1->icmp6_id)) + return 1; + acknowledge(ntohs(icmph1->icmp6_seq)); +- nerrors++; +- if (options & F_FLOOD) { +- write_stdout("\bE", 2); +- return 0; +- } +- print_timestamp(); +- printf("From %s: icmp_seq=%u ", pr_addr(from, sizeof *from), ntohs(icmph1->icmp6_seq)); ++ return 0; + } else { + /* We've got something other than an ECHOREPLY */ + if (!(options & F_VERBOSE) || uid) +-- +2.35.1 + diff --git a/SPECS/iputils.spec b/SPECS/iputils.spec index 971cd21..97c9291 100644 --- a/SPECS/iputils.spec +++ b/SPECS/iputils.spec @@ -3,7 +3,7 @@ Summary: Network monitoring tools including ping Name: iputils Version: 20180629 -Release: 9%{?dist} +Release: 10%{?dist} # some parts are under the original BSD (ping.c) # some are under GPLv2+ (tracepath.c) License: BSD and GPLv2+ @@ -18,12 +18,13 @@ Source3: ninfod.service Source4: bsd.txt Source5: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt -Patch0: iputils-rh.patch -Patch1: iputils-ifenslave.patch -Patch2: iputils-freeaddrinfo.patch -Patch3: fix-incorrect-statistics.patch -Patch4: tracepath-fix-copying-input-ipv6-address.patch -Patch5: ninfod-change-variable-name-to-avoid-colliding-with-function-name.patch +Patch0: 0000-iputils-rh.patch +Patch1: 0001-iputils-ifenslave.patch +Patch2: 0002-iputils-freeaddrinfo.patch +Patch3: 0003-fix-incorrect-statistics.patch +Patch4: 0004-tracepath-fix-copying-input-ipv6-address.patch +Patch5: 0005-ninfod-change-variable-name-to-avoid-colliding-with-function-name.patch +Patch6: 0006-ping-Fix-unwanted-bell-on-unreachable-address.patch %if ! 0%{?_module_build} BuildRequires: docbook-utils perl-SGMLSpm @@ -68,6 +69,7 @@ cp %{SOURCE4} %{SOURCE5} . %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 %build %ifarch s390 s390x @@ -171,6 +173,9 @@ install -m 644 %SOURCE3 ${RPM_BUILD_ROOT}/%{_unitdir} %endif %changelog +* Tue Mar 22 2022 Jan Macku - 20180629-10 +- Fix regression of output when pinging unreachable IPv6 host (#2057570) + * Thu Feb 03 2022 Jan Macku - 20180629-9 - Fix copying input IPv6 address (#2047659)