From c11176e4e035160ed14255d54ed730937e68e246 Mon Sep 17 00:00:00 2001 From: zhongxuan2 Date: Mon, 1 Apr 2024 06:29:07 +0000 Subject: [PATCH] sync 22.03-sp1 patches (cherry picked from commit 3033158ddcd0ec4a4556899fdfa75bf018c67ee2) --- arping-Fix-exit-code-on-w-option.patch | 24 +++++++ ...iff-Set-ppoll-timeout-minimum-to-1ms.patch | 27 +++++++ backport-ping-fix-overflow-on-negative.patch | 27 +++++++ ...ath-Restore-the-MTU-probing-behavior.patch | 70 +++++++++++++++++++ iputils.spec | 19 ++++- ...nterrupts-in-ping-_receive_error_msg.patch | 46 ++++++++++++ 6 files changed, 210 insertions(+), 3 deletions(-) create mode 100644 arping-Fix-exit-code-on-w-option.patch create mode 100644 backport-clockdiff-Set-ppoll-timeout-minimum-to-1ms.patch create mode 100644 backport-ping-fix-overflow-on-negative.patch create mode 100644 backport-tracepath-Restore-the-MTU-probing-behavior.patch create mode 100644 revert-process-interrupts-in-ping-_receive_error_msg.patch diff --git a/arping-Fix-exit-code-on-w-option.patch b/arping-Fix-exit-code-on-w-option.patch new file mode 100644 index 0000000..e94d30f --- /dev/null +++ b/arping-Fix-exit-code-on-w-option.patch @@ -0,0 +1,24 @@ +From 4c2dd9f020df2749bdff294756b04aafa99ad624 Mon Sep 17 00:00:00 2001 +From: eaglegai +Date: Fri, 18 Mar 2022 19:32:21 +0800 +Subject: [PATCH] arping: Fix exit code on -w option when count * interval > + timeout + +Signed-off-by: eaglegai +--- + arping.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arping.c b/arping.c +index 20b0554b..fe79d2f8 100644 +--- a/arping.c ++++ b/arping.c +@@ -850,7 +850,7 @@ static int event_loop(struct run_state *ctl) + else if (ctl->dad && ctl->quit_on_reply) + /* Duplicate address detection mode return value */ + rc |= !(ctl->brd_sent != ctl->received); +- else if (ctl->timeout && !(ctl->count > 0)) ++ else if (ctl->timeout && (!(ctl->count > 0) || (ctl->interval > ctl->timeout / ctl->count))) + rc |= !(ctl->received > 0); + else + rc |= (ctl->sent != ctl->received); diff --git a/backport-clockdiff-Set-ppoll-timeout-minimum-to-1ms.patch b/backport-clockdiff-Set-ppoll-timeout-minimum-to-1ms.patch new file mode 100644 index 0000000..92cfb46 --- /dev/null +++ b/backport-clockdiff-Set-ppoll-timeout-minimum-to-1ms.patch @@ -0,0 +1,27 @@ +From 471942dee341e5aae2a277ecd85c05e671752880 Mon Sep 17 00:00:00 2001 +From: caibingcheng +Date: Mon, 24 Apr 2023 20:45:28 +0800 +Subject: [PATCH] clockdiff: Set ppoll timeout minimum to 1ms + +Fixes: https://github.com/iputils/iputils/issues/326 +Closes: https://github.com/iputils/iputils/pull/459 +Reviewed-by: Petr Vorel +Reviewed-by: Noah Meyerhans +Signed-off-by: caibingcheng +--- + clockdiff.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/clockdiff.c b/clockdiff.c +index 5e639ab7..ccb5b5b3 100644 +--- a/clockdiff.c ++++ b/clockdiff.c +@@ -210,7 +210,7 @@ static int measure_inner_loop(struct run_state *ctl, struct measure_vars *mv) + struct pollfd p = { .fd = ctl->sock_raw, .events = POLLIN | POLLHUP }; + + { +- long tmo = ctl->rtt + ctl->rtt_sigma; ++ long tmo = MAX(ctl->rtt + ctl->rtt_sigma, 1); + + mv->tout.tv_sec = tmo / 1000; + mv->tout.tv_nsec = (tmo - (tmo / 1000) * 1000) * 1000000; diff --git a/backport-ping-fix-overflow-on-negative.patch b/backport-ping-fix-overflow-on-negative.patch new file mode 100644 index 0000000..15cfe13 --- /dev/null +++ b/backport-ping-fix-overflow-on-negative.patch @@ -0,0 +1,27 @@ +From 2a63b94313352ed62f47adbc1a0d33bfea7ca188 Mon Sep 17 00:00:00 2001 +From: Petr Vorel +Date: Wed, 17 May 2023 00:57:24 +0200 +Subject: [PATCH] ping: Fix overflow on negative -i + +Restore back check for -i <= 0. + +Fixes: 918e824 ("ping: add support for sub-second timeouts") +Closes: https://github.com/iputils/iputils/issues/465 +Signed-off-by: Petr Vorel +--- + ping/ping.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ping/ping.c b/ping/ping.c +index 8f442037..27c72cad 100644 +--- a/ping/ping.c ++++ b/ping/ping.c +@@ -436,7 +436,7 @@ main(int argc, char **argv) + double optval; + + optval = ping_strtod(optarg, _("bad timing interval")); +- if (isgreater(optval, (double)INT_MAX / 1000)) ++ if (islessequal(optval, 0) || isgreater(optval, (double)INT_MAX / 1000)) + error(2, 0, _("bad timing interval: %s"), optarg); + rts.interval = (int)(optval * 1000); + rts.opt_interval = 1; diff --git a/backport-tracepath-Restore-the-MTU-probing-behavior.patch b/backport-tracepath-Restore-the-MTU-probing-behavior.patch new file mode 100644 index 0000000..40c919e --- /dev/null +++ b/backport-tracepath-Restore-the-MTU-probing-behavior.patch @@ -0,0 +1,70 @@ +From d2311b4517beebda22c76f82a120f7b1f765a79d Mon Sep 17 00:00:00 2001 +From: csalinezh +Date: Thu, 5 Jan 2023 22:38:31 +0200 +Subject: [PATCH] tracepath: restore the MTU probing behaviour since release + 20071127 + +Since 81d0f03 (tracepath: fix IP{V6,}_PMTUDISC_DO values), tracepath +shows the PMTU for a target only at the first hop but not the hop where +MTU is reduced, if that data has been cached in kernel FIB by previous +probing attempts. + +IP_PMTUDISC_PROBE instructs the kernel to set the Don't Fragment flag +while bypassing PMTU checks. Usage of IP_PMTUDISC_PROBE in tracepath was +introduced in 37bd60c and mentioned in the release note of 20071127 +(1d83610) as a feature. + +As previously identified in 81d0f03 (appeared in release 20190709), the +definition of these options became incorrect during a copy refactoring in +d3028f1 (in release 20100418). The value for IP_PMTUDISC_PROBE continued +to be used until 81d0f03 when the correct definition of IP_PMTUDISC_DO was +adopted, thus causing a regression. + +This commit resotres the previous behaviour by adopting IP_PMTUDISC_PROBE. + +Fixes: d3028f1, 81d0f03 +Signed-off-by: Charles Zhang +--- + iputils_common.h | 6 ++++++ + tracepath.c | 4 ++-- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/iputils_common.h b/iputils_common.h +index 67b495ef..49e790d8 100644 +--- a/iputils_common.h ++++ b/iputils_common.h +@@ -55,6 +55,12 @@ + #ifndef IPV6_PMTUDISC_DO + # define IPV6_PMTUDISC_DO 2 + #endif ++#ifndef IP_PMTUDISC_PROBE ++# define IP_PMTUDISC_PROBE 3 ++#endif ++#ifndef IPV6_PMTUDISC_PROBE ++# define IPV6_PMTUDISC_PROBE 3 ++#endif + + #ifdef HAVE_ERROR_H + # include +diff --git a/tracepath.c b/tracepath.c +index 4d2a9acf..ebb7f72f 100644 +--- a/tracepath.c ++++ b/tracepath.c +@@ -532,7 +532,7 @@ int main(int argc, char **argv) + if (ctl.mtu <= ctl.overhead) + goto pktlen_error; + +- on = IPV6_PMTUDISC_DO; ++ on = IPV6_PMTUDISC_PROBE; + if (setsockopt(ctl.socket_fd, SOL_IPV6, IPV6_MTU_DISCOVER, &on, sizeof(on)) && + (on = IPV6_PMTUDISC_DO, setsockopt(ctl.socket_fd, SOL_IPV6, + IPV6_MTU_DISCOVER, &on, sizeof(on)))) +@@ -557,7 +557,7 @@ int main(int argc, char **argv) + if (ctl.mtu <= ctl.overhead) + goto pktlen_error; + +- on = IP_PMTUDISC_DO; ++ on = IP_PMTUDISC_PROBE; + if (setsockopt(ctl.socket_fd, SOL_IP, IP_MTU_DISCOVER, &on, sizeof(on))) + error(1, errno, "IP_MTU_DISCOVER"); + on = 1; diff --git a/iputils.spec b/iputils.spec index 146bed0..194408f 100644 --- a/iputils.spec +++ b/iputils.spec @@ -1,6 +1,6 @@ Name: iputils Version: 20221126 -Release: 3 +Release: 4 Summary: Network monitoring tools including ping License: BSD and GPLv2+ URL: https://github.com/iputils/iputils @@ -12,6 +12,13 @@ Source3: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt Patch0000: iputils-ifenslave.patch Patch0001: iputils-ifenslave-CWE-170.patch +Patch0002: revert-process-interrupts-in-ping-_receive_error_msg.patch + +Patch0010: arping-Fix-exit-code-on-w-option.patch + +Patch6000: backport-clockdiff-Set-ppoll-timeout-minimum-to-1ms.patch +Patch6001: backport-ping-fix-overflow-on-negative.patch +Patch6002: backport-tracepath-Restore-the-MTU-probing-behavior.patch BuildRequires: gcc meson libidn2-devel openssl-devel libcap-devel libxslt BuildRequires: docbook5-style-xsl systemd iproute glibc-kernheaders gettext @@ -82,8 +89,14 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/ %{_mandir}/man8/*.8.gz %changelog -* Thu Nov 16 2023 renyi - 20221126-3 -- Type:enhencement +* Mon Apr 1 2024 zhongxuan - 20221126-4 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: backport two patches + +* Thu Nov 16 2023 r30030392 - 20221126-3 +- Type:NA - CVE:NA - SUG:NA - DESC:support for building with clang diff --git a/revert-process-interrupts-in-ping-_receive_error_msg.patch b/revert-process-interrupts-in-ping-_receive_error_msg.patch new file mode 100644 index 0000000..3c36be8 --- /dev/null +++ b/revert-process-interrupts-in-ping-_receive_error_msg.patch @@ -0,0 +1,46 @@ +From 6b94c384b8f5337fff2f3c3145d0239ff91618cd Mon Sep 17 00:00:00 2001 +From: eaglegai +Date: Sat, 5 Mar 2022 09:37:47 +0800 +Subject: [PATCH] revert process interrupts in ping*_receive_error_msg + +--- + ping/ping.c | 5 +---- + ping/ping6_common.c | 5 +---- + 2 files changed, 2 insertions(+), 8 deletions(-) + +diff --git a/ping/ping.c b/ping/ping.c +index 6fcb44f..7ec4836 100644 +--- a/ping/ping.c ++++ b/ping/ping.c +@@ -1314,11 +1314,8 @@ int ping4_receive_error_msg(struct ping_rts *rts, socket_st *sock) + msg.msg_controllen = sizeof(cbuf); + + res = recvmsg(sock->fd, &msg, MSG_ERRQUEUE | MSG_DONTWAIT); +- if (res < 0) { +- if (errno == EAGAIN || errno == EINTR) +- local_errors++; ++ if (res < 0) + goto out; +- } + + e = NULL; + for (cmsgh = CMSG_FIRSTHDR(&msg); cmsgh; cmsgh = CMSG_NXTHDR(&msg, cmsgh)) { +diff --git a/ping/ping6_common.c b/ping/ping6_common.c +index 986210b..b0aa66b 100644 +--- a/ping/ping6_common.c ++++ b/ping/ping6_common.c +@@ -482,11 +482,8 @@ int ping6_receive_error_msg(struct ping_rts *rts, socket_st *sock) + msg.msg_controllen = sizeof(cbuf); + + res = recvmsg(sock->fd, &msg, MSG_ERRQUEUE | MSG_DONTWAIT); +- if (res < 0) { +- if (errno == EAGAIN || errno == EINTR) +- local_errors++; ++ if (res < 0) + goto out; +- } + + e = NULL; + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { +-- +2.33.0 \ No newline at end of file -- Gitee