From d582ea79c1acb3674dcd7085ea6619b369913956 Mon Sep 17 00:00:00 2001 From: njlzk Date: Wed, 11 Mar 2020 18:47:11 +0800 Subject: [PATCH] arping --- bugfix-arping-w-does-not-take-effect.patch | 46 ++++++++++++++++++++++ iputils.spec | 10 ++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 bugfix-arping-w-does-not-take-effect.patch diff --git a/bugfix-arping-w-does-not-take-effect.patch b/bugfix-arping-w-does-not-take-effect.patch new file mode 100644 index 0000000..4479b8f --- /dev/null +++ b/bugfix-arping-w-does-not-take-effect.patch @@ -0,0 +1,46 @@ +From b94cd579083660bffa0e7d3c45ea0c1a4e8adaec Mon Sep 17 00:00:00 2001 +From: liuzhikang +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 + diff --git a/iputils.spec b/iputils.spec index 6192562..7f2ac95 100644 --- a/iputils.spec +++ b/iputils.spec @@ -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 - 20190709-2 +- Type:bigfix +- Id:NA +- SUG:NA +- DESC:bugfix the arping + * Wed Oct 9 2019 openEuler Buildteam - 20190709-1 - Type:bugfix - Id:NA -- Gitee