fix exit code on -w option when count*interval > timeout

This commit is contained in:
eaglegai 2022-05-07 10:24:30 +08:00
parent 838da60222
commit fba7048b08
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,24 @@
From 4c2dd9f020df2749bdff294756b04aafa99ad624 Mon Sep 17 00:00:00 2001
From: eaglegai <eaglegai@163.com>
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 <eaglegai@163.com>
---
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);

View File

@ -1,6 +1,6 @@
Name: iputils Name: iputils
Version: 20210722 Version: 20210722
Release: 3 Release: 4
Summary: Network monitoring tools including ping Summary: Network monitoring tools including ping
License: BSD and GPLv2+ License: BSD and GPLv2+
URL: https://github.com/iputils/iputils URL: https://github.com/iputils/iputils
@ -19,6 +19,7 @@ Patch0003: backport-arping-fix-typo-in-error-checking.patch
Patch0004: backport-fix-ARP-protocol-field-for-AX.25-and-NETROM.patch Patch0004: backport-fix-ARP-protocol-field-for-AX.25-and-NETROM.patch
Patch0005: backport-ping-Fix-ping6-binding-to-VRF-and-address.patch Patch0005: backport-ping-Fix-ping6-binding-to-VRF-and-address.patch
Patch0006: backport-ping6-Avoid-binding-to-non-VRF.patch Patch0006: backport-ping6-Avoid-binding-to-non-VRF.patch
Patch0007: arping-Fix-exit-code-on-w-option.patch
BuildRequires: gcc meson libidn2-devel openssl-devel libcap-devel libxslt BuildRequires: gcc meson libidn2-devel openssl-devel libcap-devel libxslt
BuildRequires: docbook5-style-xsl systemd iproute glibc-kernheaders gettext BuildRequires: docbook5-style-xsl systemd iproute glibc-kernheaders gettext
@ -117,6 +118,12 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
%{_unitdir}/ninfod.service %{_unitdir}/ninfod.service
%changelog %changelog
* Fri May 06 2022 eaglegai <eaglegai@163.com> - 20210722-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix exit code on -w option when count*interval > timeout
* Tue Apr 26 2022 zengweifeng <zwfeng@huawei.com> - 20210722-3 * Tue Apr 26 2022 zengweifeng <zwfeng@huawei.com> - 20210722-3
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA