!5 iputils: fix arping's exit code for -U/A

Merge pull request !5 from gebidelidaye/master
This commit is contained in:
openeuler-ci-bot 2020-05-18 21:49:12 +08:00 committed by Gitee
commit 75879be5d0
2 changed files with 32 additions and 11 deletions

View File

@ -1,33 +1,48 @@
From 18f14be80466ddc8fb17a400be82764a779c8dcd Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
Date: Wed, 31 Jul 2019 21:28:12 +0100
Subject: [PATCH] arping: revert partially - fix sent vs received packages
return value
Subject: [PATCH] arping: revert partially
- fix sent vs received packages return value
- fix arping's exit code for -U/A
Commit 84ca65ca980315c73f929fed8b6f16bbd698c3a0 caused regression. The
arping -D needs return value evaluation that was the earlier default, in
other cases the new return value should be correct.
Addresses: https://github.com/iputils/iputils/issues/209
See-also: https://github.com/void-linux/void-packages/issues/13304
Addresses1: https://github.com/iputils/iputils/issues/209
See-also1: https://github.com/void-linux/void-packages/issues/13304
Addresses2: https://github.com/iputils/iputils/issues/247
See-also2:https://github.com/iputils/iputils/commit/68f12fc4a0dbef4ae4c404da24040d22c5a14339
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
arping.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
arping.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arping.c b/arping.c
index 77c9c56..2c87c15 100644
index 57114bb..78c8b86 100644
--- a/arping.c
+++ b/arping.c
@@ -792,7 +792,11 @@ static int event_loop(struct run_state *ctl)
@@ -797,7 +797,13 @@ static int event_loop(struct run_state *ctl)
close(tfd);
freeifaddrs(ctl->ifa0);
rc |= finish(ctl);
- rc |= (ctl->sent != ctl->received);
+ if (ctl->dad && ctl->quit_on_reply)
+ if (ctl->unsolicited)
+ /* nothing */;
+ else if (ctl->dad && ctl->quit_on_reply)
+ /* Duplicate address detection mode return value */
+ rc |= !(ctl->brd_sent != ctl->received);
+ else
+ rc |= (ctl->sent != ctl->received);
return rc;
}
@@ -942,7 +948,7 @@ int main(int argc, char **argv)
}
memset(&saddr, 0, sizeof(saddr));
saddr.sin_family = AF_INET;
- if (ctl.source || ctl.gsrc.s_addr) {
+ if (!ctl.unsolicited && (ctl.source || ctl.gsrc.s_addr)) {
saddr.sin_addr = ctl.gsrc;
if (bind(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
error(2, errno, "bind");

View File

@ -1,6 +1,6 @@
Name: iputils
Version: 20190709
Release: 2
Release: 3
Summary: Network monitoring tools including ping
License: BSD and GPLv2+
URL: https://github.com/iputils/iputils
@ -96,8 +96,14 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
%{_mandir}/man8/*.8.gz
%changelog
* Mon May 18 2020 openEuler Buildteam <buildteam@openeuler.org> - 20190709-3
- Type:bugfix
- Id:NA
- SUG:restart
- DESC:bugfix arping's exit code for -U/A
* Wed Mar 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 20190709-2
- Type:bigfix
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:bugfix the arping