!14 fix arping update neighbours
From: @lunankun Reviewed-by: @zengwefeng Signed-off-by: @zengwefeng
This commit is contained in:
commit
f1017a4d5a
77
bugfix-arpping-make-update-neighbours-work-again.patch
Normal file
77
bugfix-arpping-make-update-neighbours-work-again.patch
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
From 86ed08936d49e2c81ef49dfbd02aca1c74d0c098 Mon Sep 17 00:00:00 2001
|
||||||
|
From: lac-0073 <61903197+lac-0073@users.noreply.github.com>
|
||||||
|
Date: Mon, 26 Oct 2020 09:45:42 +0800
|
||||||
|
Subject: [PATCH] arpping: make update neighbours work again
|
||||||
|
|
||||||
|
The arping is using inconsistent sender_ip_addr and target_ip_addr in
|
||||||
|
messages. This causes the client receiving the arp message not to update
|
||||||
|
the arp table entries.
|
||||||
|
|
||||||
|
The specific performance is as follows:
|
||||||
|
|
||||||
|
There is a machine 2 with IP 10.20.30.3 configured on eth0:0 that is in the
|
||||||
|
same IP subnet as eth0. This IP was originally used on another machine 1,
|
||||||
|
and th IP needs to be changed back to the machine 1. When using the arping
|
||||||
|
command to announce what ethernet address has IP 10.20.30.3, the arp table
|
||||||
|
on machine 3 is not updated.
|
||||||
|
|
||||||
|
Machine 3 original arp table:
|
||||||
|
|
||||||
|
10.20.30.3 machine 2 eth0:0 00:00:00:00:00:02
|
||||||
|
10.20.30.2 machine 2 eth0 00:00:00:00:00:02
|
||||||
|
10.20.30.1 machine 1 eth0 00:00:00:00:00:01
|
||||||
|
|
||||||
|
Create interface eth0:0 on machine 1, and use the arping command to send arp
|
||||||
|
packets. Expected outcome on machine 3:
|
||||||
|
|
||||||
|
10.20.30.3 machine 1 eth0:0 00:00:00:00:00:01
|
||||||
|
10.20.30.2 machine 2 eth0 00:00:00:00:00:02
|
||||||
|
10.20.30.1 machine 1 eth0 00:00:00:00:00:01
|
||||||
|
|
||||||
|
Actual results on machine 3:
|
||||||
|
|
||||||
|
10.20.30.3 machine 2 eth0:0 00:00:00:00:00:02
|
||||||
|
10.20.30.2 machine 2 eth0 00:00:00:00:00:02
|
||||||
|
10.20.30.1 machine 1 eth0 00:00:00:00:00:01
|
||||||
|
|
||||||
|
Fixes: https://github.com/iputils/iputils/issues/298
|
||||||
|
Fixes: 68f12fc4a0dbef4ae4c404da24040d22c5a14339
|
||||||
|
Signed-off-by: Aichun Li <liaichun@huawei.com>
|
||||||
|
---
|
||||||
|
arping.c | 16 +++++++++-------
|
||||||
|
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
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);
|
||||||
12
iputils.spec
12
iputils.spec
@ -1,6 +1,6 @@
|
|||||||
Name: iputils
|
Name: iputils
|
||||||
Version: 20190709
|
Version: 20190709
|
||||||
Release: 6
|
Release: 7
|
||||||
Summary: Network monitoring tools including ping
|
Summary: Network monitoring tools including ping
|
||||||
License: BSD and GPLv2+
|
License: BSD and GPLv2+
|
||||||
URL: https://github.com/iputils/iputils
|
URL: https://github.com/iputils/iputils
|
||||||
@ -17,6 +17,7 @@ Patch0002: 0001-iputils-arpings.patch
|
|||||||
Patch0003: 0002-iputils-arpings-count.patch
|
Patch0003: 0002-iputils-arpings-count.patch
|
||||||
Patch0004: bugfix-arping-w-does-not-take-effect.patch
|
Patch0004: bugfix-arping-w-does-not-take-effect.patch
|
||||||
Patch0005: 0003-ninfod-change-variable-name-to-avoid-colliding.patch
|
Patch0005: 0003-ninfod-change-variable-name-to-avoid-colliding.patch
|
||||||
|
Patch0006: bugfix-arpping-make-update-neighbours-work-again.patch
|
||||||
Patch6000: 86ed08936d49e2c81ef49dfbd02aca1c74d0c098.patch
|
Patch6000: 86ed08936d49e2c81ef49dfbd02aca1c74d0c098.patch
|
||||||
Patch6001: 2583fb77dd57c5183998177a3fa13a680b573005.patch
|
Patch6001: 2583fb77dd57c5183998177a3fa13a680b573005.patch
|
||||||
Patch6002: 950d36f8ba5a669cbc34a7972db611b675725fb5.patch
|
Patch6002: 950d36f8ba5a669cbc34a7972db611b675725fb5.patch
|
||||||
@ -47,6 +48,7 @@ cp %{SOURCE4} %{SOURCE5} .
|
|||||||
%patch0003 -p1
|
%patch0003 -p1
|
||||||
%patch0004 -p1
|
%patch0004 -p1
|
||||||
%patch0005 -p1
|
%patch0005 -p1
|
||||||
|
%patch0006 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export CFLAGS="-fpie"
|
export CFLAGS="-fpie"
|
||||||
@ -101,6 +103,12 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
|
|||||||
%{_mandir}/man8/*.8.gz
|
%{_mandir}/man8/*.8.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Dec 10 2020 lunankun <lunankun@huawei.com> - 20190709-7
|
||||||
|
- Type:bugfix
|
||||||
|
- Id:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: fix arping update neighbours
|
||||||
|
|
||||||
* 20201129205849773219 patch-tracking 20190709-6
|
* 20201129205849773219 patch-tracking 20190709-6
|
||||||
- append patch file of upstream repository from <2583fb77dd57c5183998177a3fa13a680b573005> to <78e3d25a50537a842fd3b18eab971d63d5891350>
|
- append patch file of upstream repository from <2583fb77dd57c5183998177a3fa13a680b573005> to <78e3d25a50537a842fd3b18eab971d63d5891350>
|
||||||
|
|
||||||
@ -138,4 +146,4 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
|
|||||||
- DESC:add the softlink for arping
|
- DESC:add the softlink for arping
|
||||||
|
|
||||||
* Wed Sep 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 20190515-1
|
* Wed Sep 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 20190515-1
|
||||||
- Package init
|
- Package init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user