diff options
author | Diego Santa Cruz <Diego.SantaCruz@spinetix.com> | 2021-03-18 19:02:17 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-28 22:31:47 +0100 |
commit | aba2c5f6462c2c8beca6ae401c5d53cd1cc68fa9 (patch) | |
tree | 3faa98ef2db62c6c7fbb830611869ac63c1c1cb8 /meta/recipes-extended | |
parent | f3be5ea3c235b9335969b6b36de6e8be41352994 (diff) | |
download | poky-aba2c5f6462c2c8beca6ae401c5d53cd1cc68fa9.tar.gz |
iputils: fix various arping regressions
arping in iputils s20190709 has several problems, this backports the
fixes from s20200821.
- -D, duplicate address detection, always returns failure
- -w -f does not behave correctly
- -w option hangs arping
- -U option returns failure
(From OE-Core rev: 77c5792aa5e7cb7760c7042a49c2c0b02109987f)
Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended')
6 files changed, 259 insertions, 0 deletions
diff --git a/meta/recipes-extended/iputils/iputils/0001-arping-revert-partially-fix-sent-vs-received-package.patch b/meta/recipes-extended/iputils/iputils/0001-arping-revert-partially-fix-sent-vs-received-package.patch new file mode 100644 index 0000000000..8495178879 --- /dev/null +++ b/meta/recipes-extended/iputils/iputils/0001-arping-revert-partially-fix-sent-vs-received-package.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 18f14be80466ddc8fb17a400be82764a779c8dcd Mon Sep 17 00:00:00 2001 | ||
2 | From: Sami Kerola <kerolasa@iki.fi> | ||
3 | Date: Wed, 31 Jul 2019 21:28:12 +0100 | ||
4 | Subject: [PATCH] arping: revert partially - fix sent vs received packages | ||
5 | return value | ||
6 | |||
7 | Commit 84ca65ca980315c73f929fed8b6f16bbd698c3a0 caused regression. The | ||
8 | arping -D needs return value evaluation that was the earlier default, in | ||
9 | other cases the new return value should be correct. | ||
10 | |||
11 | Addresses: https://github.com/iputils/iputils/issues/209 | ||
12 | See-also: https://github.com/void-linux/void-packages/issues/13304 | ||
13 | Signed-off-by: Sami Kerola <kerolasa@iki.fi> | ||
14 | Upstream-Status: Backport [https://github.com/iputils/iputils/commit/18f14be80466ddc8fb17a400be82764a779c8dcd] | ||
15 | Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com> | ||
16 | --- | ||
17 | arping.c | 6 +++++- | ||
18 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/arping.c b/arping.c | ||
21 | index 77c9c56..2c87c15 100644 | ||
22 | --- a/arping.c | ||
23 | +++ b/arping.c | ||
24 | @@ -792,7 +792,11 @@ static int event_loop(struct run_state *ctl) | ||
25 | close(tfd); | ||
26 | freeifaddrs(ctl->ifa0); | ||
27 | rc |= finish(ctl); | ||
28 | - rc |= (ctl->sent != ctl->received); | ||
29 | + if (ctl->dad && ctl->quit_on_reply) | ||
30 | + /* Duplicate address detection mode return value */ | ||
31 | + rc |= !(ctl->brd_sent != ctl->received); | ||
32 | + else | ||
33 | + rc |= (ctl->sent != ctl->received); | ||
34 | return rc; | ||
35 | } | ||
36 | |||
37 | -- | ||
38 | 2.18.4 | ||
39 | |||
diff --git a/meta/recipes-extended/iputils/iputils/0002-arping-fix-f-quit-on-first-reply-regression.patch b/meta/recipes-extended/iputils/iputils/0002-arping-fix-f-quit-on-first-reply-regression.patch new file mode 100644 index 0000000000..a5f40860dc --- /dev/null +++ b/meta/recipes-extended/iputils/iputils/0002-arping-fix-f-quit-on-first-reply-regression.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 1df5350bdc952b14901fde356b17b78c2bcd4cff Mon Sep 17 00:00:00 2001 | ||
2 | From: Sami Kerola <kerolasa@iki.fi> | ||
3 | Date: Wed, 28 Aug 2019 20:05:22 +0100 | ||
4 | Subject: [PATCH] arping: fix -f quit on first reply regression | ||
5 | |||
6 | When arping runs together with -f 'quit on first reply' and -w <timeout> | ||
7 | 'how long to wait for a reply' the command needs to exit if replies are not | ||
8 | received after wait period. Notice that the exit in case of lost packages | ||
9 | will be 1 signifying failure. Getting a reply results to 0 exit value. | ||
10 | |||
11 | Addresses: https://bugs.debian.org/935946 | ||
12 | Reported-by: Lucas Nussbaum <lucas@debian.org> | ||
13 | Addresses: https://github.com/iputils/iputils/issues/211 | ||
14 | Reported-by: Noah Meyerhans <noahm@debian.org> | ||
15 | Broken-since: 67e070d08dcbec990e1178360f82b3e2ca4f6d5f | ||
16 | Signed-off-by: Sami Kerola <kerolasa@iki.fi> | ||
17 | Upstream-Status: Backport [https://github.com/iputils/iputils/commit/1df5350bdc952b14901fde356b17b78c2bcd4cff] | ||
18 | Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com> | ||
19 | --- | ||
20 | arping.c | 3 ++- | ||
21 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/arping.c b/arping.c | ||
24 | index 2c87c15..30884f6 100644 | ||
25 | --- a/arping.c | ||
26 | +++ b/arping.c | ||
27 | @@ -764,7 +764,8 @@ static int event_loop(struct run_state *ctl) | ||
28 | continue; | ||
29 | } | ||
30 | total_expires += exp; | ||
31 | - if (0 < ctl->count && (uint64_t)ctl->count < total_expires) { | ||
32 | + if ((0 < ctl->count && (uint64_t)ctl->count < total_expires) || | ||
33 | + (ctl->quit_on_reply && ctl->timeout < total_expires)) { | ||
34 | exit_loop = 1; | ||
35 | continue; | ||
36 | } | ||
37 | -- | ||
38 | 2.18.4 | ||
39 | |||
diff --git a/meta/recipes-extended/iputils/iputils/0003-arping-Fix-comparison-of-different-signedness-warnin.patch b/meta/recipes-extended/iputils/iputils/0003-arping-Fix-comparison-of-different-signedness-warnin.patch new file mode 100644 index 0000000000..ebd122c157 --- /dev/null +++ b/meta/recipes-extended/iputils/iputils/0003-arping-Fix-comparison-of-different-signedness-warnin.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From ec821e572a640bd79aecc3922cb9001f4b6b26f2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Petr Vorel <petr.vorel@gmail.com> | ||
3 | Date: Sat, 7 Sep 2019 06:07:19 +0200 | ||
4 | Subject: [PATCH] arping: Fix comparison of different signedness warning | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | ../arping.c:768:45: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint64_t’ {aka ‘long unsigned int’} [-Wsign-compare] | ||
10 | 768 | (ctl->quit_on_reply && ctl->timeout < total_expires)) { | ||
11 | |||
12 | Fixes: 1df5350 ("arping: fix -f quit on first reply regression") | ||
13 | Reference: https://github.com/iputils/iputils/pull/212 | ||
14 | Acked-by: Sami Kerola <kerolasa@iki.fi> | ||
15 | Signed-off-by: Petr Vorel <petr.vorel@gmail.com> | ||
16 | Upstream-Status: Backport [https://github.com/iputils/iputils/commit/ec821e572a640bd79aecc3922cb9001f4b6b26f2] | ||
17 | Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com> | ||
18 | --- | ||
19 | arping.c | 2 +- | ||
20 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/arping.c b/arping.c | ||
23 | index 2d05728..88319cd 100644 | ||
24 | --- a/arping.c | ||
25 | +++ b/arping.c | ||
26 | @@ -765,7 +765,7 @@ static int event_loop(struct run_state *ctl) | ||
27 | } | ||
28 | total_expires += exp; | ||
29 | if ((0 < ctl->count && (uint64_t)ctl->count < total_expires) || | ||
30 | - (ctl->quit_on_reply && ctl->timeout < total_expires)) { | ||
31 | + (ctl->quit_on_reply && ctl->timeout < (long)total_expires)) { | ||
32 | exit_loop = 1; | ||
33 | continue; | ||
34 | } | ||
35 | -- | ||
36 | 2.18.4 | ||
37 | |||
diff --git a/meta/recipes-extended/iputils/iputils/0004-arping-return-success-when-unsolicited-ARP-mode-dest.patch b/meta/recipes-extended/iputils/iputils/0004-arping-return-success-when-unsolicited-ARP-mode-dest.patch new file mode 100644 index 0000000000..923e06e30b --- /dev/null +++ b/meta/recipes-extended/iputils/iputils/0004-arping-return-success-when-unsolicited-ARP-mode-dest.patch | |||
@@ -0,0 +1,45 @@ | |||
1 | From 68f12fc4a0dbef4ae4c404da24040d22c5a14339 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sami Kerola <kerolasa@iki.fi> | ||
3 | Date: Sat, 8 Feb 2020 14:12:18 +0000 | ||
4 | Subject: [PATCH] arping: return success when unsolicited ARP mode destination | ||
5 | does not answer | ||
6 | |||
7 | Manual page is making promise answers are not expected when -U (or -A) | ||
8 | option is in use. Either I am looking wrong or this has been broken since | ||
9 | at the beginning of git history. | ||
10 | |||
11 | Addresses: https://github.com/iputils/iputils/issues/247 | ||
12 | Signed-off-by: Sami Kerola <kerolasa@iki.fi> | ||
13 | Upstream-Status: Backport [https://github.com/iputils/iputils/commit/68f12fc4a0dbef4ae4c404da24040d22c5a14339] | ||
14 | Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com> | ||
15 | --- | ||
16 | arping.c | 6 ++++-- | ||
17 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
18 | |||
19 | diff --git a/arping.c b/arping.c | ||
20 | index 996cf2b..5180ae0 100644 | ||
21 | --- a/arping.c | ||
22 | +++ b/arping.c | ||
23 | @@ -794,7 +794,9 @@ static int event_loop(struct run_state *ctl) | ||
24 | close(tfd); | ||
25 | freeifaddrs(ctl->ifa0); | ||
26 | rc |= finish(ctl); | ||
27 | - if (ctl->dad && ctl->quit_on_reply) | ||
28 | + if (ctl->unsolicited) | ||
29 | + /* nothing */; | ||
30 | + else if (ctl->dad && ctl->quit_on_reply) | ||
31 | /* Duplicate address detection mode return value */ | ||
32 | rc |= !(ctl->brd_sent != ctl->received); | ||
33 | else | ||
34 | @@ -943,7 +945,7 @@ int main(int argc, char **argv) | ||
35 | } | ||
36 | memset(&saddr, 0, sizeof(saddr)); | ||
37 | saddr.sin_family = AF_INET; | ||
38 | - if (ctl.source || ctl.gsrc.s_addr) { | ||
39 | + if (!ctl.unsolicited && (ctl.source || ctl.gsrc.s_addr)) { | ||
40 | saddr.sin_addr = ctl.gsrc; | ||
41 | if (bind(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) | ||
42 | error(2, errno, "bind"); | ||
43 | -- | ||
44 | 2.18.4 | ||
45 | |||
diff --git a/meta/recipes-extended/iputils/iputils/0005-arping-use-additional-timerfd-to-control-when-timeou.patch b/meta/recipes-extended/iputils/iputils/0005-arping-use-additional-timerfd-to-control-when-timeou.patch new file mode 100644 index 0000000000..3b8a8244da --- /dev/null +++ b/meta/recipes-extended/iputils/iputils/0005-arping-use-additional-timerfd-to-control-when-timeou.patch | |||
@@ -0,0 +1,94 @@ | |||
1 | From 60a27c76174c0ae23bdafde2bad4fdd18a44a7ea Mon Sep 17 00:00:00 2001 | ||
2 | From: Sami Kerola <kerolasa@iki.fi> | ||
3 | Date: Sat, 7 Mar 2020 22:03:21 +0000 | ||
4 | Subject: [PATCH] arping: use additional timerfd to control when timeout | ||
5 | happens | ||
6 | |||
7 | Trying to determine timeout by adding up interval values is pointlessly | ||
8 | complicating. With separate timer everything just works. | ||
9 | |||
10 | Addresses: https://github.com/iputils/iputils/issues/259 | ||
11 | Fixes: 1df5350bdc952b14901fde356b17b78c2bcd4cff | ||
12 | Signed-off-by: Sami Kerola <kerolasa@iki.fi> | ||
13 | Upstream-Status: Backport [https://github.com/iputils/iputils/commit/e594ca52afde89746b7d79c875fe9d6aea1850ac] | ||
14 | Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com> | ||
15 | --- | ||
16 | arping.c | 29 ++++++++++++++++++++++++++--- | ||
17 | 1 file changed, 26 insertions(+), 3 deletions(-) | ||
18 | |||
19 | diff --git a/arping.c b/arping.c | ||
20 | index 61db3a6..7284351 100644 | ||
21 | --- a/arping.c | ||
22 | +++ b/arping.c | ||
23 | @@ -670,6 +670,7 @@ static int event_loop(struct run_state *ctl) | ||
24 | enum { | ||
25 | POLLFD_SIGNAL = 0, | ||
26 | POLLFD_TIMER, | ||
27 | + POLLFD_TIMEOUT, | ||
28 | POLLFD_SOCKET, | ||
29 | POLLFD_COUNT | ||
30 | }; | ||
31 | @@ -686,6 +687,13 @@ static int event_loop(struct run_state *ctl) | ||
32 | .it_value.tv_sec = ctl->interval, | ||
33 | .it_value.tv_nsec = 0 | ||
34 | }; | ||
35 | + int timeoutfd; | ||
36 | + struct itimerspec timeoutfd_vals = { | ||
37 | + .it_interval.tv_sec = ctl->timeout, | ||
38 | + .it_interval.tv_nsec = 0, | ||
39 | + .it_value.tv_sec = ctl->timeout, | ||
40 | + .it_value.tv_nsec = 0 | ||
41 | + }; | ||
42 | uint64_t exp, total_expires = 1; | ||
43 | |||
44 | unsigned char packet[4096]; | ||
45 | @@ -709,7 +717,7 @@ static int event_loop(struct run_state *ctl) | ||
46 | pfds[POLLFD_SIGNAL].fd = sfd; | ||
47 | pfds[POLLFD_SIGNAL].events = POLLIN | POLLERR | POLLHUP; | ||
48 | |||
49 | - /* timerfd */ | ||
50 | + /* interval timerfd */ | ||
51 | tfd = timerfd_create(CLOCK_MONOTONIC, 0); | ||
52 | if (tfd == -1) { | ||
53 | error(0, errno, "timerfd_create failed"); | ||
54 | @@ -722,6 +730,19 @@ static int event_loop(struct run_state *ctl) | ||
55 | pfds[POLLFD_TIMER].fd = tfd; | ||
56 | pfds[POLLFD_TIMER].events = POLLIN | POLLERR | POLLHUP; | ||
57 | |||
58 | + /* timeout timerfd */ | ||
59 | + timeoutfd = timerfd_create(CLOCK_MONOTONIC, 0); | ||
60 | + if (tfd == -1) { | ||
61 | + error(0, errno, "timerfd_create failed"); | ||
62 | + return 1; | ||
63 | + } | ||
64 | + if (timerfd_settime(timeoutfd, 0, &timeoutfd_vals, NULL)) { | ||
65 | + error(0, errno, "timerfd_settime failed"); | ||
66 | + return 1; | ||
67 | + } | ||
68 | + pfds[POLLFD_TIMEOUT].fd = timeoutfd; | ||
69 | + pfds[POLLFD_TIMEOUT].events = POLLIN | POLLERR | POLLHUP; | ||
70 | + | ||
71 | /* socket */ | ||
72 | pfds[POLLFD_SOCKET].fd = ctl->socketfd; | ||
73 | pfds[POLLFD_SOCKET].events = POLLIN | POLLERR | POLLHUP; | ||
74 | @@ -764,13 +785,15 @@ static int event_loop(struct run_state *ctl) | ||
75 | continue; | ||
76 | } | ||
77 | total_expires += exp; | ||
78 | - if ((0 < ctl->count && (uint64_t)ctl->count < total_expires) || | ||
79 | - (ctl->quit_on_reply && ctl->timeout < (long)total_expires)) { | ||
80 | + if (0 < ctl->count && (uint64_t)ctl->count < total_expires) { | ||
81 | exit_loop = 1; | ||
82 | continue; | ||
83 | } | ||
84 | send_pack(ctl); | ||
85 | break; | ||
86 | + case POLLFD_TIMEOUT: | ||
87 | + exit_loop = 1; | ||
88 | + break; | ||
89 | case POLLFD_SOCKET: | ||
90 | if ((s = | ||
91 | recvfrom(ctl->socketfd, packet, sizeof(packet), 0, | ||
92 | -- | ||
93 | 2.18.4 | ||
94 | |||
diff --git a/meta/recipes-extended/iputils/iputils_s20190709.bb b/meta/recipes-extended/iputils/iputils_s20190709.bb index 545f3d5e87..d652bfcaad 100644 --- a/meta/recipes-extended/iputils/iputils_s20190709.bb +++ b/meta/recipes-extended/iputils/iputils_s20190709.bb | |||
@@ -15,6 +15,11 @@ SRC_URI = "git://github.com/iputils/iputils \ | |||
15 | file://0001-ninfod-fix-systemd-Documentation-url-error.patch \ | 15 | file://0001-ninfod-fix-systemd-Documentation-url-error.patch \ |
16 | file://0001-rarpd-rdisc-Drop-PrivateUsers.patch \ | 16 | file://0001-rarpd-rdisc-Drop-PrivateUsers.patch \ |
17 | file://0001-iputils-Initialize-libgcrypt.patch \ | 17 | file://0001-iputils-Initialize-libgcrypt.patch \ |
18 | file://0001-arping-revert-partially-fix-sent-vs-received-package.patch \ | ||
19 | file://0002-arping-fix-f-quit-on-first-reply-regression.patch \ | ||
20 | file://0003-arping-Fix-comparison-of-different-signedness-warnin.patch \ | ||
21 | file://0004-arping-return-success-when-unsolicited-ARP-mode-dest.patch \ | ||
22 | file://0005-arping-use-additional-timerfd-to-control-when-timeou.patch \ | ||
18 | " | 23 | " |
19 | SRCREV = "13e00847176aa23683d68fce1d17ffb523510946" | 24 | SRCREV = "13e00847176aa23683d68fce1d17ffb523510946" |
20 | 25 | ||