update iputils to 20200821

This commit is contained in:
haochenstar 2021-01-26 15:29:51 +08:00
parent f1017a4d5a
commit 6bd3c65424
9 changed files with 25 additions and 220 deletions

View File

@ -1,48 +0,0 @@
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");

View File

@ -1,34 +0,0 @@
From 1df5350bdc952b14901fde356b17b78c2bcd4cff Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
Date: Wed, 28 Aug 2019 20:05:22 +0100
Subject: [PATCH] arping: fix -f quit on first reply regression
When arping runs together with -f 'quit on first reply' and -w <timeout>
'how long to wait for a reply' the command needs to exit if replies are not
received after wait period. Notice that the exit in case of lost packages
will be 1 signifying failure. Getting a reply results to 0 exit value.
Addresses: https://bugs.debian.org/935946
Reported-by: Lucas Nussbaum <lucas@debian.org>
Addresses: https://github.com/iputils/iputils/issues/211
Reported-by: Noah Meyerhans <noahm@debian.org>
Broken-since: 67e070d08dcbec990e1178360f82b3e2ca4f6d5f
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
arping.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arping.c b/arping.c
index 2c87c15..30884f6 100644
--- a/arping.c
+++ b/arping.c
@@ -764,7 +764,8 @@ static int event_loop(struct run_state *ctl)
continue;
}
total_expires += exp;
- if (0 < ctl->count && (uint64_t)ctl->count < total_expires) {
+ if ((0 < ctl->count && (uint64_t)ctl->count < total_expires) ||
+ (ctl->quit_on_reply && ctl->timeout < total_expires)) {
exit_loop = 1;
continue;
}

View File

@ -1,51 +0,0 @@
From 18f9a84e0e702841d6cc4d5f593de4fbd1348e83 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
Date: Sat, 28 Dec 2019 17:16:27 +0000
Subject: [PATCH] ninfod: change variable name to avoid colliding with function
name
The sys/capability.h header has 'extern int cap_setuid(uid_t uid);'
function prototype.
Addresses: https://github.com/iputils/iputils/issues/246
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
ninfod/ninfod.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ninfod/ninfod.c b/ninfod/ninfod.c
index 26112d0..95583de 100644
--- a/ninfod/ninfod.c
+++ b/ninfod/ninfod.c
@@ -455,7 +455,7 @@ static void do_daemonize(void)
/* --------- */
#ifdef HAVE_LIBCAP
static const cap_value_t cap_net_raw = CAP_NET_RAW;
-static const cap_value_t cap_setuid = CAP_SETUID;
+static const cap_value_t cap_setuserid = CAP_SETUID;
static cap_flag_value_t cap_ok;
#else
static uid_t euid;
@@ -487,7 +487,7 @@ static void limit_capabilities(void)
cap_get_flag(cap_cur_p, CAP_SETUID, CAP_PERMITTED, &cap_ok);
if (cap_ok != CAP_CLEAR)
- cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuid, CAP_SET);
+ cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuserid, CAP_SET);
if (cap_set_proc(cap_p) < 0) {
DEBUG(LOG_ERR, "cap_set_proc: %s\n", strerror(errno));
@@ -520,8 +520,8 @@ static void drop_capabilities(void)
/* setuid / setuid */
if (cap_ok != CAP_CLEAR) {
- cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuid, CAP_SET);
- cap_set_flag(cap_p, CAP_EFFECTIVE, 1, &cap_setuid, CAP_SET);
+ cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuserid, CAP_SET);
+ cap_set_flag(cap_p, CAP_EFFECTIVE, 1, &cap_setuserid, CAP_SET);
if (cap_set_proc(cap_p) < 0) {
DEBUG(LOG_ERR, "cap_set_proc: %s\n", strerror(errno));
--
1.8.3.1

View File

@ -1,23 +0,0 @@
diff --git a/.travis.yml b/.travis.yml
index 16ebbcc..094c243 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,4 @@
+---
# Copyright (c) 2019-2020 Petr Vorel <pvorel@suse.cz>
sudo: required
@@ -72,8 +73,8 @@ before_install:
- docker build -t iputils .
script:
- - INSTALL="${DISTRO%%:*}"
- - INSTALL="${INSTALL%%/*}"
- - DISTRO_VERSION="${DISTRO#*:}"
- - case $VARIANT in cross-compile*) BUILD="cross";; i386) BUILD="32";; *) BUILD="native";; esac
- - docker run -it iputils /bin/sh -c "cd travis && DISTRO_VERSION=\"$DISTRO_VERSION\" ./$INSTALL.sh && if [ \"$VARIANT\" ]; then ARCH=\"$ARCH\" ./$INSTALL.$VARIANT.sh; fi && CC=$CC EXTRA_BUILD_OPTS=\"$EXTRA_BUILD_OPTS\" ../build.sh"
+ - INSTALL="${DISTRO%%:*}"
+ - INSTALL="${INSTALL%%/*}"
+ - DISTRO_VERSION="${DISTRO#*:}"
+ - case $VARIANT in cross-compile*) BUILD="cross";; i386) BUILD="32";; *) BUILD="native";; esac
+ - docker run -it iputils /bin/sh -c "cd travis && DISTRO_VERSION=\"$DISTRO_VERSION\" ./$INSTALL.sh && if [ \"$VARIANT\" ]; then ARCH=\"$ARCH\" ./$INSTALL.$VARIANT.sh; fi && CC=$CC EXTRA_BUILD_OPTS=\"$EXTRA_BUILD_OPTS\" ../build.sh"

View File

@ -1,34 +0,0 @@
diff --git a/arping.c b/arping.c
index a002786..53fdbb4 100644
--- a/arping.c
+++ b/arping.c
@@ -968,7 +968,7 @@ int main(int argc, char **argv)
}
memset(&saddr, 0, sizeof(saddr));
saddr.sin_family = AF_INET;
- if (!ctl.unsolicited && (ctl.source || ctl.gsrc.s_addr)) {
+ if (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");
@@ -979,12 +979,14 @@ int main(int argc, char **argv)
saddr.sin_port = htons(1025);
saddr.sin_addr = ctl.gdst;
- if (setsockopt(probe_fd, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)) == -1)
- error(0, errno, _("WARNING: setsockopt(SO_DONTROUTE)"));
- if (connect(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
- error(2, errno, "connect");
- if (getsockname(probe_fd, (struct sockaddr *)&saddr, &alen) == -1)
- error(2, errno, "getsockname");
+ if (!ctl.unsolicited) {
+ if (setsockopt(probe_fd, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)) == -1)
+ error(0, errno, _("WARNING: setsockopt(SO_DONTROUTE)"));
+ if (connect(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
+ error(2, errno, "connect");
+ if (getsockname(probe_fd, (struct sockaddr *)&saddr, &alen) == -1)
+ error(2, errno, "getsockname");
+ }
ctl.gsrc = saddr.sin_addr;
}
close(probe_fd);

View File

@ -4,23 +4,23 @@ 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(-)
arping.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arping.c b/arping.c
index 30884f6..8fadfcb 100644
index a002786..36986e8 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,
@@ -694,7 +694,7 @@ static int event_loop(struct run_state *ctl)
.it_value.tv_sec = ctl->timeout,
.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)
struct sockaddr_storage from;
@@ -781,12 +781,17 @@ static int event_loop(struct run_state *ctl)
break;
case POLLFD_TIMER:
s = read(tfd, &exp, sizeof(uint64_t));
@ -33,14 +33,13 @@ index 30884f6..8fadfcb 100644
continue;
}
- total_expires += exp;
- if ((0 < ctl->count && (uint64_t)ctl->count < total_expires) ||
- (ctl->quit_on_reply && ctl->timeout < total_expires)) {
- if (0 < ctl->count && (uint64_t)ctl->count < 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)) {
+ (ctl->timeout > 0 && (total_expires * ctl->interval) > (uint64_t)ctl->timeout)||
+ (ctl->quit_on_reply)) {
exit_loop = 1;
continue;
}
--
1.8.3.1
2.27.0

Binary file not shown.

BIN
iputils-s20200821.tar.gz Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
Name: iputils
Version: 20190709
Release: 7
Version: 20200821
Release: 1
Summary: Network monitoring tools including ping
License: BSD and GPLv2+
URL: https://github.com/iputils/iputils
@ -12,16 +12,11 @@ Source3: ninfod.service
Source4: bsd.txt
Source5: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
Patch0001: iputils-ifenslave.patch
Patch0002: 0001-iputils-arpings.patch
Patch0003: 0002-iputils-arpings-count.patch
Patch0004: bugfix-arping-w-does-not-take-effect.patch
Patch0005: 0003-ninfod-change-variable-name-to-avoid-colliding.patch
Patch0006: bugfix-arpping-make-update-neighbours-work-again.patch
Patch6000: 86ed08936d49e2c81ef49dfbd02aca1c74d0c098.patch
Patch6001: 2583fb77dd57c5183998177a3fa13a680b573005.patch
Patch6002: 950d36f8ba5a669cbc34a7972db611b675725fb5.patch
Patch6003: 78e3d25a50537a842fd3b18eab971d63d5891350.patch
Patch0000: iputils-ifenslave.patch
Patch0001: bugfix-arping-w-does-not-take-effect.patch
Patch0002: bugfix-arpping-make-update-neighbours-work-again.patch
Patch6000: 2583fb77dd57c5183998177a3fa13a680b573005.patch
Patch6001: 950d36f8ba5a669cbc34a7972db611b675725fb5.patch
BuildRequires: gcc meson libidn2-devel openssl-devel libcap-devel libxslt
BuildRequires: docbook5-style-xsl systemd glibc-kernheaders gettext
@ -43,12 +38,7 @@ the target machine is alive and receiving network traffic.
%setup -q -a 1 -n %{name}-s%{version}
cp %{SOURCE4} %{SOURCE5} .
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%autopatch -p1
%build
export CFLAGS="-fpie"
@ -103,6 +93,12 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
%{_mandir}/man8/*.8.gz
%changelog
* Thu Jan 28 2021 xihaochen <xihaochen@huawei.com> - 20200821-1
- Type:requirements
- ID:NA
- SUG:NA
- DESC: update iputils to 20200821
* Thu Dec 10 2020 lunankun <lunankun@huawei.com> - 20190709-7
- Type:bugfix
- Id:NA