This commit is contained in:
njlzk 2020-03-11 18:47:11 +08:00
parent d9725990e4
commit d582ea79c1
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From b94cd579083660bffa0e7d3c45ea0c1a4e8adaec Mon Sep 17 00:00:00 2001
From: liuzhikang <liuzhikang3@huawei.com>
Date: Wed, 11 Mar 2020 17:52:29 +0800
Subject: [PATCH] arping -w does not take effect
---
arping.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arping.c b/arping.c
index 30884f6..8fadfcb 100644
--- a/arping.c
+++ b/arping.c
@@ -686,7 +686,7 @@ static int event_loop(struct run_state *ctl)
.it_value.tv_sec = ctl->interval,
.it_value.tv_nsec = 0
};
- uint64_t exp, total_expires = 1;
+ uint64_t exp, total_expires = 0;
unsigned char packet[4096];
struct sockaddr_storage from = { 0 };
@@ -759,13 +759,17 @@ static int event_loop(struct run_state *ctl)
break;
case POLLFD_TIMER:
s = read(tfd, &exp, sizeof(uint64_t));
+ total_expires++;
if (s != sizeof(uint64_t)) {
error(0, errno, "could not read timerfd");
+ if (ctl->timeout > 0 && ((total_expires * ctl->interval) > (uint64_t)ctl->timeout)) {
+ exit_loop = 1;
+ }
continue;
}
- total_expires += exp;
- if ((0 < ctl->count && (uint64_t)ctl->count < total_expires) ||
- (ctl->quit_on_reply && ctl->timeout < total_expires)) {
+ if ((ctl->count > 0 && (total_expires >= (uint64_t)ctl->count)) ||
+ (ctl->timeout > 0 && (total_expires * ctl->interval) > (uint64_t)ctl->timeout)||
+ (ctl->quit_on_reply)) {
exit_loop = 1;
continue;
}
--
1.8.3.1

View File

@ -1,6 +1,6 @@
Name: iputils
Version: 20190709
Release: 1
Release: 2
Summary: Network monitoring tools including ping
License: BSD and GPLv2+
URL: https://github.com/iputils/iputils
@ -16,6 +16,7 @@ Patch100: iputils-ifenslave.patch
Patch6000: 0001-iputils-arpings.patch
Patch6001: 0002-iputils-arpings-count.patch
Patch9000: bugfix-arping-w-does-not-take-effect.patch
BuildRequires: gcc meson libidn2-devel openssl-devel libcap-devel libxslt
BuildRequires: docbook5-style-xsl systemd glibc-kernheaders gettext
@ -40,6 +41,7 @@ cp %{SOURCE4} %{SOURCE5} .
%patch100 -p1
%patch6000 -p1
%patch6001 -p1
%patch9000 -p1
%build
export CFLAGS="-fpie"
@ -94,6 +96,12 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
%{_mandir}/man8/*.8.gz
%changelog
* Wed Mar 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 20190709-2
- Type:bigfix
- Id:NA
- SUG:NA
- DESC:bugfix the arping
* Wed Oct 9 2019 openEuler Buildteam <buildteam@openeuler.org> - 20190709-1
- Type:bugfix
- Id:NA