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

This commit is contained in:
eaglegai 2022-05-06 10:20:53 +08:00
parent f06179b2a5
commit bc342fe107
2 changed files with 33 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: 5 Release: 6
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
@ -23,6 +23,8 @@ Patch0007: backport-fix-ARP-protocol-field-for-AX.25-and-NETROM.patch
Patch0008: backport-ping-Fix-ping6-binding-to-VRF-and-address.patch Patch0008: backport-ping-Fix-ping6-binding-to-VRF-and-address.patch
Patch0009: backport-ping6-Avoid-binding-to-non-VRF.patch Patch0009: backport-ping6-Avoid-binding-to-non-VRF.patch
Patch0010: 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
%{?systemd_ordering} %{?systemd_ordering}
@ -120,6 +122,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-6
- 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-5 * Tue Apr 26 2022 zengweifeng <zwfeng@huawei.com> - 20210722-5
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA