summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/iputils/iputils
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/iputils/iputils')
-rw-r--r--meta/recipes-extended/iputils/iputils/0001-arping-make-update-neighbours-work-again.patch79
-rw-r--r--meta/recipes-extended/iputils/iputils/0001-arping-revert-partially-fix-sent-vs-received-package.patch39
-rw-r--r--meta/recipes-extended/iputils/iputils/0002-arping-fix-f-quit-on-first-reply-regression.patch39
-rw-r--r--meta/recipes-extended/iputils/iputils/0003-arping-Fix-comparison-of-different-signedness-warnin.patch37
-rw-r--r--meta/recipes-extended/iputils/iputils/0004-arping-return-success-when-unsolicited-ARP-mode-dest.patch45
-rw-r--r--meta/recipes-extended/iputils/iputils/0005-arping-use-additional-timerfd-to-control-when-timeou.patch94
6 files changed, 333 insertions, 0 deletions
diff --git a/meta/recipes-extended/iputils/iputils/0001-arping-make-update-neighbours-work-again.patch b/meta/recipes-extended/iputils/iputils/0001-arping-make-update-neighbours-work-again.patch
new file mode 100644
index 0000000000..bf86115843
--- /dev/null
+++ b/meta/recipes-extended/iputils/iputils/0001-arping-make-update-neighbours-work-again.patch
@@ -0,0 +1,79 @@
1From 86ed08936d49e2c81ef49dfbd02aca1c74d0c098 Mon Sep 17 00:00:00 2001
2From: lac-0073 <61903197+lac-0073@users.noreply.github.com>
3Date: Mon, 26 Oct 2020 09:45:42 +0800
4Subject: [PATCH] arpping: make update neighbours work again
5
6The arping is using inconsistent sender_ip_addr and target_ip_addr in
7messages. This causes the client receiving the arp message not to update
8the arp table entries.
9
10The specific performance is as follows:
11
12There is a machine 2 with IP 10.20.30.3 configured on eth0:0 that is in the
13same IP subnet as eth0. This IP was originally used on another machine 1,
14and th IP needs to be changed back to the machine 1. When using the arping
15command to announce what ethernet address has IP 10.20.30.3, the arp table
16on machine 3 is not updated.
17
18Machine 3 original arp table:
19
20 10.20.30.3 machine 2 eth0:0 00:00:00:00:00:02
21 10.20.30.2 machine 2 eth0 00:00:00:00:00:02
22 10.20.30.1 machine 1 eth0 00:00:00:00:00:01
23
24Create interface eth0:0 on machine 1, and use the arping command to send arp
25packets. Expected outcome on machine 3:
26
27 10.20.30.3 machine 1 eth0:0 00:00:00:00:00:01
28 10.20.30.2 machine 2 eth0 00:00:00:00:00:02
29 10.20.30.1 machine 1 eth0 00:00:00:00:00:01
30
31Actual results on machine 3:
32
33 10.20.30.3 machine 2 eth0:0 00:00:00:00:00:02
34 10.20.30.2 machine 2 eth0 00:00:00:00:00:02
35 10.20.30.1 machine 1 eth0 00:00:00:00:00:01
36
37Fixes: https://github.com/iputils/iputils/issues/298
38Fixes: 68f12fc4a0dbef4ae4c404da24040d22c5a14339
39Signed-off-by: Aichun Li <liaichun@huawei.com>
40Upstream-Status: Backport [https://github.com/iputils/iputils/commit/86ed08936d49e2c81ef49dfbd02aca1c74d0c098]
41Signed-off-by: Visa Hankala <visa@hankala.org>
42---
43 arping.c | 16 +++++++++-------
44 1 file changed, 9 insertions(+), 7 deletions(-)
45
46diff --git a/arping.c b/arping.c
47index a002786..53fdbb4 100644
48--- a/arping.c
49+++ b/arping.c
50@@ -968,7 +968,7 @@ int main(int argc, char **argv)
51 }
52 memset(&saddr, 0, sizeof(saddr));
53 saddr.sin_family = AF_INET;
54- if (!ctl.unsolicited && (ctl.source || ctl.gsrc.s_addr)) {
55+ if (ctl.source || ctl.gsrc.s_addr) {
56 saddr.sin_addr = ctl.gsrc;
57 if (bind(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
58 error(2, errno, "bind");
59@@ -979,12 +979,14 @@ int main(int argc, char **argv)
60 saddr.sin_port = htons(1025);
61 saddr.sin_addr = ctl.gdst;
62
63- if (setsockopt(probe_fd, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)) == -1)
64- error(0, errno, _("WARNING: setsockopt(SO_DONTROUTE)"));
65- if (connect(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
66- error(2, errno, "connect");
67- if (getsockname(probe_fd, (struct sockaddr *)&saddr, &alen) == -1)
68- error(2, errno, "getsockname");
69+ if (!ctl.unsolicited) {
70+ if (setsockopt(probe_fd, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)) == -1)
71+ error(0, errno, _("WARNING: setsockopt(SO_DONTROUTE)"));
72+ if (connect(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1)
73+ error(2, errno, "connect");
74+ if (getsockname(probe_fd, (struct sockaddr *)&saddr, &alen) == -1)
75+ error(2, errno, "getsockname");
76+ }
77 ctl.gsrc = saddr.sin_addr;
78 }
79 close(probe_fd);
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 @@
1From 18f14be80466ddc8fb17a400be82764a779c8dcd Mon Sep 17 00:00:00 2001
2From: Sami Kerola <kerolasa@iki.fi>
3Date: Wed, 31 Jul 2019 21:28:12 +0100
4Subject: [PATCH] arping: revert partially - fix sent vs received packages
5 return value
6
7Commit 84ca65ca980315c73f929fed8b6f16bbd698c3a0 caused regression. The
8arping -D needs return value evaluation that was the earlier default, in
9other cases the new return value should be correct.
10
11Addresses: https://github.com/iputils/iputils/issues/209
12See-also: https://github.com/void-linux/void-packages/issues/13304
13Signed-off-by: Sami Kerola <kerolasa@iki.fi>
14Upstream-Status: Backport [https://github.com/iputils/iputils/commit/18f14be80466ddc8fb17a400be82764a779c8dcd]
15Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
16---
17 arping.c | 6 +++++-
18 1 file changed, 5 insertions(+), 1 deletion(-)
19
20diff --git a/arping.c b/arping.c
21index 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--
382.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 @@
1From 1df5350bdc952b14901fde356b17b78c2bcd4cff Mon Sep 17 00:00:00 2001
2From: Sami Kerola <kerolasa@iki.fi>
3Date: Wed, 28 Aug 2019 20:05:22 +0100
4Subject: [PATCH] arping: fix -f quit on first reply regression
5
6When 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
8received after wait period. Notice that the exit in case of lost packages
9will be 1 signifying failure. Getting a reply results to 0 exit value.
10
11Addresses: https://bugs.debian.org/935946
12Reported-by: Lucas Nussbaum <lucas@debian.org>
13Addresses: https://github.com/iputils/iputils/issues/211
14Reported-by: Noah Meyerhans <noahm@debian.org>
15Broken-since: 67e070d08dcbec990e1178360f82b3e2ca4f6d5f
16Signed-off-by: Sami Kerola <kerolasa@iki.fi>
17Upstream-Status: Backport [https://github.com/iputils/iputils/commit/1df5350bdc952b14901fde356b17b78c2bcd4cff]
18Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
19---
20 arping.c | 3 ++-
21 1 file changed, 2 insertions(+), 1 deletion(-)
22
23diff --git a/arping.c b/arping.c
24index 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--
382.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 @@
1From ec821e572a640bd79aecc3922cb9001f4b6b26f2 Mon Sep 17 00:00:00 2001
2From: Petr Vorel <petr.vorel@gmail.com>
3Date: Sat, 7 Sep 2019 06:07:19 +0200
4Subject: [PATCH] arping: Fix comparison of different signedness warning
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-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
12Fixes: 1df5350 ("arping: fix -f quit on first reply regression")
13Reference: https://github.com/iputils/iputils/pull/212
14Acked-by: Sami Kerola <kerolasa@iki.fi>
15Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
16Upstream-Status: Backport [https://github.com/iputils/iputils/commit/ec821e572a640bd79aecc3922cb9001f4b6b26f2]
17Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
18---
19 arping.c | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22diff --git a/arping.c b/arping.c
23index 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--
362.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 @@
1From 68f12fc4a0dbef4ae4c404da24040d22c5a14339 Mon Sep 17 00:00:00 2001
2From: Sami Kerola <kerolasa@iki.fi>
3Date: Sat, 8 Feb 2020 14:12:18 +0000
4Subject: [PATCH] arping: return success when unsolicited ARP mode destination
5 does not answer
6
7Manual page is making promise answers are not expected when -U (or -A)
8option is in use. Either I am looking wrong or this has been broken since
9at the beginning of git history.
10
11Addresses: https://github.com/iputils/iputils/issues/247
12Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13Upstream-Status: Backport [https://github.com/iputils/iputils/commit/68f12fc4a0dbef4ae4c404da24040d22c5a14339]
14Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
15---
16 arping.c | 6 ++++--
17 1 file changed, 4 insertions(+), 2 deletions(-)
18
19diff --git a/arping.c b/arping.c
20index 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--
442.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 @@
1From 60a27c76174c0ae23bdafde2bad4fdd18a44a7ea Mon Sep 17 00:00:00 2001
2From: Sami Kerola <kerolasa@iki.fi>
3Date: Sat, 7 Mar 2020 22:03:21 +0000
4Subject: [PATCH] arping: use additional timerfd to control when timeout
5 happens
6
7Trying to determine timeout by adding up interval values is pointlessly
8complicating. With separate timer everything just works.
9
10Addresses: https://github.com/iputils/iputils/issues/259
11Fixes: 1df5350bdc952b14901fde356b17b78c2bcd4cff
12Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13Upstream-Status: Backport [https://github.com/iputils/iputils/commit/e594ca52afde89746b7d79c875fe9d6aea1850ac]
14Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
15---
16 arping.c | 29 ++++++++++++++++++++++++++---
17 1 file changed, 26 insertions(+), 3 deletions(-)
18
19diff --git a/arping.c b/arping.c
20index 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--
932.18.4
94