1 Star 0 Fork 29

lunankun/iputils

forked from src-openEuler/iputils 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-iputils-arpings.patch 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
gebidelidaye 提交于 2020-05-18 16:30 . update 0001-iputils-arpings.patch.
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
- 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.
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 | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arping.c b/arping.c
index 57114bb..78c8b86 100644
--- a/arping.c
+++ b/arping.c
@@ -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->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");
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lunankun/iputils.git
git@gitee.com:lunankun/iputils.git
lunankun
iputils
iputils
master

搜索帮助