!76 [sync] PR-73: backport two patches

From: @openeuler-sync-bot 
Reviewed-by: @robertxw 
Signed-off-by: @robertxw
This commit is contained in:
openeuler-ci-bot 2023-12-14 01:55:46 +00:00 committed by Gitee
commit f089de04a7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 106 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From 2a63b94313352ed62f47adbc1a0d33bfea7ca188 Mon Sep 17 00:00:00 2001
From: Petr Vorel <pvorel@suse.cz>
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 <pvorel@suse.cz>
---
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;

View File

@ -0,0 +1,70 @@
From d2311b4517beebda22c76f82a120f7b1f765a79d Mon Sep 17 00:00:00 2001
From: csalinezh <csalinezh@gmail.com>
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 <csalinezh@gmail.com>
---
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 <error.h>
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;

View File

@ -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
@ -17,6 +17,8 @@ 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
@ -89,6 +91,12 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
%{_mandir}/man8/*.8.gz
%changelog
* Fri Sep 15 2023 zhongxuan <zhongxuan2@huawei.com> - 20221126-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: backport two patches
* Thu Jun 1 2023 zhongxuan <zhongxuan2@huawei.com> - 20221126-3
- Type:bugfix
- ID:NA