summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/iputils/iputils/0001-arping-make-update-neighbours-work-again.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/iputils/iputils/0001-arping-make-update-neighbours-work-again.patch')
-rw-r--r--meta/recipes-extended/iputils/iputils/0001-arping-make-update-neighbours-work-again.patch79
1 files changed, 79 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);