summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVisa Hankala <visa@hankala.org>2021-09-13 12:57:59 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-30 00:02:22 +0100
commit853b007f6238c8a4f556c2d75dc3425f1147db5a (patch)
tree4b7a462ceea115657334900de7a660557d33c485
parent9e3fb5271683ec2e85e2ede75b28c2e497d849e8 (diff)
downloadpoky-853b007f6238c8a4f556c2d75dc3425f1147db5a.tar.gz
iputils: Fix regression of arp table update
Backport a fix from iputils 20210202 to make arp table updating work again. Fixes: 77c5792aa5e7 ("iputils: fix various arping regressions") (From OE-Core rev: 9df63cd89939b2f4e0b7ea983db8c047e987ff26) Signed-off-by: Visa Hankala <visa@hankala.org> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/iputils/iputils/0001-arping-make-update-neighbours-work-again.patch79
-rw-r--r--meta/recipes-extended/iputils/iputils_s20190709.bb1
2 files changed, 80 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_s20190709.bb b/meta/recipes-extended/iputils/iputils_s20190709.bb
index d652bfcaad..b33b913817 100644
--- a/meta/recipes-extended/iputils/iputils_s20190709.bb
+++ b/meta/recipes-extended/iputils/iputils_s20190709.bb
@@ -20,6 +20,7 @@ SRC_URI = "git://github.com/iputils/iputils \
20 file://0003-arping-Fix-comparison-of-different-signedness-warnin.patch \ 20 file://0003-arping-Fix-comparison-of-different-signedness-warnin.patch \
21 file://0004-arping-return-success-when-unsolicited-ARP-mode-dest.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 \ 22 file://0005-arping-use-additional-timerfd-to-control-when-timeou.patch \
23 file://0001-arping-make-update-neighbours-work-again.patch \
23 " 24 "
24SRCREV = "13e00847176aa23683d68fce1d17ffb523510946" 25SRCREV = "13e00847176aa23683d68fce1d17ffb523510946"
25 26